/* =========================
   RESET & BASE
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
}

/* =========================
   LAYOUT
========================= */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b, #0f172a);
    border-right: 1px solid rgba(99, 102, 241, 0.15);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    height: 70px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: 0.2s;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #e2e8f0;
}

.nav-item::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
    transition: height 0.2s ease;
}

.nav-item.active {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.2),
        rgba(139, 92, 246, 0.2)
    );
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-item.active::before {
    height: 60%;
}

/* =========================
   MAIN CONTENT
========================= */
.main-content {
    margin-left: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* =========================
   TOPBAR
========================= */
.topbar {
    height: 70px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 20px;
    cursor: pointer;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #f8fafc;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    font-size: 13px;
    font-weight: 600;
}

.logout-btn {
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fecaca;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* =========================
   PAGE CONTENT
========================= */
.page-content {
    padding: 32px;
}

/* =========================
   MOBILE SIDEBAR
========================= */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    z-index: 40;
}

.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* =========================
   PAGE CONTENT
========================= */
.page-content {
    padding: 32px;
}

/* =========================
   ADMIN PAGINATION
========================= */
.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pg-btn {
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #c7d2fe;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pg-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

.pg-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
    pointer-events: none;
}

.pg-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.pg-dots {
    padding: 0 6px;
    color: #64748b;
    font-weight: 600;
}

/* =========================
   PAGINATION CONTAINER
========================= */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 32px;
}

/* RECORD INFO */
.pagination-info {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.2px;
}

/* MOBILE */
@media (max-width: 640px) {
    .pg-btn {
        min-width: 36px;
        height: 36px;
        font-size: 12px;
    }
}

#toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
}
.toast {
    min-width: 260px;
    padding: 14px 18px;
    margin-bottom: 10px;
    border-radius: 14px;
    font-weight: 600;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.5s forwards;
}
.toast-success {
    background: #16a34a;
    color: #fff;
}
.toast-error {
    background: #ef4444;
    color: #fff;
}
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ================================
   GLOBAL TABLE ALIGNMENT
   ================================ */

table th,
table td {
    text-align: left !important;
    vertical-align: middle;
}

@media (max-width: 768px) {
    table td {
        justify-content: flex-start !important;
        gap: 12px;
    }

    table td::before {
        text-align: left;
    }
}

/* SORTABLE TABLE HEADERS */
th a.sortable {
    color: #c7d2fe;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

th a.sortable:hover {
    color: #eef2ff;
}

.sort-icon {
    font-size: 12px;
    opacity: 0.75;
}

.profile-link {
    text-decoration: none;
    color: inherit;
}

.profile-link:hover {
    opacity: 0.85;
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

