/* =============================================================
   Educate App — Admin Panel Stylesheet
   Stack: Bootstrap 5.3 + custom styles
   No inline styles anywhere — all styles go here
   ============================================================= */

/* ---------------------------------------------------------
   1. CSS Variables / Theming
   --------------------------------------------------------- */
:root {
    --primary:       #1B3A6B;
    --primary-dark:  #122850;
    --primary-light: #E8F0FE;
    --sidebar-bg:    #1B3A6B;
    --sidebar-text:  #c7d2fe;
    --sidebar-hover: #2E5CB8;
    --sidebar-active:#2E5CB8;
    --sidebar-width: 260px;
    --topbar-height: 78px;
    --body-bg:       #f0f4fa;
    --card-bg:       #ffffff;
    --text-main:     #1A1A2E;
    --text-muted:    #6B7280;
    --border-color:  #e2e8f0;
    --danger:        #ef4444;
    --success:       #22c55e;
    --warning:       #f59e0b;
    --info:          #2E5CB8;
    --radius:        0.5rem;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow:        0 4px 12px rgba(0,0,0,.10);
    --transition:    0.2s ease;
}

/* ---------------------------------------------------------
   2. Reset & Base
   --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; }

/* ---------------------------------------------------------
   2b. Global Button Color Overrides (ERP Navy Theme)
   --------------------------------------------------------- */
/* Primary buttons */
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover, .btn-primary:focus { background-color: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }

/* Outline buttons — all match ERP navy */
.btn-outline-primary { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-outline-primary:hover { background-color: var(--primary) !important; color: #fff !important; }

.btn-outline-secondary { color: var(--primary) !important; border-color: #cbd5e1 !important; }
.btn-outline-secondary:hover { background-color: var(--primary-light) !important; color: var(--primary) !important; border-color: var(--primary) !important; }

/* DataTable Excel button */
.dt-buttons .btn, .buttons-excel { background-color: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; font-size: .8rem; }
.dt-buttons .btn:hover { background-color: var(--primary-dark) !important; }

/* Pagination */
.page-item.active .page-link { 
    background-color: var(--primary) !important; 
    border-color: var(--primary) !important; 
    color: #fff !important; /* Yeh line active number ko white kar degi */
}
.page-link { 
    color: var(--primary) !important; 
}
.page-link:hover { 
    color: var(--primary-dark) !important; 
    background-color: var(--primary-light) !important; 
}

/* Password toggle button */
.input-group .btn-outline-secondary { color: #6B7280 !important; border-color: #ced4da !important; }
.input-group .btn-outline-secondary:hover { background-color: var(--primary-light) !important; color: var(--primary) !important; }

/* Filter buttons / Reset — match dropdown height (increase button height) */
.card-body .btn-sm,
.card-body .btn-outline-secondary {
    height: 43px;
    line-height: 1;
    padding: 0.375rem 0.75rem;
    font-size: .85rem;
    display: inline-flex;
    align-items: center;
}

/* Filter dropdowns — keep normal size */
.form-select-sm {
    height: 38px;
    font-size: .85rem;
}

/* Back to list button */
.btn-outline-secondary i { margin-right: 0.25rem; }

/* Fix horizontal scroll on tables — make responsive */
.table-responsive { overflow-x: auto; }
#example { width: 100% !important; table-layout: auto !important; }
.dataTables_scrollBody { overflow-x: hidden !important; }
.dataTables_wrapper { overflow: hidden; }

/* DataTable responsive — text wrap and truncate on small screens */
@media (max-width: 1200px) {
    #example td, #example th { font-size: .78rem; padding: .4rem .3rem; white-space: nowrap; }
    #example td:nth-last-child(1) { white-space: nowrap; }
}
@media (max-width: 768px) {
    #example td, #example th { font-size: .72rem; padding: .3rem .2rem; }
    .page-content { padding: 0.5rem; }
}

/* ---------------------------------------------------------
   3. Layout Wrapper
   --------------------------------------------------------- */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.main-content.sidebar-collapsed {
    margin-left: 0;
}

/* ---------------------------------------------------------
   4. Sidebar
   --------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-hover) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-hover); border-radius: 4px; }

/* Sidebar collapsed state (desktop) */
.sidebar.collapsed {
    transform: translateX(-100%);
}
.main-content.sidebar-collapsed {
    margin-left: 0;
}

/* Sidebar open state (mobile) */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0 !important;
    }
    .sidebar-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 999;
    }
}
.sidebar-overlay { display: none; }

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-size: 1.0rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(199,210,254,.4);
    padding: 0.75rem 1.5rem 0.25rem;
    margin-top: 0.5rem;
}

.sidebar-nav .nav-item { margin: 0 0.75rem 0.1rem; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.sidebar-nav .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

/* ---------------------------------------------------------
   5. Topbar / Navbar
   --------------------------------------------------------- */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.btn-sidebar-toggle {
    background: none;
    border: none;
    padding: 0.4rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    transition: background var(--transition), color var(--transition);
}

.btn-sidebar-toggle:hover { background: var(--body-bg); color: var(--text-main); }

.page-title-bar {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.admin-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

/* ---------------------------------------------------------
   6. Page Content Area
   --------------------------------------------------------- */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.breadcrumb { margin: 0; font-size: 0.8rem; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ---------------------------------------------------------
   7. Cards
   --------------------------------------------------------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.card-body { padding: 1.25rem; }

/* Stat Cards (Dashboard) */
.stat-card {
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.bg-primary-soft { background: var(--primary-light); color: var(--primary); }
.stat-icon.bg-success-soft { background: #dcfce7; color: #16a34a; }
.stat-icon.bg-warning-soft { background: #fef3c7; color: #d97706; }
.stat-icon.bg-danger-soft  { background: #fee2e2; color: var(--danger); }
.stat-icon.bg-info-soft    { background: #dbeafe; color: #1d4ed8; }

.stat-info .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
}

.stat-info .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ---------------------------------------------------------
   8. Tables & DataTables
   --------------------------------------------------------- */
.table {
    font-size: 0.875rem;
    color: var(--text-main);
    border-color: var(--border-color);
}

.table thead th {
    background: var(--body-bg);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    padding: 0.75rem 1rem;
}

.table tbody td { padding: 0.75rem 1rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* DataTables overrides */
div.dataTables_wrapper div.dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

div.dataTables_wrapper div.dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.3rem 0.5rem;
}

div.dataTables_wrapper div.dataTables_info { font-size: 0.82rem; color: var(--text-muted); }

table.dataTable thead th { cursor: pointer; }

/* ---------------------------------------------------------
   9. Forms
   --------------------------------------------------------- */
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    padding: 0.5rem 0.85rem;
    color: var(--text-main);
    background-color: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
    outline: none;
}

.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: 0.8rem; }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ---------------------------------------------------------
   10. Buttons
   --------------------------------------------------------- */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    padding: 0.45rem 1rem;
    transition: all var(--transition);
}

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------
   11. Badges & Status
   --------------------------------------------------------- */
.badge { font-size: 0.75rem; font-weight: 600; padding: 0.3em 0.65em; border-radius: 0.35rem; }
.badge-active   { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-present  { background: #dcfce7; color: #16a34a; }
.badge-absent   { background: #fee2e2; color: var(--danger); }
.badge-late     { background: #fef3c7; color: #b45309; }
.badge-all      { background: var(--primary-light); color: var(--primary); }
.badge-standard { background: #e0f2fe; color: #0369a1; }

/* ---------------------------------------------------------
   12. Alert Messages
   --------------------------------------------------------- */
.alert { border-radius: var(--radius); font-size: 0.875rem; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger   { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.alert-warning  { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ---------------------------------------------------------
   13. Login Page
   --------------------------------------------------------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary-dark) 100%);
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 2.5rem 2rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo .logo-icon {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 0.75rem;
}

.login-logo h4 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.login-logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0;
}

/* ---------------------------------------------------------
   14. Attendance Grid
   --------------------------------------------------------- */
.attendance-grid .student-row {
    display: flex;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    flex-wrap: wrap;
}

.attendance-grid .student-name { flex: 1; min-width: 180px; font-weight: 500; }
.attendance-grid .att-options { display: flex; gap: 0.75rem; }

/* ---------------------------------------------------------
   15. Utilities
   --------------------------------------------------------- */
.text-primary-custom { color: var(--primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.gap-2 { gap: 0.5rem; }
.cursor-pointer { cursor: pointer; }

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

/* ---------------------------------------------------------
   16. Responsive
   --------------------------------------------------------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 999;
    }
    .sidebar-overlay.active { display: block; }
}

@media (max-width: 575.98px) {
    .page-content { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
    .stat-info .stat-value { font-size: 1.3rem; }
}
.error{
    display: block !important;
    width:100%;
    color:red;
}
#togglePassword{
    position: absolute;
    right: 0;
}
#password{
    position: relative;
}

/* excel button position */

.dataTables_wrapper .dt-buttons {
    float: left;
    margin-right: 15px; 
    margin-bottom: 0px;
}

.dataTables_wrapper .dataTables_length {
    float: left;
}
.dataTables_wrapper .dataTables_filter {
    float: right;
}

.table-responsive{
    margin : 0.5rem !important;
}


#password {
    border-top-right-radius: 0.375rem !important;    /* Bootstrap ka default border radius */
    border-bottom-right-radius: 0.375rem !important;
}


#example th, #example td {
    white-space: normal !important;
    word-break: break-word;
    vertical-align: middle;
}

.dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}


/* Label jispe click hoga */
/* .profile-upload-label {
    cursor: pointer;
    display: inline-block;
} */

/* Profile image ki styling aur hover effect */
/* .profile-preview-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
    transition: opacity 0.2s ease, border-color 0.2s ease;
} */

/* Jab user image par mouse le jaye (Hover state) */
/* .profile-preview-img:hover {
    opacity: 0.8;
    border-color: #bbb; 
} */

/* Main Label Wrapper */
.profile-upload-label {
    cursor: pointer;
    display: inline-block;
}

/* Image Wrapper jiske andar image aur overlay dono hain */
.profile-image-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden; /* Taaki overlay circle se bahar na jaye */
    border: 2px solid #ddd;
    transition: border-color 0.3s ease;
}

/* Profile Image Styling */
.profile-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Overlay (Normal state mein chhipa rahega) */
.profile-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Black semi-transparent background */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    opacity: 0; /* Shuruat me hidden */
    transition: opacity 0.3s ease;
}

/* === HOVER EFFECTS === */

/* Hover hone par border change hoga */
.profile-image-wrapper:hover {
    border-color: #0d6efd; /* Bootstrap Primary Blue Color */
}

/* Hover hone par image thodi zoom hogi */
.profile-image-wrapper:hover .profile-preview-img {
    transform: scale(1.05);
}

/* Hover hone par overlay (Camera + icon) smooth dikhega */
.profile-image-wrapper:hover .profile-upload-overlay {
    opacity: 1;
}


.select2-container--bootstrap-5 .select2-selection--single {
    height: 42px !important;
    padding: .25rem 2.25rem .25rem .5rem;
}

/* ==========================================================================
   GLOBAL FORM CONTROL-SM & MONTH INPUT UNIFICATION
   ========================================================================== */

/* 1. Sabhi small inputs (including month, date, text) ki height ek barabar karne ke liye */
input[type="month"].form-control-sm,
input[type="date"].form-control-sm,
.form-control-sm, 
.form-select-sm {
    height: 42px !important;
    min-height: 42px !important;
    line-height: 1.5 !important;
    padding: 0.25rem 0.5rem !important;
    box-sizing: border-box !important;
}

/* 2. Select2 Single selection box ki height ko bhi exactly 31px karne ke liye */
.select2-container .select2-selection--single {
    height: 42px !important;
    min-height: 42px !important;
    display: flex !important;
    align-items: center !important;
    border: 1px solid #dee2e6 !important; /* Bootstrap border color */
    border-radius: 0.25rem !important;     /* Bootstrap standard sm border-radius */
}

/* 3. Select2 ke andar ke text aur arrows ki visual alignment fix karne ke liye */
.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 29px !important; /* Text vertically center align ho jayega */
    padding-left: 8px !important;
    padding-right: 20px !important;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 29px !important;
    top: 1px !important;
    right: 5px !important;
}

/* Jis column me Select2 hai, usko relative karein */
.col-md-3 {
    position: relative;
}

/* Error message ko absolute karke layout disturb hone se bachayein */
.col-md-3 div.invalid-feedback {
    position: absolute;
    bottom: -20px; /* Dropdown ke thik niche floating position */
    left: 10px;    /* Padding alignment */
    font-size: 0.75rem;
    white-space: nowrap; /* Text break hokar line height na badhaye */
    z-index: 10;
}