/* =========================
   CSS VARIABLES
========================= */
:root {
    --bg: #f8f9fb;
    --sidebar: #111827;
    --text: #111827;
    --muted: #6b7280;
    --accent: #2563eb;
}

/* =========================
   BASE
========================= */
html {
    overflow-x: hidden;
}

body {
    background: var(--bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    margin: 0;
}

/* =========================
   LAYOUT
========================= */
.app {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* ⬅️ FLEX BUG FIX */
}

.content {
    flex: 1;
    padding: 1.25rem;
}

/* =========================
   PAGE TITLE
========================= */
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    width: 240px;
    background: var(--sidebar);
    color: #fff;
    padding: 1rem;
    flex-shrink: 0;
}

.sidebar-header {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.menu-item {
    color: #d1d5db;
    text-decoration: none;
    padding: .6rem .75rem;
    border-radius: .5rem;
    font-size: .95rem;
}

.menu-item:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.menu-item.active {
    background: rgba(255,255,255,.15);
    color: #fff;
}

/* =========================
   TOPBAR
========================= */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: .75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* =========================
   DROPDOWN (GLOBAL)
========================= */
.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: .15rem;
    background: transparent;
    border: none;
    padding: .35rem .5rem;
    border-radius: .5rem;
    font-size: .9rem;
    font-weight: 500;
    color: #374151;
}

.dropdown-trigger:hover {
    background: #f3f4f6;
}

.chevron {
    font-size: .6rem;
    color: #6b7280;
    margin-left: .15rem;
}

.app-dropdown {
    min-width: 190px;
    border-radius: .75rem;
    padding: .4rem 0;
    border: 1px solid #e5e7eb;
    background: #fff;
    box-shadow: 0 12px 30px rgba(0,0,0,.08);
}

.app-dropdown .dropdown-header {
    padding: .5rem 1rem;
    line-height: 1.2;
}

.app-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    padding: .45rem 1rem;
}

.app-dropdown .dropdown-item i {
    width: 16px;
    text-align: center;
    color: #6b7280;
}

.app-dropdown .dropdown-item.text-danger i {
    color: #dc3545;
}

.dropdown-menu {
    z-index: 1080;
}

/* =========================
   AVATAR
========================= */
.avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

/* =========================
   CARD
========================= */
.card {
    border: none;
    border-radius: .75rem;
    background: #fff;
    box-shadow:
        0 1px 2px rgba(16,24,40,.04),
        0 8px 24px rgba(16,24,40,.06);
}

/* =========================
   TABLE
========================= */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.card .table {
    font-size: .875rem;
    margin-bottom: 0;
}

.card .table-responsive {
    border-radius: .6rem;
    overflow-x: auto;
    overflow-y: visible;
}

.card .table-responsive .dropdown {
    position: static;
}

.card .table-responsive .dropdown-menu {
    position: absolute;
}

.table thead {
    background: #f9fafb;
}

.table thead th {
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
}

.table tbody tr {
    border-bottom: 1px solid #eef0f3;
}

.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

.table-actions {
    display: flex;
    gap: .4rem;
    justify-content: flex-start;
}

/* =========================
   ICON ACTION BUTTON
========================= */
.icon-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    border: none;
    border-radius: 50%;
    color: #4b5563;
    font-size: .75rem;
    cursor: pointer;
    transition: all .15s ease;
}

.icon-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.icon-btn:active {
    transform: scale(.92);
}

.icon-btn.eye {
    color: #374151;
}

.icon-btn.rotate {
    color: #059669;
}

/* =========================
   FOOTER
========================= */
.footer {
    padding: .75rem 0;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    margin-top: auto;
    text-align: center;
    font-size: .85rem;
    color: var(--muted);
}

/* =========================
   MOBILE (ADMIN LTE STYLE)
========================= */
@media (max-width: 768px) {

    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        height: 100vh;
        z-index: 1050;
        transition: left .25s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .app {
        overflow-x: hidden;
    }

    .main {
        min-width: 100%;
        overflow-x: hidden;
    }

    body.sidebar-open {
        overflow: hidden;
        height: 100vh;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }
}

/* =========================
   SMALL MOBILE ACTION FIX
========================= */
@media (max-width: 576px) {
    .table-actions {
        display: flex;
        flex-direction: column;
        gap: .35rem;
    }

    .table-actions .btn {
        width: 100%;
        font-size: .75rem;
        padding: .35rem .5rem;
    }
}
