/* ============================================ */
/* GLOBAL STYLES */
/* ============================================ */
* {
    box-sizing: border-box;
}

body {
    background: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ============================================ */
/* SIDEBAR STYLES */
/* ============================================ */
.sidebar {
    min-height: 100vh;
    background: #2d3748;
    color: white;
}

.sidebar .sidebar-header {
    padding: 20px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar .sidebar-header h5 {
    margin-bottom: 5px;
    font-weight: 600;
}

.sidebar .sidebar-header .school-badge {
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
    margin-top: 5px;
}

.sidebar a {
    color: #cbd5e0;
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    border-radius: 8px;
    margin: 4px 10px;
    transition: all 0.2s ease;
}

.sidebar a:hover {
    background: #4a5568;
    color: white;
    transform: translateX(5px);
}

.sidebar a.active {
    background: #4a5568;
    color: white;
}

.sidebar a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.sidebar a.text-danger:hover {
    background: #742a2a;
    color: #f8d7da;
}

/* ============================================ */
/* MAIN CONTENT AREA */
/* ============================================ */
.main-content {
    padding: 30px;
}

.page-content {
    padding: 20px;
}

/* ============================================ */
/* PROFILE HEADER */
/* ============================================ */
.profile-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
}

.profile-header h1,
.profile-header h2,
.profile-header h3 {
    color: white;
}

/* ============================================ */
/* STAT CARDS */
/* ============================================ */
.stat-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.stat-card .stat-number {
    font-size: 28px;
    font-weight: bold;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #6c757d;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.stat-card.border-success {
    border-left: 4px solid #28a745;
}

.stat-card.border-danger {
    border-left: 4px solid #dc3545;
}

.stat-card.border-warning {
    border-left: 4px solid #ffc107;
}

.stat-card.border-info {
    border-left: 4px solid #17a2b8;
}

.stat-card.border-primary {
    border-left: 4px solid #667eea;
}

/* ============================================ */
/* TIER BADGES */
/* ============================================ */
.tier-badge {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.tier-tier1 {
    background: #28a745;
    color: white;
}

.tier-tier2 {
    background: #ffc107;
    color: black;
}

.tier-tier3 {
    background: #dc3545;
    color: white;
}

/* ============================================ */
/* RISK LEVEL STYLES */
/* ============================================ */
.risk-low {
    color: #28a745;
}

.risk-moderate {
    color: #ffc107;
}

.risk-high {
    color: #dc3545;
}

/* ============================================ */
/* SCHOOL YEAR BADGE */
/* ============================================ */
.school-year-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e2e8f0;
    color: #2d3748;
}

.school-year-badge.current {
    background: #d4edda;
    color: #155724;
}

/* ============================================ */
/* ATTENDANCE STYLES */
/* ============================================ */
/* Attendance status classes for rows */
.attendance-present {
    background-color: #d4edda !important;
    color: #155724 !important;
    border-left: 4px solid #28a745 !important;
}

.attendance-absent {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border-left: 4px solid #dc3545 !important;
    font-weight: bold !important;
}

.attendance-tardy {
    background-color: #fff3cd !important;
    color: #856404 !important;
    border-left: 4px solid #ffc107 !important;
}

.attendance-excused {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
    border-left: 4px solid #17a2b8 !important;
}

/* Attendance status badges */
.attendance-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    display: inline-block;
}

.badge-present {
    background: #28a745;
    color: white;
}

.badge-absent {
    background: #dc3545;
    color: white;
}

.badge-tardy {
    background: #ffc107;
    color: black;
}

.badge-excused {
    background: #17a2b8;
    color: white;
}

/* Attendance table rows */
.attendance-table tr.absent-row {
    background-color: #f8d7da !important;
    font-weight: bold;
}

.attendance-table tr.absent-row td {
    color: #721c24 !important;
}

/* Attendance summary stats */
.attendance-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.attendance-summary-item {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    background: #f8f9fa;
}

.attendance-summary-item .count {
    font-size: 24px;
    font-weight: bold;
}

.attendance-summary-item .label {
    font-size: 12px;
    color: #6c757d;
}

.attendance-summary-item.present {
    background: #d4edda;
}

.attendance-summary-item.absent {
    background: #f8d7da;
}

.attendance-summary-item.tardy {
    background: #fff3cd;
}

.attendance-summary-item.excused {
    background: #d1ecf1;
}

/* Consecutive absences warning */
.consecutive-absences {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.consecutive-absences.warning {
    background: #f8d7da;
    border-left-color: #dc3545;
}

/* ============================================ */
/* CALENDAR STYLES */
/* ============================================ */
.calendar-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-header .month-year {
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
}

.calendar-header .nav-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.calendar-header .nav-btn:hover {
    background: #5a67d8;
    transform: scale(1.02);
    color: white;
    text-decoration: none;
}

.calendar-header .nav-btn.today-btn {
    background: #28a745;
}

.calendar-header .nav-btn.today-btn:hover {
    background: #218838;
}

.calendar-header .nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    max-width: 100%;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: #6c757d;
    padding: 8px 0;
    font-size: 14px;
    background: #f8f9fa;
    border-radius: 6px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
    transition: all 0.2s;
    min-height: 55px;
    position: relative;
    padding: 4px;
}

.calendar-day:hover {
    transform: scale(1.05);
    z-index: 10;
}

.calendar-day .day-number {
    font-size: 16px;
    font-weight: 600;
}

.calendar-day .day-indicator {
    font-size: 10px;
    margin-top: 2px;
}

/* Calendar day status colors */
.calendar-day.present {
    background: #d4edda;
    color: #155724;
}

.calendar-day.present:hover {
    background: #c3e6cb;
}

.calendar-day.absent {
    background: #f8d7da;
    color: #721c24;
    font-weight: bold;
}

.calendar-day.absent:hover {
    background: #f5c6cb;
}

.calendar-day.absent .day-number {
    font-weight: 900;
    color: #dc3545;
}

.calendar-day.tardy {
    background: #fff3cd;
    color: #856404;
}

.calendar-day.tardy:hover {
    background: #ffedb3;
}

.calendar-day.excused {
    background: #d1ecf1;
    color: #0c5460;
}

.calendar-day.excused:hover {
    background: #b8e3e9;
}

.calendar-day.no-data {
    background: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    border: 3px solid #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.calendar-day.today .day-number {
    color: #667eea;
    font-weight: 900;
}

.calendar-day.weekend:not(.no-data) {
    opacity: 0.85;
}

.calendar-day.weekend.no-data {
    background: #f1f3f5;
}

/* Calendar tooltip */
.calendar-day .attendance-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 20;
}

.calendar-day:hover .attendance-tooltip {
    display: block;
}

.calendar-day .attendance-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2d3748;
}

/* Attendance legend */
.attendance-legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.attendance-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Month stats */
.month-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.month-stat-item {
    text-align: center;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 14px;
}

.month-stat-item .stat-count {
    font-weight: 700;
    font-size: 18px;
}

.month-stat-item.present-stat {
    background: #d4edda;
}

.month-stat-item.absent-stat {
    background: #f8d7da;
}

.month-stat-item.tardy-stat {
    background: #fff3cd;
}

.month-stat-item.excused-stat {
    background: #d1ecf1;
}

/* ============================================ */
/* NGSA PERFORMANCE LEVEL BADGES */
/* ============================================ */
.perf-level {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.perf-beginning {
    background: #dc3545;
    color: white;
}

.perf-developing {
    background: #fd7e14;
    color: white;
}

.perf-proficient {
    background: #28a745;
    color: white;
}

.perf-advanced {
    background: #17a2b8;
    color: white;
}

/* ============================================ */
/* ACCESS PROFICIENCY LEVEL BADGES */
/* ============================================ */
.proficiency-level-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.prof-1 {
    background: #dc3545;
    color: white;
}

.prof-2 {
    background: #fd7e14;
    color: white;
}

.prof-3 {
    background: #ffc107;
    color: black;
}

.prof-4 {
    background: #28a745;
    color: white;
}

.prof-5 {
    background: #17a2b8;
    color: white;
}

.prof-6 {
    background: #6f42c1;
    color: white;
}

/* ============================================ */
/* IREADY PLACEMENT BADGES */
/* ============================================ */
.placement-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.placement-below {
    background: #dc3545;
    color: white;
}

.placement-approaching {
    background: #fd7e14;
    color: white;
}

.placement-on {
    background: #28a745;
    color: white;
}

.placement-above {
    background: #17a2b8;
    color: white;
}

.placement-max {
    background: #6f42c1;
    color: white;
}

/* ============================================ */
/* SCHOOL SELECTOR / FILTER */
/* ============================================ */
.school-selector-wrapper {
    background: white;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.school-selector-wrapper select {
    min-width: 250px;
    padding: 8px 15px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.school-selector-wrapper select:hover {
    border-color: #667eea;
}

.school-selector-wrapper select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.filter-badge.all-schools {
    background: #e2e8f0;
    color: #2d3748;
}

.filter-badge.specific-school {
    background: #d4edda;
    color: #155724;
}

.school-logo-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.school-logo-display img {
    max-height: 50px;
    border-radius: 8px;
}

.school-logo-display .default-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    color: white;
    font-size: 24px;
    font-weight: bold;
}

.school-logo-display .school-name {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}

.school-logo-display .school-count {
    font-size: 13px;
    color: #6c757d;
}

.school-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.school-stat-item {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
}

.school-stat-item .grade-name {
    font-weight: 600;
    color: #2d3748;
}

.school-stat-item .grade-count {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

/* ============================================ */
/* IMPORT/CSV UPLOAD STYLES */
/* ============================================ */
.upload-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.drop-zone.dragover {
    border-color: #667eea;
    background: #f0f2ff;
}

.drop-zone i {
    font-size: 3rem;
    color: #667eea;
}

/* Import stats */
.import-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.import-stat-item {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    background: #f8f9fa;
}

.import-stat-item .number {
    font-size: 28px;
    font-weight: bold;
}

.import-stat-item .label {
    font-size: 13px;
    color: #6c757d;
}

.import-stat-item.success .number {
    color: #28a745;
}

.import-stat-item.error .number {
    color: #dc3545;
}

.import-stat-item.matched .number {
    color: #667eea;
}

.import-stat-item.unmatched .number {
    color: #fd7e14;
}

/* Sample data display */
.sample-data {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.sample-data code {
    font-size: 12px;
    color: #2d3748;
}

/* ============================================ */
/* RESPONSIVE ADJUSTMENTS */
/* ============================================ */
@media (max-width: 992px) {
    .sidebar {
        min-height: auto;
        padding-bottom: 20px;
    }
    
    .sidebar .sidebar-header {
        padding: 15px;
    }
    
    .sidebar a {
        padding: 10px 15px;
        margin: 2px 8px;
        font-size: 14px;
    }
    
    .calendar-day {
        font-size: 12px;
        min-height: 40px;
    }
    
    .calendar-day .day-number {
        font-size: 13px;
    }
    
    .calendar-header .month-year {
        font-size: 16px;
    }
    
    .calendar-header .nav-btn {
        padding: 5px 10px;
        font-size: 13px;
    }
    
    .month-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .attendance-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .import-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .school-selector-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .school-selector-wrapper select {
        width: 100%;
        min-width: unset;
    }
    
    .profile-header {
        padding: 20px;
    }
    
    .profile-header .text-end {
        text-align: center !important;
        margin-top: 15px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 15px;
    }
    
    .page-content {
        padding: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .calendar-grid {
        gap: 2px;
    }
    
    .calendar-day {
        font-size: 10px;
        min-height: 30px;
        border-radius: 4px;
    }
    
    .calendar-day .day-number {
        font-size: 11px;
    }
    
    .calendar-day .day-indicator {
        font-size: 8px;
    }
    
    .calendar-header {
        padding: 8px 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .calendar-header .month-year {
        font-size: 14px;
        width: 100%;
        text-align: center;
    }
    
    .attendance-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }
    
    .attendance-summary-item {
        padding: 8px;
    }
    
    .attendance-summary-item .count {
        font-size: 18px;
    }
    
    .month-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    .month-stat-item {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .month-stat-item .stat-count {
        font-size: 14px;
    }
    
    .import-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .import-stat-item {
        padding: 10px;
    }
    
    .import-stat-item .number {
        font-size: 20px;
    }
    
    .school-selector-wrapper {
        padding: 10px 15px;
    }
    
    .school-logo-display {
        flex-direction: column;
        text-align: center;
    }
    
    .drop-zone {
        padding: 20px;
    }
    
    .profile-header h1,
    .profile-header h2 {
        font-size: 1.5rem;
    }
    
    .profile-header .display-4 {
        font-size: 2rem;
    }
}

/* ============================================ */
/* MISC UTILITY CLASSES */
/* ============================================ */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hover-lift {
    transition: transform 0.2s;
}

.hover-lift:hover {
    transform: translateY(-3px);
}

.transition-all {
    transition: all 0.3s ease;
}

.shadow-hover {
    transition: box-shadow 0.3s ease;
}

.shadow-hover:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* School logo in login page */
.login-logo .default-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    color: white;
    font-size: 36px;
    font-weight: bold;
}