/* ==========================================================================
   AARKAM SOVEREIGN ADMINISTRATION PORTAL STYLES
   Harmonized with Aarkam.IO Design Tokens & Bootstrap 5
   ========================================================================== */

@font-face {
    font-family: 'IBM Plex Sans Arabic';
    src: url('/fonts/IBMPlexSansArabic-Medium.ttf') format('truetype');
    font-weight: 100 900;
}

:root {
    /* ── Aarkam Design Tokens ── */
    --bg-app: linear-gradient(180deg, #F0F4F8 0%, #F8FAFC 100%);
    --bg-app-solid: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-sidebar: #0C1E36;
    --bg-sidebar-active: rgba(15, 108, 61, 0.22);
    --accent-primary: #0F6C3D;
    --accent-primary-hover: #0c5831;
    --accent-secondary: #10B981;
    --accent-navy: #162C4E;
    --text-primary: #1F2937;
    --text-secondary: #64748B;
    --text-inverse: #FFFFFF;
    --text-inverse-muted: #9AA8C0;
    --border-subtle: #E2E8F0;
    --radius-card: 16px;
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.05);
    --shadow-card-hover: 0 14px 32px rgba(15, 23, 42, 0.09);

    /* ── Layout Dimensions ── */
    --header-height: 70px;
    --admin-sidebar-width: 275px;
    --admin-sidebar-collapsed-width: 76px;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    min-height: 100vh;
    font-family: 'IBM Plex Sans Arabic', 'Inter', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-app-solid);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ==========================================================================
   Top Header / Navbar
   ========================================================================== */
.admin-navbar {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 4px 20px rgba(20, 40, 80, 0.04);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    transition: all var(--transition-smooth);
}

.admin-navbar::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, #0F6C3D 0%, #10B981 50%, #162C4E 100%);
    opacity: 0.85;
}

.nav-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--accent-navy);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-toggle-btn:hover {
    background: #EAF2FB;
    color: var(--accent-primary);
}

/* ==========================================================================
   Language Selector Pill
   ========================================================================== */
.lang-selector-pill {
    display: inline-flex;
    background-color: #EAF2FB;
    border-radius: 50px;
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 1px 3px rgba(20, 40, 80, 0.04);
    align-items: center;
}

.lang-pill-btn {
    border: none;
    background: transparent;
    border-radius: 50px;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.25s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.lang-pill-btn:hover {
    color: var(--accent-primary);
    background-color: rgba(23, 133, 99, 0.08);
}

.lang-pill-btn.active {
    background-color: var(--accent-primary);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(23, 133, 99, 0.35);
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    background-color: var(--bg-sidebar);
    position: fixed;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--transition-smooth), transform var(--transition-smooth);
    z-index: 1040;
    box-shadow: 0 0 24px rgba(10, 20, 35, 0.15);
}

/* RTL positioning */
body.rtl .admin-sidebar {
    right: 0;
    left: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
}

/* LTR positioning */
body.ltr .admin-sidebar {
    left: 0;
    right: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.admin-sidebar.collapsed {
    width: var(--admin-sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #142237; /* Harmonized Aarkam Deep Slate Navy */
    gap: 0.75rem;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    overflow: hidden;
}

.sidebar-brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.sidebar-brand-badge {
    font-size: 0.65rem;
    background: rgba(23, 133, 99, 0.25);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 2px;
}

.admin-sidebar.collapsed .sidebar-brand-text,
.admin-sidebar.collapsed .sidebar-brand-badge {
    display: none;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem 0.65rem;
    list-style: none;
    margin: 0;
}

.sidebar-nav-item {
    margin-bottom: 4px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 9px 12px;
    color: var(--text-inverse-muted);
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.sidebar-nav-text {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav-badge-warning {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    background-color: #F59E0B !important;
    color: #070D1E !important;
    border: 1px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.25);
    flex-shrink: 0;
    line-height: 1.2;
    letter-spacing: 0.02em;
    font-family: var(--bs-font-monospace, monospace);
    margin-inline-start: auto;
}

.sidebar-nav-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #FFFFFF;
}

.sidebar-nav-link:hover i {
    color: #2ECC71;
    transform: scale(1.1);
}

.sidebar-nav-link.active {
    background-color: var(--bg-sidebar-active);
    color: #2ecc71 !important;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(23, 133, 99, 0.18);
}

.sidebar-nav-link.active i {
    color: #2ecc71 !important;
}

.admin-sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.admin-sidebar.collapsed .sidebar-nav-link span,
.admin-sidebar.collapsed .sidebar-nav-badge-warning {
    display: none !important;
}

/* Sidebar Profile Footer */
.sidebar-footer {
    flex-shrink: 0;
    background: #142237; /* Harmonized Aarkam Deep Slate Navy, never pitch black */
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.85rem 1rem;
    transition: background var(--transition-smooth);
}

.sidebar-user-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #FFFFFF;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-user-box:hover {
    background: rgba(23, 133, 99, 0.16);
    border-color: rgba(23, 133, 99, 0.35);
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #178563 0%, #10B981 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #FFFFFF;
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
    line-height: 1.25;
}

.sidebar-user-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: #34D399; /* Vibrant Aarkam Emerald */
    font-weight: 500;
}

.admin-sidebar.collapsed .sidebar-user-info {
    display: none;
}

.admin-sidebar.collapsed .sidebar-footer {
    padding: 0.75rem 0.25rem;
    display: flex;
    justify-content: center;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.admin-main-wrapper {
    min-height: 100vh;
    padding-top: calc(var(--header-height) + 1.5rem);
    padding-bottom: 2.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    transition: margin var(--transition-smooth);
}

/* RTL layout */
body.rtl .admin-main-wrapper {
    margin-right: var(--admin-sidebar-width);
    margin-left: 0;
}

body.rtl .admin-navbar {
    margin-right: var(--admin-sidebar-width);
    margin-left: 0;
    width: calc(100% - var(--admin-sidebar-width));
}

body.rtl.sidebar-collapsed .admin-main-wrapper {
    margin-right: var(--admin-sidebar-collapsed-width);
}

body.rtl.sidebar-collapsed .admin-navbar {
    margin-right: var(--admin-sidebar-collapsed-width);
    width: calc(100% - var(--admin-sidebar-collapsed-width));
}

/* LTR layout */
body.ltr .admin-main-wrapper {
    margin-left: var(--admin-sidebar-width);
    margin-right: 0;
}

body.ltr .admin-navbar {
    margin-left: var(--admin-sidebar-width);
    margin-right: 0;
    width: calc(100% - var(--admin-sidebar-width));
}

body.ltr.sidebar-collapsed .admin-main-wrapper {
    margin-left: var(--admin-sidebar-collapsed-width);
}

body.ltr.sidebar-collapsed .admin-navbar {
    margin-left: var(--admin-sidebar-collapsed-width);
    width: calc(100% - var(--admin-sidebar-collapsed-width));
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    body.rtl .admin-sidebar {
        transform: translateX(100%);
    }
    body.ltr .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    body.rtl .admin-main-wrapper, body.ltr .admin-main-wrapper,
    body.rtl .admin-navbar, body.ltr .admin-navbar {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }
}

/* ==========================================================================
   Cards & UI Components
   ========================================================================== */
.aarkam-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aarkam-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.aarkam-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.aarkam-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-navy);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Metric / KPI Card */
.stat-card {
    background: #FFFFFF;
    border-radius: var(--radius-card);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(23, 133, 99, 0.12); color: var(--accent-primary); }
.stat-icon.info { background: rgba(59, 111, 229, 0.12); color: var(--accent-secondary); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.stat-icon.danger { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-navy);
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Primary Brand Buttons */
.btn-aarkam-primary {
    background-color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 18px;
    box-shadow: 0 4px 12px rgba(23, 133, 99, 0.25);
    transition: all 0.2s ease;
}

.btn-aarkam-primary:hover {
    background-color: var(--accent-primary-hover) !important;
    border-color: var(--accent-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(23, 133, 99, 0.35);
}

.btn-aarkam-outline {
    background-color: transparent !important;
    border: 1.5px solid var(--accent-primary) !important;
    color: var(--accent-primary) !important;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 18px;
    transition: all 0.2s ease;
}

.btn-aarkam-outline:hover {
    background-color: var(--accent-primary) !important;
    color: #ffffff !important;
}

/* Navy Brand Buttons & Filter Pills */
.btn-aarkam-navy {
    background-color: #162C4E !important;
    border-color: #162C4E !important;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 18px;
    box-shadow: 0 4px 12px rgba(22, 44, 78, 0.25);
    transition: all 0.2s ease;
}

.btn-aarkam-navy:hover, .btn-aarkam-navy.active {
    background-color: #0F2038 !important;
    border-color: #0F2038 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(22, 44, 78, 0.35);
}

/* Sovereign Plan Lifecycle & Visibility Action Buttons (Harmonized with Deploy Sovereign Cluster) */
.btn-aarkam-activate {
    background-color: #0F6C3D !important;
    border: 1px solid #0F6C3D !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-family: 'JetBrains Mono', 'IBM Plex Sans Arabic', monospace;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(15, 108, 61, 0.25);
    transition: all 0.2s ease;
}

.btn-aarkam-activate:hover {
    background-color: #0B5C34 !important;
    border-color: #0B5C34 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(15, 108, 61, 0.38);
    transform: translateY(-1px);
}

.btn-aarkam-deactivate {
    background-color: rgba(220, 38, 38, 0.05) !important;
    border: 1.5px solid rgba(220, 38, 38, 0.3) !important;
    color: #DC2626 !important;
    font-weight: 600 !important;
    font-family: 'JetBrains Mono', 'IBM Plex Sans Arabic', monospace;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-aarkam-deactivate:hover {
    background-color: #DC2626 !important;
    border-color: #DC2626 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-aarkam-show-site {
    background-color: #162C4E !important;
    border: 1px solid #162C4E !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    font-family: 'JetBrains Mono', 'IBM Plex Sans Arabic', monospace;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(22, 44, 78, 0.2);
    transition: all 0.2s ease;
}

.btn-aarkam-show-site:hover {
    background-color: #0F2038 !important;
    border-color: #0F2038 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(22, 44, 78, 0.3);
    transform: translateY(-1px);
}

.btn-aarkam-hide-site {
    background-color: #F8FAFC !important;
    border: 1.5px solid #CBD5E1 !important;
    color: #475569 !important;
    font-weight: 600 !important;
    font-family: 'JetBrains Mono', 'IBM Plex Sans Arabic', monospace;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-aarkam-hide-site:hover {
    background-color: #E2E8F0 !important;
    border-color: #94A3B8 !important;
    color: #1E293B !important;
}

/* Aarkam Sovereign Defense Comparison Table Styles */
.table-aarkam-defense {
    background-color: #F1F5F9 !important;
    color: #1E293B !important;
    border-color: #E2E8F0 !important;
    transition: background-color 0.15s ease-in-out;
}

.table-hover > tbody > tr:hover > .table-aarkam-defense {
    background-color: #E2E8F0 !important;
}

.table-aarkam-defense-header {
    background-color: #E8EEF5 !important;
    color: #162C4E !important;
    border-top: 3px solid #162C4E !important;
    border-color: #CBD5E1 !important;
}

/* ==========================================================================
   Dashboard Table Action Buttons (Icon-Only with Hover Tooltips)
   ========================================================================== */
.btn-table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1;
    transition: all 0.15s ease-in-out;
    vertical-align: middle;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-table-action:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.btn-table-action:active {
    transform: translateY(0);
}

/* ==========================================================================
   Auth Layout Specifics
   ========================================================================== */
.auth-page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EAF2FB 0%, #F6FAFD 50%, #E3EDF8 100%);
    padding: 2rem 1rem;
}

.auth-fullscreen-wrapper {
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #FFFFFF;
    overflow-x: hidden;
}

.auth-card {
    background: #FFFFFF;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 20px 40px rgba(20, 40, 80, 0.08);
    max-width: 480px;
    width: 100%;
    padding: 2.5rem;
}

.auth-logo-img {
    height: 52px;
    object-fit: contain;
    margin-bottom: 1.25rem;
}

.auth-form-control {
    height: 48px;
    border-radius: 12px;
    border: 1.5px solid var(--border-subtle);
    padding: 0 16px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.auth-form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3.5px rgba(23, 133, 99, 0.18);
}
.password-rules-card {
    background: #f8fbf9;
    border-color: #e0ebe4 !important;
    font-size: .82rem;
}

.password-rules-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    color: #0f6c3d;
    background: #e5f3e9;
    font-size: 1.05rem;
}

.password-rules-title {
    color: #174c31;
    font-size: .92rem;
}

.password-rules-subtitle {
    font-size: .75rem;
    margin-top: 2px;
}

.password-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.password-rule {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #e6ece8;
    border-radius: 8px;
    background: #fff;
    color: #59665e;
    transition: background-color .2s, border-color .2s, color .2s;
}

    .password-rule .rule-icon {
        flex-shrink: 0;
        color: #a2ada5;
        font-size: .95rem;
    }

.password-rule-wide {
    grid-column: 1 / -1;
}

.password-rule.valid {
    background: #edf8f0;
    border-color: #b9dfc5;
    color: #176b3b;
}

    .password-rule.valid .rule-icon {
        color: #198754;
    }

@media (max-width: 420px) {
    .password-rules-grid {
        grid-template-columns: 1fr;
    }

    .password-rule-wide {
        grid-column: auto;
    }
}