@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Light Mode Tokens */
    --bg-primary: #f9f8f4; /* Soft warm cream off-white */
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-active: rgba(234, 179, 8, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(15, 23, 42, 0.08);
    
    /* Primary Colors */
    --primary: #eab308; /* Yellow 500 */
    --primary-hover: #ca8a04; /* Yellow 600 */
    --secondary: #fbbf24; /* Amber 400 */
    --accent: #f59e0b; /* Amber 500 */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Glow/Shadow Colors */
    --primary-glow: rgba(234, 179, 8, 0.3);
    --primary-glow-hover: rgba(234, 179, 8, 0.45);
    --nav-active-text: #0f172a; /* Modern high contrast dark text on yellow */

    /* Bootstrap Overrides */
    --bs-primary: var(--primary);
    --bs-primary-rgb: 234, 179, 8;
    --bs-link-color: var(--primary-hover);
    --bs-link-hover-color: var(--primary);
    
    --font-family: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
    --card-radius: 16px;

    /* Theme Custom Headings, Custom Tables & User Badges */
    --page-title-color: #1f2937;
    --tbl-header-bg: #fdfbf7;
    --tbl-header-color: #85704d;
    --tbl-header-border: rgba(15, 23, 42, 0.04);
    --user-pill-bg: #fffdf5;
    --user-pill-color: #b45309;
    --user-pill-border: #f59e0b;
}

/* Custom Navbar Background Class */
.bg-custom-navbar {
    background-color: var(--bg-sidebar) !important;
    transition: background-color var(--transition-speed);
}

[data-bs-theme="dark"], [data-theme="dark"] {
    /* Dark Mode Tokens */
    --bg-primary: #090d16; /* Warna latar belakang gelap yang lebih nyaman di mata */
    --bg-sidebar: #101622;
    --bg-card: rgba(16, 22, 34, 0.75);
    --bg-active: rgba(52, 211, 153, 0.08); /* Aksen aktif berwarna hijau emerald */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: rgba(52, 211, 153, 0.12); /* Garis batas dengan nuansa hijau lembut */

    /* Primary Colors for Dark Mode (Disinkronkan dengan warna Hijau Emerald) */
    --primary: #34d399; /* Hijau emerald dengan kontras tinggi untuk mode gelap */
    --primary-hover: #10b981;
    --secondary: #6ee7b7;
    --accent: #f59e0b; /* Tetap pertahankan aksen kuning amber */

    /* Glow/Shadow Colors for Dark Mode */
    --primary-glow: rgba(52, 211, 153, 0.2);
    --primary-glow-hover: rgba(52, 211, 153, 0.35);
    --nav-active-text: #090d16;

    /* Bootstrap Overrides for Dark Mode */
    --bs-primary: var(--primary);
    --bs-primary-rgb: 52, 211, 153;

    /* Theme Custom Headings, Custom Tables & User Badges for Dark Mode */
    --page-title-color: var(--text-primary);
    --tbl-header-bg: rgba(52, 211, 153, 0.1);
    --tbl-header-color: var(--primary);
    --tbl-header-border: var(--border-color);
    --user-pill-bg: rgba(52, 211, 153, 0.08);
    --user-pill-color: var(--primary);
    --user-pill-border: var(--primary);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Styles */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s, border-color var(--transition-speed);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.06);
}

/* Typography & Layout */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    font-weight: 500;
    padding: 0.5em 0.8em;
    border-radius: 8px;
}

/* Sidebar Styling */
/* Horizontal Navbar Navigation */
.nav-link-custom-horizontal {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 12px;
    display: inline-block;
    transition: all 0.2s;
    position: relative;
    font-size: 0.95rem;
    white-space: nowrap; /* Memastikan teks link selalu satu baris */
}

.nav-link-custom-horizontal:hover {
    color: #10b981;
}

.nav-link-custom-horizontal.active {
    color: #10b981 !important;
    font-weight: 600;
}

.nav-link-custom-horizontal.active::after {
    content: '';
    position: absolute;
    bottom: -22px; /* place it exactly on the navbar bottom border */
    left: 12px;
    right: 12px;
    height: 3px;
    background-color: #10b981;
    border-radius: 2px;
}

/* User Profile Badge */
.user-pill {
    border: 1.5px solid var(--user-pill-border) !important;
    background-color: var(--user-pill-bg);
    color: var(--user-pill-color);
}

/* Logout Button */
.logout-btn {
    background-color: #fef2f2;
    color: #ef4444;
    font-size: 0.85rem;
}

.logout-btn:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Success/Warning Brand Custom Colors */
.text-success-custom {
    color: #10b981 !important;
}

.text-warning-custom {
    color: #f59e0b !important;
}

/* Custom Underlined Page Header */
.page-title-custom {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--page-title-color);
    position: relative;
    padding-bottom: 12px;
    margin-bottom: 30px;
    display: inline-block;
}

.page-title-custom::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 210px;
    height: 4px;
    background-color: #f59e0b; /* Thick yellow bar underneath */
    border-radius: 2px;
}

/* Table Custom Overrides */
.table-header-custom th {
    background-color: var(--tbl-header-bg) !important;
    color: var(--tbl-header-color) !important;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 1.5px solid var(--tbl-header-border) !important;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
}

.status-returned {
    background-color: #e6f4ea;
    color: #137333;
}

.status-overdue {
    background-color: #fce8e6;
    color: #c5221f;
}

.status-borrowed {
    background-color: #fef7e0;
    color: #b06000;
}

/* Custom Buttons */
.btn-outline-warning-custom {
    color: #d97706;
    border: 1.5px solid #f59e0b;
    background-color: transparent;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-outline-warning-custom:hover {
    color: #ffffff;
    background-color: #d97706;
    border-color: #d97706;
}

/* Main Content Area */
.main-content {
    margin-left: 0;
    padding: 40px 0;
    min-height: calc(100vh - 74px);
    transition: none;
}

/* Glowing Table design */
.table-custom {
    color: var(--text-primary);
    border-color: var(--border-color);
    background-color: transparent !important;
}

.table-custom th {
    font-weight: 600;
    background-color: var(--bg-active) !important;
    color: var(--primary) !important;
    border-bottom: 2px solid var(--border-color);
}

.table-custom td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    background-color: transparent !important;
}

/* Glass Card Table overrides to maintain glassmorphism transparency and beautiful style in both modes */
.glass-card table,
.glass-card .table {
    background-color: transparent !important;
}

.glass-card table tr,
.glass-card table td {
    background-color: transparent !important;
}

.glass-card table tbody tr:hover td {
    background-color: var(--bg-active) !important;
}

/* Card stats design */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(251, 191, 36, 0.15) 100%);
    border-radius: 50%;
}

.stat-icon {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Custom Auth Page Styling */
.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 10% 20%, rgba(234, 179, 8, 0.05) 0%, rgba(251, 191, 36, 0.05) 90.1%), var(--bg-primary);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
}

/* Responsive Overrides */
@media (max-width: 991.98px) {
    .main-content {
        padding: 24px 16px;
    }
    .nav-link-custom-horizontal.active::after {
        display: none; /* Hide active indicator line on mobile view */
    }
}

/* Custom form styling */
.form-control, .form-select {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem var(--primary-glow);
}

/* Custom Input Group Overrides */
.input-group {
    border-radius: 10px;
}

.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text,
.input-group > .btn {
    border-radius: 0;
}

.input-group > :first-child {
    border-top-left-radius: 10px !important;
    border-bottom-left-radius: 10px !important;
}

.input-group > :last-child {
    border-top-right-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
}

.input-group .border-start-0 {
    border-left: 0 !important;
}

.input-group .border-end-0 {
    border-right: 0 !important;
}

.input-group-text {
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 10px 14px;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--nav-active-text) !important;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    box-shadow: 0 4px 14px 0 var(--primary-glow);
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 var(--primary-glow-hover);
}

/* Card details for QR codes and print */
.member-card-print {
    max-width: 400px;
    border-radius: var(--card-radius);
    overflow: hidden;
    position: relative;
}

.member-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--nav-active-text);
    padding: 20px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* Custom scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Custom Action Pill Outline Buttons */
.btn-outline-warning-custom {
    color: #ca8a04 !important; /* Yellow-600 */
    border: 1.5px solid #eab308 !important; /* Yellow-500 border */
    background-color: transparent !important;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 6px 22px;
    border-radius: 50px !important; /* Make it a pill shape */
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-outline-warning-custom:hover {
    color: #ffffff !important;
    background-color: #ca8a04 !important;
    border-color: #ca8a04 !important;
}

.btn-outline-danger-custom {
    color: #dc2626 !important; /* Red-600 */
    border: 1.5px solid #fca5a5 !important; /* Red-300 border */
    background-color: transparent !important;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 6px 22px;
    border-radius: 50px !important; /* Make it a pill shape */
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-outline-danger-custom:hover {
    color: #ffffff !important;
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* Dark Mode Bootstrap Utility Class Overrides to ensure readability */
[data-bs-theme="dark"] .text-dark:not(.btn):not(.badge),
[data-theme="dark"] .text-dark:not(.btn):not(.badge) {
    color: var(--text-primary) !important;
}

[data-bs-theme="dark"] .bg-light,
[data-theme="dark"] .bg-light {
    background-color: var(--bg-sidebar) !important;
    border: 1px solid var(--border-color) !important;
}

[data-bs-theme="dark"] .bg-white,
[data-theme="dark"] .bg-white {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Ensure form controls inside bg-light/bg-white filter areas inherit correct colors in dark mode */
[data-bs-theme="dark"] .form-control,
[data-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-theme="dark"] .form-select {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

[data-bs-theme="dark"] .input-group-text,
[data-theme="dark"] .input-group-text {
    background-color: var(--bg-sidebar) !important;
    color: var(--text-muted) !important;
    border-color: var(--border-color) !important;
}
