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

:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(20, 26, 42, 0.6);
    --bg-card-hover: rgba(20, 26, 42, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #8B5CF6;
    --primary-glow: rgba(139, 92, 246, 0.15);
    --primary-hover: #A78BFA;
    --secondary: #10B981;
    --secondary-glow: rgba(16, 185, 129, 0.15);
    --accent-red: #EF4444;
    --accent-yellow: #F59E0B;
    --accent-blue: #3B82F6;
    --accent-gray: #6B7280;
    --text-main: #F3F4F6;
    --text-muted: #9CA3AF;
    --text-inverse: #111827;
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --bg-sidebar: rgba(15, 22, 42, 0.95);
    --text-sidebar-main: #F3F4F6;
    --text-sidebar-muted: #9CA3AF;
    --border-sidebar: rgba(255, 255, 255, 0.08);
    --logo-gradient-start: #FFF;
    --logo-gradient-end: #C084FC;
}

body.light-theme {
    --bg-main: #F3F4F6;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-main: #1F2937;
    --text-muted: #4B5563;
    --primary: #6D28D9;
    --primary-glow: rgba(109, 40, 217, 0.1);
    --shadow-main: 0 8px 32px 0 rgba(31, 41, 55, 0.08);

    --bg-sidebar: rgba(255, 255, 255, 0.95);
    --text-sidebar-main: #1F2937;
    --text-sidebar-muted: #4B5563;
    --border-sidebar: rgba(0, 0, 0, 0.08);
    --logo-gradient-start: #1F2937;
    --logo-gradient-end: #6D28D9;
}

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

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

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
    font-weight: 600;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

#app-shell {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

aside#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-sidebar);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 50;
    backdrop-filter: blur(20px);
    transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-sidebar);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-family: var(--font-heading);
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--logo-gradient-start), var(--logo-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: var(--font-heading);
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-sidebar-muted);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.menu-item a:hover {
    color: var(--text-sidebar-main);
    background: rgba(139, 92, 246, 0.06);
}

.menu-item.active a {
    color: #FFF;
    background: var(--primary);
    box-shadow: var(--primary-glow);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-glow);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-family: var(--font-heading);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-sidebar-main);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-sidebar-muted);
}

.sidebar-footer a {
    color: var(--text-sidebar-muted);
}

main#content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

header#header {
    height: var(--header-height);
    background: rgba(15, 22, 42, 0.03);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    backdrop-filter: blur(10px);
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-main);
    transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.glass-panel:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.dashboard-grid {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kpi-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.kpi-trend {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.up {
    color: var(--secondary);
}

.kpi-trend.down {
    color: var(--accent-red);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

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

.btn-danger:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

select.form-control option {
    background-color: #0F162A;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table-custom th {
    background: rgba(15, 22, 42, 0.6);
    color: var(--text-muted);
    font-weight: 600;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-custom td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-weight: 400;
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.table-custom tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.badge-suspended {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-yellow);
}

.badge-terminated {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.badge-archived {
    background: rgba(107, 114, 128, 0.1);
    color: var(--accent-gray);
}

.badge-paid {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}

.badge-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-yellow);
}

.badge-hold {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.15), transparent 40%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.08), transparent 45%),
        #080C14;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.alert-banner {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-banner.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-banner.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

@media (max-width: 768px) {
    #mobile-menu-toggle {
        display: inline-flex !important;
    }

    #sidebar-close {
        display: inline-flex !important;
    }

    aside#sidebar {
        position: fixed !important;
        top: 0;
        bottom: 0;
        left: 0;
        height: 100vh !important;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    }

    aside#sidebar.show-sidebar {
        transform: translateX(0);
    }

    main#content-area {
        width: 100%;
        min-width: 0;
    }

    header#header {
        padding: 0 16px;
    }

    .dashboard-grid {
        padding: 16px;
        gap: 16px;
    }

    .kpi-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media print {
    body {
        background: white;
        color: black;
    }

    aside#sidebar,
    header#header,
    .btn,
    .no-print {
        display: none !important;
    }

    main#content-area {
        overflow: visible;
        height: auto;
    }

    .glass-panel {
        border: none !important;
        box-shadow: none !important;
        background: none !important;
        padding: 0 !important;
        backdrop-filter: none !important;
    }

    .table-custom th {
        background: #f3f4f6 !important;
        color: black !important;
        border-bottom: 2px solid #ddd !important;
    }

    .table-custom td {
        border-bottom: 1px solid #ddd !important;
    }
}