/* Academy Management System - Main Styles */

/* RTL & Persian Font */

:root {
    --primary-color: #0d6efd;
    --sidebar-width: 260px;
    --navbar-height: 60px;
    --font-family-base: 'Vazirmatn', Tahoma, Arial, sans-serif;
    --bs-body-font-family: var(--font-family-base);
    --bs-font-sans-serif: var(--font-family-base);
}

html,
body {
    font-family: var(--font-family-base);
    overflow-x: hidden;
}

body {
    font-size: 14px;
    background-color: var(--bs-tertiary-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

button,
input,
optgroup,
select,
textarea,
.btn,
.form-control,
.form-select,
.dropdown-menu,
.popover,
.tooltip,
.modal,
.offcanvas,
.toast,
.table,
.card,
.list-group,
.pagination,
.breadcrumb,
.alert,
.badge {
    font-family: var(--font-family-base);
}

main {
    flex: 1;
}

/* Navbar */
.navbar-brand {
    font-size: 1.1rem;
}

/* Cards */
.card {
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

/* Tables */
.table th {
    font-weight: 600;
    background-color: #f8f9fa;
    white-space: nowrap;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
}

.btn-lg {
    padding: 0.65rem 1.5rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #dee2e6;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* OTP input */
.letter-spacing-wide {
    letter-spacing: 0.5em;
    font-size: 1.5rem;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.4em 0.7em;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
}

/* Login page */
.card.shadow-lg {
    border-radius: 16px;
}

/* Stats cards */
.rounded-circle.bg-primary {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* List group */
.list-group-item {
    padding: 0.85rem 1rem;
}

.list-group-item-action:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Footer */
footer {
    font-size: 0.8rem;
    padding: 0.75rem 0 !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Pagination */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.85rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .navbar, .btn, footer, .alert {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* ─── Modern RTL Sidebar & Header Layout ─── */
:root {
    --sidebar-width: 280px;
    --header-height: 60px;
    --primary-light: rgba(13, 110, 253, 0.08);
    --primary-hover: rgba(13, 110, 253, 0.15);
    --text-muted-dark: #6c757d;
}

#app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0; /* Align to the right in RTL */
    z-index: 1045;
    height: 100vh;
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Sidebar scrollbar customization */
.sidebar-body::-webkit-scrollbar {
    width: 5px;
}
.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
.sidebar-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Main Content Wrapper */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}
.main-wrapper.has-sidebar {
    padding-top: var(--header-height);
}

/* When sidebar is active, add margin-right on desktop (width >= 992px) */
@media (min-width: 992px) {
    .main-wrapper.has-sidebar {
        margin-right: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }
    
    /* When sidebar is collapsed on desktop */
    .sidebar-collapsed .sidebar {
        transform: translateX(100%); /* Moves sidebar off-screen to the right in RTL */
    }
    .sidebar-collapsed .main-wrapper.has-sidebar {
        margin-right: 0;
        width: 100%;
    }
}

/* Mobile responsive (width < 992px) */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%); /* Hidden by default on mobile */
    }
    
    /* When sidebar is open on mobile */
    .sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    .main-wrapper.has-sidebar {
        margin-right: 0 !important;
        width: 100% !important;
    }
    
    /* Overlay backdrop */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
}

/* Header style */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1020;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.02);
    background-color: var(--bs-body-bg) !important;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 992px) {
    .main-wrapper.has-sidebar .top-header {
        right: var(--sidebar-width);
    }
    .sidebar-collapsed .main-wrapper.has-sidebar .top-header {
        right: 0;
    }
}

/* Navigation Link Custom Premium Styling */
.sidebar .nav-link {
    color: #495057;
    font-weight: 500;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.sidebar .nav-link i {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-color) !important;
}

.sidebar .nav-link:hover i {
    transform: scale(1.1) rotate(5deg);
}

.sidebar .nav-link.active {
    background-color: var(--primary-light) !important;
    color: var(--primary-color) !important;
    font-weight: 600;
    border-right: 4px solid var(--primary-color);
    border-radius: 4px 10px 10px 4px; /* Soft right corners, flat left edge for vertical bar */
}

/* Submenu layout */
.sidebar .submenu-collapse {
    border-right: 2px solid #e9ecef; /* In RTL, border-right corresponds to border-start */
    margin-right: 1.5rem; /* Indentation in RTL */
    padding-right: 0.75rem;
}

.sidebar .submenu-link {
    color: #6c757d;
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 1px;
}

.sidebar .submenu-link:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.sidebar .submenu-link.active {
    color: var(--primary-color);
    font-weight: 600;
    background-color: rgba(13, 110, 253, 0.04);
}

.sidebar .nav-item-category {
    font-size: 0.75rem;
    font-weight: 700;
    color: #adb5bd;
    text-transform: uppercase;
    padding: 1.25rem 1rem 0.4rem;
    letter-spacing: 0.5px;
    border-top: 1px solid #f8f9fa;
    margin-top: 0.5rem;
}

.sidebar .nav-item-category:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0.5rem;
}

/* Header Action Buttons */
.btn-light-primary {
    background-color: var(--primary-light);
    color: var(--primary-color);
    transition: all 0.2s ease;
}
.btn-light-primary:hover {
    background-color: var(--primary-hover);
    color: var(--primary-color);
}

/* Submenu toggler chevron transitions */
.sidebar .nav-link[data-bs-toggle="collapse"] {
    position: relative;
}

.sidebar .nav-link .submenu-arrow {
    transition: transform 0.2s ease;
}

.sidebar .nav-link:not(.collapsed) .submenu-arrow {
    transform: rotate(-90deg); /* Rotate indicator when expanded in RTL */
}

/* Profile button formatting inside header */
.header-profile-btn {
    border: 1px solid #e9ecef;
    padding: 0.35rem 0.75rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.header-profile-btn:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* ─── Premium Dashboard & Theme Switch Overrides ─── */

/* Dark Mode Theme Switcher */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-toggle-btn:hover {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color-translucent);
    transform: scale(1.05);
}
.theme-toggle-btn i {
    font-size: 1.15rem;
}

/* Premium Dashboard Card & Hover Effects */
.card {
    border: 1px solid var(--bs-border-color-translucent) !important;
    background-color: var(--bs-card-bg) !important;
}

.stats-card {
    border-radius: 16px !important;
    overflow: hidden;
    position: relative;
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06) !important;
}
.stats-icon-wrapper {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.stats-card:hover .stats-icon-wrapper {
    transform: scale(1.1) rotate(5deg);
}

/* Timeline & Schedule Styles */
.schedule-item {
    border-left: 3px solid var(--bs-primary);
    padding-left: 1rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.2s ease;
}
.schedule-item:hover {
    transform: translateX(-3px);
}

/* RTL Submenu Border in Dark Mode */
[data-bs-theme="dark"] .sidebar {
    background-color: var(--bs-body-bg);
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.3);
}
[data-bs-theme="dark"] .sidebar-footer {
    background-color: var(--bs-tertiary-bg) !important;
}
[data-bs-theme="dark"] .sidebar .nav-item-category {
    color: #6c757d;
    border-top-color: #2b3035;
}
[data-bs-theme="dark"] .sidebar .submenu-collapse {
    border-right-color: #2b3035;
}
[data-bs-theme="dark"] .sidebar .nav-link {
    color: #adb5bd;
}
[data-bs-theme="dark"] .sidebar .nav-link:hover {
    color: #fff !important;
}
[data-bs-theme="dark"] .sidebar .submenu-link {
    color: #8a949e;
}
[data-bs-theme="dark"] .sidebar .submenu-link:hover {
    color: var(--primary-color);
}
[data-bs-theme="dark"] .top-header {
    background-color: var(--bs-body-bg);
    border-bottom-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .header-profile-btn {
    border-color: #2b3035;
    color: #dee2e6 !important;
}
[data-bs-theme="dark"] .header-profile-btn:hover {
    background-color: #2b3035;
}
[data-bs-theme="dark"] .table th {
    background-color: #1a1d20;
    color: #dee2e6;
}
[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Responsive Chart Wrapper */
.chart-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
}
@media (max-width: 768px) {
    .chart-wrapper {
        height: 220px;
    }
}

/* ─── Global Dark Mode Overrides for Legacy / Hardcoded Styles ─── */
[data-bs-theme="dark"] .bg-white {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .text-dark {
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .table-light {
    --bs-table-bg: var(--bs-tertiary-bg) !important;
    --bs-table-color: var(--bs-body-color) !important;
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .card-header.bg-white,
[data-bs-theme="dark"] .card-footer.bg-white {
    background-color: transparent !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}
[data-bs-theme="dark"] .border {
    border-color: var(--bs-border-color) !important;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    border-color: var(--bs-border-color) !important;
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] .list-group-item {
    background-color: var(--bs-body-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
}

/* Micro-interaction: Hover Elevate */
.hover-elevate {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}
.hover-elevate:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05) !important;
}
[data-bs-theme="dark"] .hover-elevate:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25) !important;
}


