/* ============================================
   ATTENDANCE FRONTEND - MAIN STYLES
   ============================================ */

.attendance-frontend-dashboard,
.attendance-frontend-interface,
.attendance-frontend-reports {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    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 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.attendance-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8em;
}

/* ============================================
   DASHBOARD WIDGETS & STATS
   ============================================ */

.dashboard-widgets {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.widget {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.widget:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat {
    text-align: center;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.stat:hover {
    border-color: #3498db;
    transform: translateY(-2px);
}

.stat .number {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.stat .label {
    color: #6c757d;
    font-size: 0.9em;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
}

.btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219653;
    transform: translateY(-1px);
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
}

.btn-large {
    padding: 12px 24px;
    font-size: 1.1em;
    font-weight: 600;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   CLASS CARDS & GRIDS
   ============================================ */

.class-cards,
.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.class-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border-left: 4px solid #3498db;
}

.class-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.class-info {
    flex: 1;
}

.class-info h4 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 1.2em;
}

.class-code {
    background: #ecf0f1;
    color: #7f8c8d;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    margin-bottom: 5px;
}

.class-schedule {
    color: #7f8c8d;
    font-size: 0.9em;
    margin: 5px 0 0 0;
    line-height: 1.4;
}

.class-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================
   ATTENDANCE INTERFACE
   ============================================ */

.attendance-interface {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

.session-info {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.session-details h3 {
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.session-meta {
    color: #6c757d;
    font-size: 0.9em;
}

.session-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.session-stat {
    text-align: center;
}

.session-stat .number {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: #3498db;
}

.session-stat .label {
    color: #6c757d;
    font-size: 0.8em;
}

.attendance-toolbar {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    background: #f8f9fa;
}

.search-box {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
    position: relative;
}

.search-box .form-control {
    padding-left: 40px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
}

.bulk-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.attendance-stats {
    padding: 12px 20px;
    background: #e8f4fd;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-weight: 500;
    color: #2c3e50;
}

.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: #27ae60; }
.stat-badge.late { background: #f39c12; }
.stat-badge.absent { background: #e74c3c; }
.stat-badge.excused { background: #9b59b6; }

/* ============================================
   STUDENT LIST & ITEMS
   ============================================ */

.student-list-frontend {
    max-height: 500px;
    overflow-y: auto;
}

.student-item-frontend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    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: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
    flex-shrink: 0;
}

.student-details {
    flex: 1;
}

.student-details .student-name {
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 2px 0;
    font-size: 1em;
}

.student-details .student-id {
    color: #7f8c8d;
    font-size: 0.9em;
    margin: 0;
}

/* ============================================
   ATTENDANCE CONTROLS
   ============================================ */

.attendance-controls {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.attendance-option {
    cursor: pointer;
    position: relative;
}

.attendance-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-label {
    display: inline-block;
    padding: 8px 16px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    background: #fff;
    color: #6c757d;
    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: #3498db;
    background: #3498db;
    color: white;
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.option-label.present {
    border-color: #27ae60;
    color: #27ae60;
}

.attendance-option input:checked + .option-label.present {
    background: #27ae60;
    border-color: #27ae60;
    color: white;
}

.option-label.absent {
    border-color: #e74c3c;
    color: #e74c3c;
}

.attendance-option input:checked + .option-label.absent {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.option-label.late {
    border-color: #f39c12;
    color: #f39c12;
}

.attendance-option input:checked + .option-label.late {
    background: #f39c12;
    border-color: #f39c12;
    color: white;
}

.option-label.excused {
    border-color: #9b59b6;
    color: #9b59b6;
}

.attendance-option input:checked + .option-label.excused {
    background: #9b59b6;
    border-color: #9b59b6;
    color: white;
}

.attendance-actions {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.save-status {
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: 500;
    min-width: 200px;
    text-align: center;
}

.save-status.saving {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.save-status.success {
    background: #d1edff;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.save-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================
   REPORTS & ANALYTICS
   ============================================ */

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    transition: all 0.3s ease;
    border-top: 4px solid #3498db;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-card .stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
    display: block;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.9em;
    font-weight: 500;
}

.attendance-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.attendance-table th,
.attendance-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.attendance-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.attendance-table tbody tr:hover {
    background-color: #f8f9fa;
}

.attendance-table tbody tr:last-child td {
    border-bottom: none;
}

.attendance-percent {
    font-weight: 600;
}

.attendance-percent.good {
    color: #27ae60;
}

.attendance-percent.warning {
    color: #e74c3c;
}

.attendance-percent.low {
    color: #f39c12;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    display: inline-block;
    text-align: center;
    min-width: 60px;
}

.status-badge.good {
    background: #d5f4e6;
    color: #27ae60;
}

.status-badge.warning {
    background: #fadbd8;
    color: #e74c3c;
}

.status-badge.low {
    background: #fef5e7;
    color: #f39c12;
}

.status-badge.excused {
    background: #f4ecf7;
    color: #9b59b6;
}

/* ============================================
   MESSAGES & ALERTS
   ============================================ */

.attendance-login-required,
.attendance-permission-denied,
.attendance-error,
.no-classes,
.no-students {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    margin: 20px 0;
}

.attendance-login-required h3,
.attendance-permission-denied h3 {
    color: #e74c3c;
    margin-top: 0;
    margin-bottom: 15px;
}

.attendance-message {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 6px;
    border-left: 4px solid;
    font-weight: 500;
}

.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;
}

/* ============================================
   FORM CONTROLS
   ============================================ */

.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;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group label.required::after {
    content: " *";
    color: #e74c3c;
}

.form-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .attendance-frontend-dashboard,
    .attendance-frontend-interface,
    .attendance-frontend-reports {
        padding: 15px;
    }
    
    .attendance-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 15px;
    }
    
    .dashboard-widgets {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .class-cards,
    .class-grid {
        grid-template-columns: 1fr;
    }
    
    .class-card {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        text-align: center;
    }
    
    .class-actions {
        justify-content: center;
    }
    
    .attendance-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .search-box {
        max-width: none;
    }
    
    .bulk-actions {
        justify-content: center;
    }
    
    .student-item-frontend {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        text-align: center;
    }
    
    .student-info {
        justify-content: center;
        text-align: center;
    }
    
    .attendance-controls {
        justify-content: center;
    }
    
    .attendance-table {
        font-size: 0.9em;
    }
    
    .attendance-table th,
    .attendance-table td {
        padding: 8px 10px;
    }
    
    .stats-summary {
        grid-template-columns: 1fr;
    }
    
    .session-info {
        flex-direction: column;
        text-align: center;
    }
    
    .session-stats {
        justify-content: center;
    }
    
    .attendance-stats {
        justify-content: center;
        text-align: center;
    }
    
    .action-buttons {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .attendance-header h2 {
        font-size: 1.5em;
    }
    
    .widget {
        padding: 15px;
    }
    
    .option-label {
        min-width: 60px;
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .attendance-controls {
        gap: 3px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
    
    .btn-large {
        padding: 10px 20px;
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .widget,
    .stat,
    .class-card,
    .stat-card,
    .btn,
    .option-label {
        transition: none !important;
        transform: none !important;
    }
}

@media (prefers-contrast: high) {
    .btn {
        border: 2px solid;
    }
    
    .form-control {
        border: 2px solid;
    }
    
    .option-label {
        border: 2px solid;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus-visible,
.form-control:focus-visible,
.attendance-option input:focus-visible + .option-label {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .btn,
    .attendance-actions,
    .action-buttons {
        display: none !important;
    }
    
    .attendance-frontend-dashboard,
    .attendance-frontend-interface,
    .attendance-frontend-reports {
        padding: 0;
        margin: 0;
        max-width: none;
    }
    
    .widget,
    .class-card,
    .attendance-interface,
    .stat-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}