/* ============================================
   ATTENDANCE FRONTEND - CLEAN ADMIN STYLE
   ============================================ */

.attendance-frontend-dashboard,
.attendance-frontend-interface,
.attendance-frontend-reports {
    max-width: 1200px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ============================================
   HEADER & LAYOUT COMPONENTS
   ============================================ */

.attendance-header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    border-left: 4px solid #2271b1;
}

.attendance-header h2 {
    margin: 0 0 10px 0;
    color: #23282d;
    font-size: 23px;
    font-weight: 400;
}

.header-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   CARD & GRID LAYOUTS
   ============================================ */

.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.widget {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.widget:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.widget h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #23282d;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

/* ============================================
   REPORTS - STATS GRID FIX
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    border-left: 4px solid #007cba;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 0 !important; /* Remove any conflicting margins */
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #007cba;
    display: block;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card .stat-label {
    color: #646970;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

/* Ensure proper display in reports section */
.report-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.report-section h3 {
    border-bottom: 2px solid #007cba;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* ============================================
   CLASS CARDS & GRIDS
   ============================================ */

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.class-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.class-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.class-card-header {
    background: #2271b1;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.class-card-header h4 {
    margin: 0;
    color: white;
}

.class-code {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.class-card-body {
    padding: 20px;
}

.class-card-body p {
    margin: 8px 0;
    color: #555;
}

.class-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* ============================================
   BUTTON STYLES (Admin Compatible)
   ============================================ */

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid;
    border-radius: 3px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
}

.btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

.btn-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: white;
}

.btn-primary:hover {
    background: #135e96;
    border-color: #135e96;
}

.btn-secondary {
    background: #f6f7f7;
    border-color: #2271b1;
    color: #2271b1;
}

.btn-secondary:hover {
    background: #f0f0f1;
    border-color: #135e96;
    color: #135e96;
}

.btn-success {
    background: #46b450;
    border-color: #46b450;
    color: white;
}

.btn-success:hover {
    background: #3a9541;
    border-color: #3a9541;
}

.btn-danger {
    background: #dc3232;
    border-color: #dc3232;
    color: white;
}

.btn-danger:hover {
    background: #c02a2a;
    border-color: #c02a2a;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-large {
    padding: 12px 24px;
    font-size: 14px;
}

/* ============================================
   ATTENDANCE INTERFACE
   ============================================ */

.attendance-interface {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.session-info {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.session-info h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.attendance-toolbar {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-box input {
    padding-left: 40px;
}

.attendance-stats-bar {
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
    font-weight: 500;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-badge {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.stat-badge.present { background: #198754; }
.stat-badge.late { background: #ffc107; }
.stat-badge.excused { background: #6f42c1; }
.stat-badge.absent { background: #dc3545; }

.stat-item.total {
    margin-left: auto;
    font-weight: 600;
}

/* ============================================
   STUDENT LIST & ITEMS
   ============================================ */

.student-list-frontend {
    max-height: 600px;
    overflow-y: auto;
}

.student-item-frontend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s;
}

.student-item-frontend:hover {
    background-color: #f8f9fa;
}

.student-item-frontend:last-child {
    border-bottom: none;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.student-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0d6efd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
}

.student-details {
    flex: 1;
}

.student-name {
    font-weight: 600;
    color: #212529;
    margin-bottom: 2px;
}

.student-id {
    color: #6c757d;
    font-size: 0.9em;
}

/* ============================================
   ATTENDANCE CONTROLS
   ============================================ */

.attendance-controls {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.attendance-option {
    position: relative;
    cursor: pointer;
}

.attendance-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-label {
    display: inline-block;
    padding: 8px 16px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: #fff;
    color: #495057;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 70px;
    text-align: center;
    cursor: pointer;
}

.attendance-option input:checked + .option-label,
.attendance-option input:focus-visible + .option-label {
    border-color: #0d6efd;
    background: #0d6efd;
    color: white;
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.option-label.present {
    border-color: #198754;
    color: #198754;
}

.attendance-option input:checked + .option-label.present {
    background: #198754;
    border-color: #198754;
    color: white;
}

.option-label.absent {
    border-color: #dc3545;
    color: #dc3545;
}

.attendance-option input:checked + .option-label.absent {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.option-label.late {
    border-color: #ffc107;
    color: #856404;
}

.attendance-option input:checked + .option-label.late {
    background: #ffc107;
    border-color: #ffc107;
    color: #856404;
}

.option-label.excused {
    border-color: #6f42c1;
    color: #6f42c1;
}

.attendance-option input:checked + .option-label.excused {
    background: #6f42c1;
    border-color: #6f42c1;
    color: white;
}

.attendance-actions {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.save-status {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
}

.save-status.saving {
    color: #856404;
    background: #fff3cd;
}

.save-status.success {
    color: #155724;
    background: #d4edda;
}

.save-status.error {
    color: #721c24;
    background: #f8d7da;
}

/* ============================================
   FORM STYLES
   ============================================ */

.attendance-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group label.required::after {
    content: " *";
    color: #dc3232;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.form-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal[aria-hidden="true"] {
    display: none !important;
}

.modal[aria-hidden="false"] {
    display: block !important;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

/* ============================================
   MESSAGES & NOTIFICATIONS
   ============================================ */

.attendance-message {
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.message-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.message-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.message-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.message-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* ============================================
   REPORTS & TABLES
   ============================================ */

.attendance-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.attendance-table th,
.attendance-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f8f9fa;
}

.attendance-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.attendance-table tbody tr:hover {
    background-color: #f8f9fa;
}

.attendance-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.good {
    background: #d1e7dd;
    color: #0f5132;
}

.status-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.status-badge.low {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .attendance-frontend-dashboard,
    .attendance-frontend-interface,
    .attendance-frontend-reports {
        margin: 10px;
        padding: 0;
    }
    
    .attendance-header {
        padding: 15px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .class-grid,
    .dashboard-widgets {
        grid-template-columns: 1fr;
    }
    
    .attendance-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 10px;
    }
    
    .search-box {
        max-width: none;
    }
    
    .student-item-frontend {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .attendance-controls {
        justify-content: center;
    }
    
    .class-actions {
        flex-direction: column;
    }
    
    .attendance-stats-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .stat-item.total {
        margin-left: 0;
    }
    
    .header-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .attendance-header h2 {
        font-size: 1.3em;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .student-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .option-label {
        min-width: 60px;
        padding: 6px 12px;
        font-size: 0.85em;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-success { color: #198754; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }
.text-info { color: #0dcaf0; }

.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    visibility: visible;
    float: none;
    margin: 0 0 0 5px;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .class-card,
    .student-item-frontend,
    .attendance-option .option-label,
    .modal-content {
        transition: none !important;
    }
    
    .loading::after {
        animation: none !important;
    }
    
    @keyframes modalSlideIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

.form-control:focus,
.btn:focus-visible,
.attendance-option input:focus-visible + .option-label {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.action-buttons .btn-premium {
    display: inline-block !important;
    width: auto !important;
    align-self: center;
}


