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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --bg-light: #f8fafc;
    --surface: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --ring: rgba(79, 70, 229, 0.2);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --bg-light: #0f172a; 
    --surface: #1e293b; 
    --text-dark: #f8fafc; 
    --text-muted: #94a3b8; 
    --border: #334155; 
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.4s ease, color 0.4s ease;
    min-height: 100vh;
    position: relative;
}
body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 350px;
    background: linear-gradient(135deg, var(--primary), #818cf8, #3b82f6);
    z-index: -1;
    opacity: 0.08;
    pointer-events: none;
}
[data-theme="dark"] body::before {
    opacity: 0.15;
}

a { text-decoration: none; color: inherit; transition: color 0.3s ease; }

/* Navbar - Glassmorphism */
.navbar {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}
[data-theme="dark"] .navbar {
    background: rgba(30, 41, 59, 0.75);
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.nav-brand { 
    font-size: 1.5rem; 
    font-weight: 800; 
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em; 
}
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { 
    color: var(--text-muted); 
    font-weight: 600; 
    font-size: 1rem; 
    transition: all 0.3s ease; 
    position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.theme-toggle {
    background: var(--bg-light); border: 1px solid var(--border);
    font-size: 1.2rem; cursor: pointer;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); transition: all 0.3s ease;
}
.theme-toggle:hover { background-color: var(--border); transform: rotate(15deg); }

/* Containers & Cards */
.container { max-width: 1280px; margin: 0 auto; padding: 3rem 2rem; }
.card {
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.4s ease;
}
.card:hover { box-shadow: var(--shadow-lg); }

/* Typography */
h2 { font-size: 2rem; font-weight: 800; color: var(--text-dark); letter-spacing: -0.03em; margin-bottom: 1rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem; font-weight: 600;
    border: none; border-radius: 10px;
    cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 0.5rem;
    letter-spacing: 0.025em;
}
.btn-primary { 
    background: linear-gradient(135deg, var(--primary), #6366f1); 
    color: white; 
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39); 
}
.btn-primary:hover { 
    background: linear-gradient(135deg, var(--primary-hover), #4f46e5); 
    transform: translateY(-2px); 
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4); 
}
.btn-success { background: linear-gradient(135deg, var(--secondary), #34d399); color: white; box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39); }
.btn-success:hover { background: linear-gradient(135deg, var(--secondary-hover), #10b981); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #f87171); color: white; box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39); }
.btn-danger:hover { background: linear-gradient(135deg, var(--danger-hover), #ef4444); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4); }
.btn-warning { background: linear-gradient(135deg, var(--warning), #fbbf24); color: white; box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.39); }
.btn-warning:hover { background: linear-gradient(135deg, var(--warning-hover), #f59e0b); transform: translateY(-2px); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-dark); font-weight: 700; }
.btn-outline:hover { background: var(--bg-light); border-color: var(--text-muted); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; border-radius: 8px; }
.btn-block { width: 100%; padding: 1rem; font-size: 1.1rem; border-radius: 12px; }

/* Table */
.table-responsive { overflow-x: auto; padding: 1px; border-radius: 20px; }
.dashboard-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.dashboard-table th {
    background: var(--bg-light);
    padding: 1.25rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    text-align: left;
    border-bottom: 2px solid var(--border);
    transition: background-color 0.3s;
}
.dashboard-table td {
    padding: 1.25rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    color: var(--text-dark);
    font-size: 1rem;
    transition: background-color 0.2s;
}
.dashboard-table tr { transition: all 0.3s ease; }
.dashboard-table tr:hover td { background-color: var(--bg-light); }
.dashboard-table tr:last-child td { border-bottom: none; }

/* Photo Thumbnail */
.photo-thumb {
    width: 56px; height: 56px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: var(--shadow);
    border: 2px solid var(--surface);
    transition: transform 0.3s ease;
}
.photo-thumb:hover { transform: scale(1.1); }
.no-photo {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--bg-light), var(--border));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: var(--text-muted); font-weight: 700;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

/* Widgets & Search */
.search-bar { 
    display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; 
    background: var(--surface); padding: 1.5rem; border-radius: 16px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.search-bar input, .search-bar select { flex: 1; min-width: 200px; }
.widget-box {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.widget-item {
    background: var(--surface); padding: 1.5rem; border-radius: 16px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    display: flex; flex-direction: column;
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary);
}
.widget-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.widget-title { font-size: 0.95rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.widget-date { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

.pagination { display: flex; justify-content: center; gap: 1rem; margin-top: 2.5rem; }
.pagination span {
    padding: 0.5rem 1.25rem; background: var(--surface); border-radius: 10px; 
    font-weight: 700; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    display: flex; align-items: center;
}

/* Utilities */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.mb-4 { margin-bottom: 2rem; }
.mt-5 { margin-top: 3rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-4 { padding: 1.5rem; }
.text-center { text-align: center; }
.action-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.badge-branch {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(79, 70, 229, 0.2);
    white-space: nowrap;
}

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; padding: 2.5rem; }
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }
.section-title {
    grid-column: 1 / -1;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 1.5rem; margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.75rem; 
    border-bottom: 2px solid var(--border);
    display: flex; align-items: center; gap: 0.5rem;
}
.form-group { margin-bottom: 1.25rem; }
label { display: block; margin-bottom: 0.5rem; font-size: 0.95rem; font-weight: 600; color: var(--text-dark); }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="file"], select, textarea {
    width: 100%; padding: 0.85rem 1.25rem;
    border: 2px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 1rem; color: var(--text-dark);
    transition: all 0.3s ease; background-color: var(--bg-light);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--ring); background-color: var(--surface);
}
.alert { padding: 1.25rem 1.5rem; border-radius: 12px; margin-bottom: 2rem; font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 1rem; }
.alert.error { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert.success { background-color: rgba(16, 185, 129, 0.1); color: var(--secondary); border: 1px solid rgba(16, 185, 129, 0.2); }

/* Login Page Overrides */
.login-body {
    display: flex; justify-content: center; align-items: center; min-height: 100vh;
    background: linear-gradient(-45deg, #4f46e5, #8b5cf6, #ec4899, #3b82f6);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    position: relative;
    overflow: hidden;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-body::before, .login-body::after {
    content: ''; position: absolute; border-radius: 50%; z-index: 1; filter: blur(60px);
}
.login-body::before { width: 500px; height: 500px; background: rgba(255,255,255,0.15); top: -150px; left: -150px; }
.login-body::after { width: 600px; height: 600px; background: rgba(0,0,0,0.15); bottom: -200px; right: -200px; }

.login-container { width: 100%; max-width: 440px; padding: 20px; position: relative; z-index: 2; }

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 3.5rem 3rem; 
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.4);
    text-align: center;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="dark"] .login-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255,255,255,0.1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(50px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card h2 { color: #1e293b; font-size: 2.5rem; margin-bottom: 0.5rem; font-weight: 800; letter-spacing: -1px; }
[data-theme="dark"] .login-card h2 { color: #f8fafc; }
.login-card p { color: #64748b; margin-bottom: 2.5rem; font-size: 1.1rem; font-weight: 500; }
[data-theme="dark"] .login-card p { color: #94a3b8; }

.login-card .form-group { text-align: left; margin-bottom: 1.5rem; }
.login-card label { color: #334155; font-weight: 700; margin-bottom: 0.5rem; }
[data-theme="dark"] .login-card label { color: #e2e8f0; }

.login-card input, .login-card select {
    background: rgba(255, 255, 255, 0.9); border: 2px solid #e2e8f0;
    padding: 1rem 1.25rem; border-radius: 12px; font-size: 1.05rem;
}
[data-theme="dark"] .login-card input, [data-theme="dark"] .login-card select {
    background: rgba(30, 41, 59, 0.9); border: 2px solid #334155; color: white;
}

.login-card input:focus, .login-card select:focus {
    background: #ffffff; border-color: #6366f1; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}
[data-theme="dark"] .login-card input:focus, [data-theme="dark"] .login-card select:focus {
    background: #0f172a;
}

.login-card .btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border: none; font-size: 1.15rem; padding: 1rem; margin-top: 1.5rem;
    border-radius: 12px; box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.5);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-card .btn-primary:hover {
    transform: translateY(-3px); box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.6);
}

/* Modal */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0;
    width: 100%; height: 100%; overflow: auto; 
    background-color: rgba(0,0,0,0.4); backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center; justify-content: center;
}
.modal.show { display: flex; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background-color: var(--surface); margin: auto; padding: 2.5rem;
    border: 1px solid var(--border); border-radius: 20px;
    width: 90%; max-width: 500px; position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlideUp { from { opacity: 0; transform: translateY(40px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.close-modal {
    position: absolute; top: 1.25rem; right: 1.5rem;
    color: var(--text-muted); font-size: 2rem; font-weight: 300;
    cursor: pointer; transition: color 0.2s; line-height: 1;
}
.close-modal:hover { color: var(--danger); }
