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

:root {
    --bg-color: #f1f5f9;
    --sidebar-bg: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.72);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: rgba(13, 148, 136, 0.12);
    --primary-glow: rgba(13, 148, 136, 0.25);
    --secondary: #e2e8f0;
    --secondary-hover: #cbd5e1;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.12);
    --border: rgba(148, 163, 184, 0.2);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);
    --shadow-lg: 0 12px 24px -6px rgb(0 0 0 / 0.08), 0 4px 8px -4px rgb(0 0 0 / 0.04);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-blur: blur(16px);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

[data-theme="dark"] {
    --bg-color: #0b1120;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #14b8a6;
    --primary-hover: #0d9488;
    --primary-light: rgba(20, 184, 166, 0.15);
    --primary-glow: rgba(20, 184, 166, 0.2);
    --secondary: #1e293b;
    --secondary-hover: #334155;
    --border: rgba(51, 65, 85, 0.6);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 12px 24px -6px rgb(0 0 0 / 0.5);
    --glass-border: rgba(255, 255, 255, 0.06);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding-top: 60px;
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; opacity: 0.5; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.glass {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
}

.page-wrapper {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
    width: 100%;
}

/* Topbar */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: 60px;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 2px 16px rgba(13, 148, 136, 0.25);
}

[data-theme="dark"] .topbar {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
}

.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-title {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.topbar-agence {
    font-weight: 400;
    font-size: 0.9rem;
    opacity: 0.85;
    margin-left: 8px;
}

.theme-toggle {
    background: rgba(255,255,255,0.18);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(15deg);
}

.avatar-circle {
    width: 34px; height: 34px;
    background: white;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.logout-btn {
    background: rgba(239,68,68,0.85);
    color: white;
    border: none;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.logout-btn:hover {
    background: var(--danger);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    border-right: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 10;
}

.sidebar-header {
    padding: 20px 20px 16px;
    font-size: 1.3rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    padding-left: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    margin-bottom: 4px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    gap: 12px;
    position: relative;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #f1f5f9;
}

.nav-item:hover i {
    transform: translateX(2px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: white;
    border-radius: 0 4px 4px 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 24px;
}

.content-area {}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 2px 2px 0;
}

.stat-card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.stat-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 4px;
}

/* Typography */
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 16px; color: var(--text-main); letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 12px; color: var(--text-main); }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; color: var(--text-main); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 8px;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

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

.btn-secondary {
    background: var(--secondary);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-color);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: var(--secondary);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: var(--sidebar-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--secondary);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--secondary); }
tbody tr:nth-child(even) td { background: rgba(0,0,0,0.015); }
[data-theme="dark"] tbody tr:nth-child(even) td { background: rgba(255,255,255,0.015); }

/* Badges */
.badge {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2000;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--sidebar-bg);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(24px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--border);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-backdrop.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--danger);
    background: var(--danger-light);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Login Page */
body:has(.login-container) { padding-top: 0; }

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(13,148,136,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 50%, rgba(16,185,129,0.05) 0%, transparent 50%);
    animation: loginBg 20s ease-in-out infinite alternate;
}

@keyframes loginBg {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-2%, -1%) rotate(3deg); }
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    position: relative;
    border-radius: var(--radius-xl);
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 24px 48px -12px rgba(0,0,0,0.15);
}

.login-icon-wrap {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 26px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px var(--primary-glow);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(239,68,68,0.2);
}

.login-card .form-label {
    color: var(--text-muted);
}

.login-card .form-control {
    background: #f1f5f9;
    border-color: var(--border);
    color: var(--text-main);
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-card .form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.login-card .form-control::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

.login-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px var(--primary-glow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--primary-glow);
}

/* Header actions row */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
