@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --navy: #1F3B78;
    --navy-dark: #152a5a;
    --navy-light: #2a4d99;
    --accent: #4f8cff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 4px 0 24px rgba(31, 59, 120, 0.15);
}

#sidebar.collapsed {
    left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--navy);
}

.sidebar-header h5 {
    color: white;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    color: white;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: var(--accent);
}

.sidebar-menu li a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-section {
    padding: 20px 24px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ===== MAIN CONTENT ===== */
#content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

#content.expanded {
    margin-left: 0;
    width: 100%;
}

/* ===== HEADER ===== */
.top-header {
    height: var(--header-height);
    background: white;
    border-bottom: 2px solid rgba(31, 59, 120, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h4 {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--navy), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#sidebarToggle {
    display: none;
    background: var(--navy);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    text-align: right;
}

.header-user .name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.header-user .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

/* ===== PAGE AREA ===== */
.page-content {
    padding: 28px;
    flex: 1;
}

/* ===== CARDS ===== */
.modern-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    transition: var(--transition);
}

.modern-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ===== STAT CARDS ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 24px;
    border-radius: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: rgba(31, 59, 120, 0.1);
    color: var(--navy);
}

.stat-icon.green {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-info .stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.stat-info .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 14px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.06);
    text-align: left;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(31, 59, 120, 0.02);
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-primary {
    background: rgba(31, 59, 120, 0.12);
    color: var(--navy);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
}

.badge-info {
    background: rgba(79, 140, 255, 0.12);
    color: var(--accent);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--navy);
    color: white;
}

.btn-primary:hover {
    background: var(--navy-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(31, 59, 120, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    color: var(--text);
}

.btn-outline:hover {
    background: rgba(0, 0, 0, 0.04);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
    border-radius: 8px;
}

.btn-icon {
    padding: 6px 10px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    font-size: 0.88rem;
    font-family: inherit;
    transition: var(--transition);
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(31, 59, 120, 0.1);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert .close-alert {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.6;
    background: none;
    border: none;
    font-size: 1.2rem;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* ===== LIST ITEMS ===== */
.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: var(--transition);
    cursor: pointer;
}

.list-item:hover {
    background: rgba(31, 59, 120, 0.02);
    margin: 0 -16px;
    padding: 14px 16px;
    border-radius: 10px;
}

.list-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.list-icon.blue {
    background: rgba(31, 59, 120, 0.08);
    color: var(--navy);
}

.list-icon.green {
    background: rgba(34, 197, 94, 0.08);
    color: var(--success);
}

.list-content {
    flex: 1;
    min-width: 0;
}

.list-content .title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-content .meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== WELCOME ===== */
.welcome-banner {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 50%, var(--accent) 100%);
    border-radius: 20px;
    padding: 40px;
    color: white;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
}

.welcome-banner h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.welcome-banner p {
    opacity: 0.85;
    font-size: 0.95rem;
}

.welcome-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.welcome-actions .btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-actions .btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--navy), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    flex-wrap: wrap;
}

.filter-bar .form-control {
    flex: 1;
    min-width: 150px;
}

/* ===== LOGIN ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.login-card .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo h2 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--navy);
    margin-top: 12px;
}

.login-card .logo p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.login-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.95rem;
    margin-top: 8px;
}

/* ===== DETAIL VIEW ===== */
.detail-card {
    padding: 32px;
}

.detail-header {
    border-bottom: 2px solid rgba(0, 0, 0, 0.04);
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 12px;
}

.detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.detail-meta-item i {
    color: var(--navy);
}

.detail-body {
    font-size: 1rem;
    line-height: 1.9;
    color: #334155;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

/* ===== FOOTER ===== */
.footer {
    padding: 20px 28px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== ANIMATIONS ===== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.page-view {
    animation: fadeIn 0.3s ease;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    #sidebar {
        left: calc(-1 * var(--sidebar-width));
    }

    #sidebar.mobile-open {
        left: 0;
    }

    #content {
        margin-left: 0;
        width: 100%;
    }

    #sidebarToggle {
        display: block;
    }

    .page-content {
        padding: 16px;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info .stat-number {
        font-size: 1.3rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .welcome-banner {
        padding: 24px;
    }

    .welcome-banner h1 {
        font-size: 1.2rem;
    }

    .data-table {
        font-size: 0.8rem;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 8px;
    }

    .filter-bar {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-box {
        padding: 24px;
        width: 95%;
    }

    .top-header {
        padding: 0 16px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .detail-card {
        padding: 20px;
    }

    .detail-meta {
        gap: 12px;
    }

    .welcome-actions {
        flex-direction: column;
    }

    .btn {
        padding: 10px 16px;
        width: 100%;
        justify-content: center;
    }

    .btn-sm {
        width: auto;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .header-user {
        display: none;
    }
}

/* ===== MOBILE OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}