/* Explain: Styles for the admin dashboard, including layout, tables, badges, and modals. */
/* Super Admin dashboard */
.adm-app {
    display: flex;
    min-height: 100vh;
    background: var(--surface-color);
}

/* Sidebar */
.adm-side {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    z-index: 60;
    width: 16.5rem;
    display: flex;
    flex-direction: column;
    background: var(--dark-color);
    color: #fff;
    transform: translateX(100%);
    transition: transform 0.28s ease;
}
html[dir="ltr"] .adm-side { transform: translateX(-100%); }
.adm-side.open { transform: translateX(0); }
@media (min-width: 1024px) { .adm-side { transform: none !important; } }
.adm-side-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.03rem;
}
.adm-side-logo {
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    flex-shrink: 0;
    border-radius: 0.7rem;
    background: var(--primary-color);
}
.adm-side-close {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    margin-inline-start: auto;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}
.adm-side-close:hover {
    background: rgba(255, 255, 255, 0.26);
}
@media (max-width: 1023px) {
    .adm-side { width: min(16.5rem, 82vw); }
}
@media (min-width: 1024px) {
    .adm-side-close { display: none; }
}
.adm-side-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.adm-side-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.7rem;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}
.adm-side-link i { width: 1.15rem; text-align: center; flex-shrink: 0; }
.adm-side-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.adm-side-link.active { background: var(--primary-color); color: #fff; }
.adm-side-foot {
    padding: 0.9rem 0.7rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.adm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(13, 27, 36, 0.5);
    display: none;
}
.adm-backdrop.show { display: block; }
@media (min-width: 1024px) { .adm-backdrop.show { display: none; } }

/* Main */
.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 1024px) { .adm-main { margin-inline-start: 16.5rem; } }
.adm-topstick {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--background-color);
}
.adm-top {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}
.adm-top-title {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-color);
    font-size: 1.02rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.adm-top-spacer { flex: 0 0 auto; }
.adm-icon-btn {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--border-color);
    border-radius: 0.7rem;
    background: #fff;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.adm-icon-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.adm-user {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 0.7rem;
    background: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-color);
}
.adm-user i { color: var(--primary-color); }
@media (max-width: 767px) { .adm-user { display: none; } }

/* Mobile section tabs */
.adm-tabbar {
    display: none;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}
@media (max-width: 1023px) {
    .adm-tabbar { display: block; }
}
.adm-tabbar-scroll {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.5rem 0.75rem;
}
.adm-tabbar-scroll::-webkit-scrollbar { display: none; }
.adm-tabbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.42rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.adm-tabbar-btn i { font-size: 0.8rem; color: var(--text-muted); transition: color 0.2s ease; }
.adm-tabbar-btn:hover { border-color: var(--primary-color); color: var(--primary-hover); }
.adm-tabbar-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}
.adm-tabbar-btn.active i { color: #fff; }
.adm-wrap { padding: 1.25rem; max-width: 84rem; width: 100%; }
@media (min-width: 1024px) { .adm-wrap { padding: 1.75rem; } }

/* Page head */
.adm-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.adm-h1 { font-family: var(--font-heading); font-weight: 800; font-size: 1.5rem; color: var(--text-color); }
.adm-sub { margin-top: 0.25rem; font-size: 0.92rem; color: var(--text-muted); }

/* Stats */
.adm-stats { display: grid; gap: 0.9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .adm-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .adm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 479px) {
    .adm-stats { gap: 0.6rem; }
    .adm-stat { padding: 0.8rem; gap: 0.35rem; }
    .adm-stat-ico { width: 2rem; height: 2rem; font-size: 0.85rem; border-radius: 0.6rem; }
    .adm-stat-label { font-size: 0.72rem; line-height: 1.5; }
    .adm-stat-value { font-size: 1.12rem; }
}
.adm-stat {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.25s ease;
}
.adm-stat:hover { border-color: var(--primary-color); box-shadow: 0 16px 34px -28px rgba(13, 27, 36, 0.5); }
.adm-stat-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.adm-stat-ico {
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 0.7rem;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 1rem;
}
.adm-stat-label { font-size: 0.8rem; color: var(--text-muted); }
.adm-stat-value { font-family: var(--font-heading); font-weight: 800; font-size: 1.4rem; color: var(--text-color); line-height: 1.2; overflow-wrap: anywhere; }

/* Boxes */
.adm-panel-box { background: #fff; border: 1px solid var(--border-color); border-radius: 1rem; overflow: hidden; }
.adm-box-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--border-color); }
.adm-box-title { font-family: var(--font-heading); font-weight: 800; color: var(--text-color); font-size: 1.02rem; }
.adm-box-body { padding: 1.15rem; }
.adm-grid-2 { display: grid; gap: 1.15rem; }
@media (min-width: 1024px) { .adm-grid-2 { grid-template-columns: 1fr 1fr; } }

/* Table */
.adm-table-scroll { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.adm-table th, .adm-table td {
    padding: 0.7rem 0.85rem;
    text-align: start;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.adm-table th {
    background: var(--surface-color);
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-color);
    font-size: 0.8rem;
}
.adm-table tbody tr:hover { background: var(--surface-color); }
.adm-ltr { direction: ltr; display: inline-block; }

/* Badges */
.adm-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.74rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.adm-st-new { background: #e0f2fe; color: #075985; }
.adm-st-active { background: var(--primary-soft); color: var(--primary-hover); }
.adm-st-review { background: #fef3c7; color: #92400e; }
.adm-st-sus { background: #fee2e2; color: #b91c1c; }
.adm-st-trial { background: #ede9fe; color: #5b21b6; }
.adm-neutral { background: var(--surface-color); color: var(--text-muted); border: 1px solid var(--border-color); }

/* Action mini buttons */
.adm-actions { display: inline-flex; gap: 0.3rem; }
.adm-mini {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 0.55rem;
    background: #fff;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
}
.adm-mini:hover { border-color: var(--primary-color); color: var(--primary-color); }
.adm-danger:hover { border-color: #dc2626; color: #dc2626; }

/* Toolbar */
.adm-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 1rem; }
.adm-toolbar .mk-input, .adm-toolbar select { width: auto; min-width: 9rem; padding: 0.55rem 0.8rem; }

/* Forms */
.adm-field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.9rem; }
.adm-field label { font-weight: 700; font-size: 0.85rem; color: var(--text-color); }
.adm-row-2 { display: grid; gap: 0.9rem; }
@media (min-width: 640px) { .adm-row-2 { grid-template-columns: 1fr 1fr; } }
.adm-checks { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.adm-checks label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.88rem; }

/* Chart */
.adm-chart { position: relative; height: 16rem; width: 100%; }

/* Notifications */
.adm-notif { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border-color); }
.adm-notif:last-child { border-bottom: none; }
.adm-notif-ico { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; flex-shrink: 0; border-radius: 0.6rem; background: var(--primary-soft); color: var(--primary-color); }
.adm-notif-title { font-weight: 700; color: var(--text-color); font-size: 0.9rem; }
.adm-notif-msg { font-size: 0.82rem; color: var(--text-muted); }

/* Modal */
.adm-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(13, 27, 36, 0.55);
}
.adm-modal.show { display: flex; }
.adm-modal-card {
    background: #fff;
    border-radius: 1.1rem;
    width: min(36rem, 100%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 30px 60px -25px rgba(13, 27, 36, 0.6);
}
.adm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--border-color); font-family: var(--font-heading); font-weight: 800; }
.adm-modal-body { padding: 1.15rem; }
.adm-modal-foot { display: flex; gap: 0.6rem; justify-content: flex-end; padding: 0.9rem 1.15rem; border-top: 1px solid var(--border-color); }

/* Toast */
.adm-toast {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(1rem);
    z-index: 95;
    background: var(--dark-color);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    line-height: 1.6;
    padding: 0.7rem 1.15rem;
    border-radius: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    width: max-content;
    max-width: calc(100vw - 1.5rem);
    text-align: center;
    overflow-wrap: anywhere;
    box-shadow: 0 18px 40px -18px rgba(13, 27, 36, 0.6);
}
.adm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.adm-toast.ok { background: var(--primary-color); }
.adm-toast.err { background: #dc2626; }

.adm-empty { text-align: center; padding: 2.25rem 1rem; color: var(--text-muted); }
.adm-empty i { font-size: 1.9rem; color: var(--border-color); }
.adm-empty .adm-empty-title { margin-top: 0.75rem; font-family: var(--font-heading); font-weight: 800; font-size: 1.02rem; color: var(--text-color); }
.adm-empty .adm-empty-text { margin: 0.35rem auto 0; max-width: 30rem; font-size: 0.88rem; line-height: 1.8; color: var(--text-muted); }
.adm-loading { text-align: center; padding: 1.5rem; color: var(--text-muted); }

/* Tables: sticky header row on large screens */
@media (min-width: 640px) {
    .adm-table-scroll {
        max-height: 70vh;
        overflow-y: auto;
    }
    .adm-table thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        box-shadow: 0 1px 0 var(--border-color);
    }
}

/* Tables: each row becomes a readable card on mobile */
@media (max-width: 639px) {
    .adm-table-scroll { overflow-x: visible; max-height: none; }
    .adm-table-stack, .adm-table-stack tbody, .adm-table-stack tr, .adm-table-stack td { display: block; width: 100%; }
    .adm-table-stack thead { display: none; }
    .adm-table-stack tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
    }
    .adm-table-stack tbody tr {
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 1rem;
        padding: 0.8rem 0.9rem;
        box-shadow: 0 14px 30px -28px rgba(13, 27, 36, 0.55);
    }
    .adm-table-stack tbody tr:hover { background: #fff; }
    .adm-table-stack tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem 1rem;
        padding: 0.4rem 0;
        border-bottom: 0;
        text-align: start;
        white-space: normal;
    }
    .adm-table-stack tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-family: var(--font-heading);
        font-weight: 800;
        font-size: 0.8rem;
        color: var(--text-muted);
    }
    .adm-table-stack tbody td:first-child {
        padding-bottom: 0.6rem;
        margin-bottom: 0.3rem;
        border-bottom: 1px dashed var(--border-color);
        font-family: var(--font-heading);
        font-weight: 800;
        font-size: 1rem;
        line-height: 1.5;
        color: var(--text-color);
    }
    .adm-table-stack tbody td .adm-badge {
        font-size: 0.78rem;
        padding: 0.28rem 0.7rem;
    }
    .adm-table-stack tbody td:not([data-label]) {
        display: block;
        margin-top: 0.7rem;
        padding: 0.7rem 0 0;
        border-top: 1px dashed var(--border-color);
    }
    .adm-table-stack tbody td:not([data-label])::before { content: none; }
    .adm-table-stack tbody td:not([data-label]) .adm-actions { display: flex; gap: 0.4rem; }
    .adm-table-stack tbody td:not([data-label]) .adm-mini { width: 2.4rem; height: 2.4rem; }
    .adm-table-stack tbody tr.adm-empty-row {
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
    }
    .adm-table-stack tbody tr.adm-empty-row td,
    .adm-table-stack tbody tr.adm-empty-row td:first-child {
        border: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .adm-empty-row td { display: block !important; }
    .adm-empty-row td::before { content: none !important; }
}

/* Tabs */
.adm-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.adm-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.5rem 0.95rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.adm-tab:hover { border-color: var(--primary-color); color: var(--primary-hover); }
.adm-tab.active { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }

/* Login */
.adm-login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; background: var(--surface-color); }
.adm-login-card { width: min(26rem, 100%); background: #fff; border: 1px solid var(--border-color); border-radius: 1.5rem; padding: 2rem 1.6rem; }
.adm-login-badge { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin: 0 auto; border-radius: 1rem; background: var(--primary-soft); color: var(--primary-color); font-size: 1.5rem; }

/* Plans grid */
.adm-plans { display: grid; gap: 0.9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1024px) { .adm-plans { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.adm-plan-card { background: #fff; border: 1px solid var(--border-color); border-radius: 1rem; padding: 1rem; }
.adm-plan-name { font-family: var(--font-heading); font-weight: 800; font-size: 1.05rem; color: var(--text-color); }
.adm-plan-price { margin-top: 0.3rem; font-family: var(--font-heading); font-weight: 800; font-size: 1.3rem; color: var(--primary-hover); }
.adm-plan-feat { margin-top: 0.5rem; font-size: 0.82rem; color: var(--text-muted); white-space: pre-line; }
.adm-plan-foot { display: flex; gap: 0.4rem; margin-top: 0.8rem; }

/* Action modals: confirm message, danger action, detail rows */
.adm-modal-foot { flex-wrap: wrap; }
.adm-modal-body .adm-field:last-child { margin-bottom: 0; }
.adm-confirm-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.9;
    color: var(--text-color);
    overflow-wrap: anywhere;
}
.adm-btn-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
.adm-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
.adm-detail {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.adm-detail li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.9rem;
}
.adm-detail li:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}
.adm-detail li span {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text-muted);
}
.adm-detail li b {
    font-weight: 800;
    color: var(--text-color);
    text-align: end;
    overflow-wrap: anywhere;
}
.adm-form-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    margin-bottom: 0.9rem;
}
.adm-form-checks label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-color);
    cursor: pointer;
}
.adm-report-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}
.adm-report-head .adm-box-title {
    flex: 1 1 12rem;
    margin: 0;
}