/* =============================================
   College Management System - Main Stylesheet
   ============================================= */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-color: #94a3b8;
    --sidebar-active-color: #ffffff;
    --sidebar-active-bg: #334155;
    --sidebar-hover-bg: #334155;
    --navbar-height: 60px;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
}

/* Reset */
* { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f1f5f9; margin: 0; min-height: 100vh; }

/* Layout */
.wrapper { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: var(--sidebar-width); transition: margin-left 0.3s; min-width: 0; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-color);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}
.sidebar-brand:hover { color: #fff; }

.sidebar-toggle { background: none; border: none; color: var(--sidebar-color); font-size: 20px; cursor: pointer; }
.sidebar-toggle:hover { color: #fff; }

/* Sidebar Navigation */
.sidebar-nav { padding: 10px 0; }
.sidebar-nav .nav-section { padding: 0; }
.sidebar-nav .nav-section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #64748b;
    padding: 20px 20px 6px;
    display: block;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-color);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i { width: 22px; margin-right: 10px; font-size: 16px; }
.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-active-color);
}
.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.15);
}
.sidebar-nav .nav-link.active i {
    color: var(--primary-color);
}

/* Navbar */
.navbar { height: var(--navbar-height); }
.breadcrumb { font-size: 14px; }
.breadcrumb-item a { color: #6c757d; text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary-color); }

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 24px; font-weight: 600; margin: 0; color: #1e293b; }

/* Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #1e293b; }
.stat-card .stat-label { font-size: 13px; color: #64748b; margin-top: 4px; }

/* Content Card */
.content-card {
    background: #fff;
    border-radius: 12px;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.content-card .card-header {
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 24px;
    font-weight: 600;
}
.content-card .card-body { padding: 24px; }

/* Tables */
.table th { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; border-bottom-width: 1px; }
.table td { vertical-align: middle; font-size: 14px; }

/* Status Badges */
.badge-status { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 20px; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fef3c7; color: #92400e; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }
.badge-partial { background: #fef3c7; color: #92400e; }
.badge-pending { background: #e0f2fe; color: #075985; }

/* Forms */
.form-label { font-weight: 500; font-size: 14px; color: #374151; margin-bottom: 4px; }
.form-control:focus, .form-select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }

/* Buttons */
.btn-primary { background: var(--primary-color); border-color: var(--primary-color); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

/* DataTables Override */
.dataTables_wrapper .dataTables_filter input { border-radius: 6px; border: 1px solid #d1d5db; padding: 6px 12px; }
.dataTables_wrapper .dataTables_length select { border-radius: 6px; }

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.auth-card h2 { font-weight: 700; color: #1e293b; margin-bottom: 8px; }
.auth-card .auth-subtitle { color: #64748b; margin-bottom: 30px; }

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* =============================================
   RTL & MULTILINGUAL SUPPORT
   ============================================= */

/* Urdu font (Nastaliq) */
html[lang="ur"], html[lang="ur"] body {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Alvi Nastaleeq', system-ui, sans-serif;
    line-height: 2;
}
html[lang="ur"] .sidebar-nav .nav-link,
html[lang="ur"] .navbar,
html[lang="ur"] .form-control,
html[lang="ur"] .form-select,
html[lang="ur"] .btn,
html[lang="ur"] table {
    font-family: 'Noto Nastaliq Urdu', system-ui, sans-serif;
    line-height: 1.8;
}

/* Arabic font (Naskh / Cairo) */
html[lang="ar"], html[lang="ar"] body {
    font-family: 'Cairo', 'Noto Naskh Arabic', 'Tahoma', system-ui, sans-serif;
    line-height: 1.7;
}
html[lang="ar"] .sidebar-nav .nav-link,
html[lang="ar"] .navbar,
html[lang="ar"] .form-control,
html[lang="ar"] .form-select,
html[lang="ar"] .btn,
html[lang="ar"] table {
    font-family: 'Cairo', 'Noto Naskh Arabic', system-ui, sans-serif;
}

/* RTL Layout - sidebar moves to right */
[dir="rtl"] .sidebar { left: auto; right: 0; }
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); }

/* RTL sidebar nav */
[dir="rtl"] .sidebar-nav .nav-link {
    border-left: none;
    border-right: 3px solid transparent;
}
[dir="rtl"] .sidebar-nav .nav-link.active {
    border-right-color: var(--primary-color);
}
[dir="rtl"] .sidebar-nav .nav-link i {
    margin-right: 0;
    margin-left: 10px;
}

/* RTL spacing utilities */
[dir="rtl"] .me-1, [dir="rtl"] .me-2, [dir="rtl"] .me-3 { margin-right: 0 !important; }
[dir="rtl"] .me-1 { margin-left: 0.25rem !important; }
[dir="rtl"] .me-2 { margin-left: 0.5rem !important; }
[dir="rtl"] .me-3 { margin-left: 1rem !important; }
[dir="rtl"] .ms-1, [dir="rtl"] .ms-2, [dir="rtl"] .ms-3, [dir="rtl"] .ms-auto { margin-left: 0 !important; }
[dir="rtl"] .ms-1 { margin-right: 0.25rem !important; }
[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; }
[dir="rtl"] .ms-3 { margin-right: 1rem !important; }
[dir="rtl"] .ms-auto { margin-right: auto !important; }

/* RTL navbar avatar/user dropdown */
[dir="rtl"] .navbar .ms-auto { margin-right: auto !important; margin-left: 0 !important; }

/* RTL breadcrumb separator */
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before { float: right; padding-left: 0.5rem; padding-right: 0; }

/* RTL form input groups */
[dir="rtl"] .input-group > :first-child { border-radius: 0 0.375rem 0.375rem 0 !important; }
[dir="rtl"] .input-group > :last-child { border-radius: 0.375rem 0 0 0.375rem !important; }

/* RTL dropdown menus */
[dir="rtl"] .dropdown-menu { text-align: right; }

/* Mobile RTL */
@media (max-width: 991.98px) {
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    [dir="rtl"] .sidebar.show { transform: translateX(0); }
    [dir="rtl"] .main-content { margin-right: 0; }
}

/* Numbers always LTR even in RTL context (prevents "12-2024" displaying weird) */
[dir="rtl"] .number,
[dir="rtl"] .badge,
[dir="rtl"] td.text-end,
[dir="rtl"] .text-monospace,
[dir="rtl"] code {
    direction: ltr;
    unicode-bidi: embed;
}

/* Better readability for Urdu/Arabic in tables */
[dir="rtl"] .table th,
[dir="rtl"] .table td { text-align: right; }
[dir="rtl"] .table th:has(.actions),
[dir="rtl"] .table td .btn-group { text-align: left; }

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Print */
@media print {
    .sidebar, .navbar, .sidebar-toggle-btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
}
