/*
================================================================================
| CUSTOM ADMINLTE THEME - Projectworlds Brand
================================================================================
| This file provides a consistent, professional theme based on the Projectworlds logo.
*/

/* --- 1. Global & Typography --- */
body {
    font-family: 'Source Sans Pro', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.content-wrapper {
    background-color: #f8f9fa;
}

/* --- Projectworlds Orange Links --- */
a {
    color: #f37021;
    /* Projectworlds Orange */
}

a:hover {
    color: #d8641c;
    /* A slightly darker orange for hover */
}

.card-primary.card-outline {
    border-top: 3px solid #f37021;
}

/* --- 2. Main Sidebar Theme --- */
body .main-sidebar .nav-sidebar .nav-link {
    transition: all 0.2s ease-in-out;
    border-left: 3px solid transparent !important;
}
body .main-sidebar .nav-sidebar>.nav-item.menu-open>.nav-link,
body .main-sidebar .nav-sidebar>.nav-item>.nav-link.active {
    background-color: transparent !important;
    color: #ffffff !important;
    border-left: 3px solid #f37021 !important;
    /* Projectworlds Orange */
}

/* Hide default submenu icons */
.nav-treeview .nav-icon {
    display: none !important;
}

/* Add custom "»" submenu symbol */
.nav-treeview .nav-link::before {
    content: '»';
    margin-right: 0.75rem;
    color: #8aa4af;
}

/* Active SUBMENU Item Styling */
.nav-treeview>.nav-item>.nav-link.active {
    background-color: #3e4146 !important;
    /* A slightly lighter background */
    color: #f37021 !important;
    /* Projectworlds Orange text */
    font-weight: bold;
}

body .main-sidebar .nav-sidebar .nav-link:hover {
    background-color: #3e4146 !important;
}

/* --- 3. Navbar Theme --- */
.main-header {
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

/* --- 4. Card & Box Styling --- */
.card {
    border: none;
    box-shadow: 0 0 1px rgba(0, 0, 0, .125), 0 1px 3px rgba(0, 0, 0, .2);
    border-radius: 0.35rem;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
}

/* --- 5. Button Styling --- */
.btn {
    border-radius: 0.35rem;
    box-shadow: none !important;
    font-weight: 600;
    transition: all 0.15s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background-color: #f37021;
    border-color: #f37021;
}

.btn-primary:hover {
    background-color: #d8641c;
    border-color: #d8641c;
}

/* --- 6. Form Control Styling --- */
.form-control,
.select2-container--default .select2-selection--single {
    border-radius: 0.35rem;
    box-shadow: none !important;
}

.form-control:focus,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #f37021;
    box-shadow: 0 0 0 2px rgba(243, 112, 33, 0.25) !important;
}

/* --- 7. Table & DataTables Styling --- */
.table thead.thead-light th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-bottom-width: 1px;
}

.dataTables_wrapper .dt-buttons .btn {
    background-color: #f8f9fa;
    color: #333;
    border-color: #ddd;
}

.table-hover tbody tr:hover {
    background-color: rgba(243, 112, 33, 0.075);
    /* Subtle orange hover for table rows */
}

/* --- 8. Miscellaneous (Badges, etc.) --- */
.badge {
    font-weight: 500;
    font-size: 85%;
    padding: 0.4em 0.6em;
}

.page-item.active .page-link {
    background-color: #f37021;
    /* Pagination active color */
    border-color: #f37021;
}

/* --- 9. Enhanced Select2 Theme (Corrected) --- */
/* Adjust the main selection box to match other form inputs */
.select2-container--default .select2-selection--single {
    height: calc(2.25rem + 2px);
    border: 1px solid #ced4da;
    padding: 0;
    /* Remove padding from the main container */
}

/* Vertically center the selected text */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #495057;
    line-height: calc(2.25rem + 2px);
    /* Make line-height equal to the container's height */
    padding-left: 0.75rem;
    /* Add horizontal padding here */
    padding-right: 25px;
    /* Add padding to prevent text from overlapping the arrow */
}

/* Style the dropdown arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(2.25rem - 2px);
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #555 transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #555 transparent;
    border-width: 0 4px 5px 4px;
}

/* Style the dropdown panel that opens */
.select2-dropdown {
    border: 1px solid #f37021;
    border-radius: 0.35rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Style the search box inside the dropdown */
.select2-search--dropdown .select2-search__field {
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: #f37021;
    box-shadow: 0 0 0 2px rgba(243, 112, 33, 0.25) !important;
    outline: none;
}

/* Style the options in the results list */
.select2-results__option--highlighted {
    background-color: #f37021 !important;
    color: white !important;
}

.select2-results__option[aria-selected=true] {
    background-color: #f8f9fa !important;
    color: #333 !important;
    font-weight: 600;
}

.select2-container--bootstrap4 .select2-selection--multiple .select2-search__field {
    min-width: 150px;
}

/* --- Brand Logo Area (Matches AdminLTE Original — Horizontal, Single Line) --- */
.brand-link {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    height: auto !important;
    padding: 0.8125rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    white-space: nowrap;
}

/* Logo image — fixed size, auto-crop any upload dimension */
.brand-link .brand-image {
    float: none !important;
    width: 33px;
    height: 33px;
    max-height: 33px;
    min-width: 33px;
    object-fit: cover;             /* Auto-crops rectangular/oversized images */
    object-position: center;       /* Centers the crop */
    border-radius: 50%;            /* Keeps the circle shape */
    margin-left: 0.8rem;
    margin-right: 0.5rem;
    margin-top: 0;
    margin-bottom: 0;
    opacity: 0.8;
}

/* Brand text — single line with ellipsis for long names */
.brand-link .brand-text {
    display: inline-block !important;
    max-width: 140px;              /* Prevents overflow */
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    font-size: 0.95rem;
    margin-left: 0 !important;
    vertical-align: middle;
}

/* Collapsed sidebar — just show logo, hide text */
.sidebar-collapse .brand-link {
    padding: 0.8125rem 0;
    justify-content: center;
}

.sidebar-collapse .brand-link .brand-text {
    display: none !important;
}

.sidebar-collapse .brand-link .brand-image {
    margin-left: 0;
    margin-right: 0;
}

/* Limit the width of the text in the top navigation bar */
.navbar .nav-item .font-weight-bold {
    max-width: 250px;
    /* Adjust this value as needed for the top nav */
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 10. Sidebar Search Spacing Fix --- */
/* Reduced margin to fix the empty gap between logo and search bar */
.sidebar .form-inline {
    margin-top: 0.5rem !important;
    margin-bottom: 1.25rem !important;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    transition: margin-top 0.3s ease-in-out;
}

/* Add extra padding to the top of the sidebar container */
.sidebar {
    padding-top: 0.5rem !important;
}

/* --- Sidebar Collapse Adjustments --- */
/* Remove excessive gap when sidebar is minimized */
.sidebar-collapse .sidebar .form-inline {
    margin-top: 0.5rem !important;
    padding-left: 0;
    padding-right: 0;
}

/* Center the search icon in collapsed mode if visible */
.sidebar-collapse .sidebar .form-inline .input-group {
    justify-content: center;
}

.sidebar .form-inline .input-group {
    width: 100%;
}

/* --- 11. Universal Sidebar Search Transparency --- */
/* Overrides AdminLTE's hardcoded grey search box to beautifully blend with our solid sidebar colors */

/* For Dark Themes */
body [class*="sidebar-dark-"] .form-inline .form-control-sidebar,
body [class*="sidebar-dark-"] .form-inline .btn-sidebar {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

body [class*="sidebar-dark-"] .form-inline .form-control-sidebar:focus,
body [class*="sidebar-dark-"] .form-inline .btn-sidebar:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

body [class*="sidebar-dark-"] .form-inline .form-control-sidebar::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Search Dropdown Results Layering */
body [class*="sidebar-dark-"] .sidebar-search-results .list-group-item {
    background-color: rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

body [class*="sidebar-dark-"] .sidebar-search-results .list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.5) !important;
}
body [class*="sidebar-dark-"] .sidebar-search-results .text-light {
    color: #ffffff !important;
}

/* For Light Themes */
body [class*="sidebar-light-"] .form-inline .form-control-sidebar,
body [class*="sidebar-light-"] .form-inline .btn-sidebar {
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #343a40 !important;
}

body [class*="sidebar-light-"] .form-inline .form-control-sidebar:focus,
body [class*="sidebar-light-"] .form-inline .btn-sidebar:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
}

body [class*="sidebar-light-"] .sidebar-search-results .list-group-item {
    background-color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #343a40 !important;
}

/* --- 12. Solid Theme Typography Contrast --- */
/* Eliminates faded grey texts for inactive links when using bright Legacy solid backgrounds */
body .main-sidebar[class*="sidebar-dark-"][class*="bg-"] .nav-sidebar .nav-link,
body .main-sidebar[class*="sidebar-dark-"][class*="bg-"] .nav-sidebar .nav-icon,
body .main-sidebar[class*="sidebar-dark-"][class*="bg-"] .nav-header,
body .main-sidebar[class*="sidebar-dark-"][class*="bg-"] .nav-sidebar .nav-link p {
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

body .main-sidebar[class*="sidebar-dark-"][class*="bg-"] .nav-sidebar .nav-item > .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(0, 0, 0, 0.1) !important;
}

body .main-sidebar[class*="sidebar-dark-"][class*="bg-"] .nav-treeview .nav-link::before {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* ============================================================================
   13. STUDENT PROFILE PAGE — Premium UI Enhancements
   ============================================================================ */

/* --- Profile Left Card: Gradient Header --- */
.student-profile-card .card-body.box-profile {
    padding-top: 0;
}
.student-profile-card .profile-hero {
    background: linear-gradient(135deg, #f37021 0%, #ff9a56 100%);
    padding: 1.5rem 1rem 1rem;
    border-radius: 0.35rem 0.35rem 0 0;
    margin: -1.25rem -1.25rem 1rem;
    text-align: center;
}
.student-profile-card .profile-hero .profile-user-img {
    border: 3px solid rgba(255,255,255,0.85);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    width: 100px;
    height: 100px;
    object-fit: cover;
}
.student-profile-card .profile-hero .profile-username {
    color: #fff;
    font-size: 1.15rem;
    margin-top: 0.5rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.student-profile-card .profile-hero .profile-class {
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
}

/* --- Tab Navigation Enhancement --- */
#student-tabs .nav-link {
    font-weight: 600;
    font-size: 0.82rem;
    color: #5a5c69;
    padding: 0.65rem 0.85rem;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}
#student-tabs .nav-link:hover {
    color: #f37021;
    background-color: rgba(243,112,33,0.04);
    border-bottom-color: rgba(243,112,33,0.3);
}
#student-tabs .nav-link.active {
    color: #f37021;
    border-bottom: 2px solid #f37021;
    background-color: transparent;
}
#student-tabs .nav-link i {
    margin-right: 4px;
    font-size: 0.8rem;
}

/* --- Profile Section Cards --- */
.profile-section {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: #fff;
    transition: box-shadow 0.2s ease;
}
.profile-section:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.profile-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.profile-section-title i {
    color: #f37021;
    font-size: 0.85rem;
    width: 20px;
    text-align: center;
}
.profile-section .info-row {
    display: flex;
    padding: 0.35rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid #f8f9fa;
}
.profile-section .info-row:last-child {
    border-bottom: none;
}
.profile-section .info-label {
    width: 140px;
    min-width: 140px;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.profile-section .info-value {
    flex: 1;
    color: #2d3748;
    font-weight: 500;
}

/* --- Parent Detail Cards --- */
.parent-card {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    overflow: hidden;
    height: 100%;
}
.parent-card-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 0.9rem;
}
.parent-card-header.father {
    background: linear-gradient(135deg, #e8f4fd, #f0f7ff);
    border-bottom: 2px solid #4e73df;
    color: #2e59d9;
}
.parent-card-header.mother {
    background: linear-gradient(135deg, #fdf2f8, #fef7ff);
    border-bottom: 2px solid #e74a9a;
    color: #d63384;
}
.parent-card-body {
    padding: 0.75rem 1rem;
}
.parent-card-body .info-row {
    display: flex;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}
.parent-card-body .info-label {
    width: 110px;
    min-width: 110px;
    color: #6c757d;
    font-weight: 600;
    font-size: 0.78rem;
}
.parent-card-body .info-value {
    flex: 1;
    color: #2d3748;
}

/* --- Fee Summary Dashboard --- */
.fee-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.fee-stat-card {
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    border: 1px solid;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.fee-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.fee-stat-card .stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}
.fee-stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
}
.fee-stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.2rem;
}
.fee-stat-card.assigned {
    background: linear-gradient(135deg, #eef2ff, #e8edff);
    border-color: #c7d2fe;
    color: #4338ca;
}
.fee-stat-card.paid {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-color: #bbf7d0;
    color: #166534;
}
.fee-stat-card.due {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-color: #fecaca;
    color: #991b1b;
}

/* --- Fee Progress Bar --- */
.fee-progress-container {
    margin-bottom: 1.25rem;
}
.fee-progress-container .progress {
    height: 10px;
    border-radius: 5px;
    background-color: #fecaca;
    overflow: hidden;
}
.fee-progress-container .progress-bar {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 5px;
    transition: width 0.6s ease;
}
.fee-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #6c757d;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

/* --- Fee Group Accordion (Student Profile Version) --- */
.sp-fee-group {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.sp-fee-group:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.sp-fee-group-header {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
    user-select: none;
}
.sp-fee-group-header:hover {
    background: #f1f5f9;
}
.sp-fee-group.fully-paid {
    border-left: 3px solid #22c55e;
}
.sp-fee-group.has-due {
    border-left: 3px solid #ef4444;
}
.sp-fee-group-header .group-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
}
.sp-fee-group-header .group-chevron {
    transition: transform 0.25s ease;
    color: #94a3b8;
    font-size: 0.7rem;
}
.sp-fee-group-header[aria-expanded="true"] .group-chevron {
    transform: rotate(90deg);
}
.sp-fee-group .table {
    margin-bottom: 0;
    font-size: 0.85rem;
}
.sp-fee-group .table thead th {
    background: #f8fafc;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom-width: 1px;
    padding: 0.5rem 0.75rem;
}
.sp-fee-group .table td {
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}
.sp-fee-group .table tfoot td,
.sp-fee-group .table tfoot th {
    padding: 0.6rem 0.75rem;
    font-weight: 700;
}

/* --- Empty State Styling --- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #94a3b8;
}
.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}
.empty-state p {
    font-size: 0.9rem;
    margin: 0;
}