/* ===================================================================
   Admin Panel CSS: MTsN 4 Aceh Barat CMS
   =================================================================== */

/* Tampilan default standar tanpa CSS zoom (menjaga kalkulasi 100vh & responsif akurat) */
html.admin-html {
    height: 100%;
    background-color: #f1f5f9;
    -webkit-text-size-adjust: 100%;
}

html.login-html {
    zoom: 1 !important;
    height: 100%;
    background-color: #ffffff;
}

:root {
    --admin-sidebar-width: 260px;
    --admin-primary: #0b663b;
    --admin-primary-dark: #074628;
    --admin-accent: #e5a93b;
    --admin-bg: #f1f5f9;
    --admin-card-bg: #ffffff;
    --admin-border: #e2e8f0;
}

/* TYPOGRAPHY HELPERS */
.font-10 { font-size: 0.65rem !important; }
.font-11 { font-size: 0.72rem !important; }
.font-12 { font-size: 0.78rem !important; }
.font-13 { font-size: 0.84rem !important; }
.font-14 { font-size: 0.90rem !important; }
.font-15 { font-size: 0.95rem !important; }
.font-16 { font-size: 1.00rem !important; }
.tracking-wider { letter-spacing: 0.05em; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body.admin-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--admin-bg);
    color: #1e293b;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    font-size: 0.88rem;
}

.admin-wrapper {
    display: flex;
    flex: 1 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    position: relative;
}

/* SIDEBAR */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    flex-shrink: 0;
    background: #0d1a14 !important;
    border-right: 1px solid rgba(255,255,255,0.08);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

@media (min-width: 992px) {
    .admin-sidebar.collapsed {
        margin-left: calc(-1 * var(--admin-sidebar-width));
    }
}

.admin-sidebar::-webkit-scrollbar {
    width: 5px;
}
.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.admin-sidebar .sidebar-brand {
    flex-shrink: 0;
}

.admin-sidebar .sidebar-menu {
    flex: 1 1 auto;
}

.admin-sidebar .nav-link {
    font-weight: 500;
    font-size: 0.84rem;
    transition: all 0.2s ease;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .hover-bg-dark:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}
.admin-sidebar .nav-link.active {
    background-color: var(--admin-primary) !important;
    box-shadow: 0 4px 10px rgba(11, 102, 59, 0.3);
    color: #ffffff !important;
}

/* MAIN WRAPPER */
.admin-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--admin-bg);
    min-height: 100vh;
    min-height: 100dvh;
}

.admin-topbar {
    height: 60px;
    border-bottom: 1px solid var(--admin-border);
    z-index: 1020;
    flex-shrink: 0;
}

.admin-content {
    flex: 1 0 auto;
    width: 100%;
}

.admin-footer {
    margin-top: auto;
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid var(--admin-border);
}

/* METRIC STAT / INFO CARDS */
.metric-card {
    background: var(--admin-card-bg);
    border-radius: 14px;
    padding: 20px 22px;
    border: 1px solid var(--admin-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}
.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.metric-card-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 14px;
}
.metric-card-info {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.metric-card-title {
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 4px;
    line-height: 1.2;
}
.metric-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 4px;
    color: #1e293b;
}
.metric-card-sub {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.2;
}
.metric-icon-box {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

/* DATA CARD */
.data-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    border: 1px solid var(--admin-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
    width: 100%;
}
.data-card .card-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--admin-border);
    padding: 16px 20px;
    font-weight: 600;
}

/* TABLE STYLING */
.table-responsive {
    width: 100% !important;
}

table.dataTable,
.dataTables_wrapper,
.dataTables_wrapper table,
.dataTables_wrapper .table,
.table-responsive > table,
.data-card table {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* HORIZONTAL SCROLL TABLE */
.table-responsive-scroll {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    position: relative;
    padding-bottom: 8px;
    margin-bottom: 0;
}

/* Custom Visible Horizontal Scrollbar */
.table-responsive-scroll::-webkit-scrollbar {
    height: 8px;
}
.table-responsive-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.table-responsive-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}
.table-responsive-scroll::-webkit-scrollbar-thumb:hover {
    background: #0b663b;
}

/* Minimum width for horizontal scrollable table */
.table-scroll-x,
.table-scroll-x table,
.table-scroll-x .dataTable,
.table-scroll-x .dataTables_wrapper table {
    min-width: 980px !important;
}

/* Action buttons column */
.col-actions {
    min-width: 140px !important;
    width: 140px !important;
    white-space: nowrap !important;
    text-align: center;
}

/* Sticky Action Column so Edit & Delete are always visible */
.table-sticky-actions th.col-actions,
.table-sticky-actions td.col-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #ffffff;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.05);
}
.table-sticky-actions thead th.col-actions {
    background: #f8fafc;
    z-index: 3;
}
.table-sticky-actions tbody tr:hover td.col-actions {
    background: #f8fafc;
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    font-weight: 600;
    border-bottom-width: 1px;
}
.table td {
    vertical-align: middle;
    font-size: 0.88rem;
}

/* Badges for Guru & Tendik */
.bg-emerald-subtle {
    background-color: #dcfce7 !important;
}
.text-emerald {
    color: #047857 !important;
}
.badge-guru {
    background-color: #dcfce7 !important;
    color: #047857 !important;
    border: 1px solid #86efac !important;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-tendik {
    background-color: #dbeafe !important;
    color: #1d4ed8 !important;
    border: 1px solid #93c5fd !important;
    font-size: 0.72rem;
    font-weight: 600;
}

/* QUILL EDITOR CONTAINER */
.quill-editor-box {
    min-height: 280px;
    background: #ffffff;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}
.quill-editor-box .ql-editor {
    min-height: 280px;
    font-size: 14.5px;
    line-height: 1.7;
}
.quill-editor-box .ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.quill-editor-box .ql-editor .article-img-caption {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    margin-top: 2px;
}

/* Helpers */
.btn-xs {
    padding: 0.2rem 0.55rem;
    font-size: 0.74rem;
    line-height: 1.35;
}
.gallery-item-row {
    transition: all 0.25s ease;
}
.gallery-item-row:hover {
    background-color: #f1f5f9 !important;
}

/* LOGIN SCREEN: TEMA SEKOLAH & FIT LAYAR (100VH) */
.login-body {
    background-color: #ffffff;
    background-image:
        radial-gradient(circle at 10% 15%, rgba(11, 102, 59, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 90% 85%, rgba(229, 169, 59, 0.06) 0%, transparent 45%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%230b663b' stroke-width='0.6' stroke-opacity='0.045'%3E%3Cpath d='M40 0 L40 80 M0 40 L80 40'/%3E%3Cpath d='M20 0 L40 20 L60 0 M20 80 L40 60 L60 80'/%3E%3Cpath d='M0 20 L20 40 L0 60 M80 20 L60 40 L80 60'/%3E%3Crect x='30' y='30' width='20' height='20' transform='rotate(45 40 40)'/%3E%3Ccircle cx='40' cy='40' r='12'/%3E%3C/g%3E%3Cg fill='%23e5a93b' fill-opacity='0.04'%3E%3Ccircle cx='0' cy='0' r='3'/%3E%3Ccircle cx='80' cy='0' r='3'/%3E%3Ccircle cx='0' cy='80' r='3'/%3E%3Ccircle cx='80' cy='80' r='3'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat, repeat;
    background-size: auto, auto, 80px 80px;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}
.login-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid rgba(11, 102, 59, 0.12);
    box-shadow: 
        0 10px 30px -10px rgba(11, 102, 59, 0.12),
        0 20px 40px -15px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

/* MOBILE & TABLET RESPONSIVE */
.admin-sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: calc(-1 * var(--admin-sidebar-width));
        height: 100%;
        height: 100dvh;
        z-index: 1050;
    }
    .admin-sidebar.active {
        left: 0;
        box-shadow: 6px 0 25px rgba(0, 0, 0, 0.45);
    }
    .admin-sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 1045;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    .admin-sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    .admin-topbar {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    .admin-content {
        padding: 1rem !important;
    }
}

@media (max-width: 575.98px) {
    .admin-footer {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
    .metric-card {
        padding: 14px 16px;
        min-height: 96px;
    }
    .metric-card h3,
    .metric-card-value {
        font-size: 1.4rem;
    }
    .metric-icon-box {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 1.15rem;
    }
}
