/* EH Attendance Plugin - Mobile-First Styles */

/* Main Container */
.eh-attendance-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    background: #fff;
}

.eh-attendance-container h2 {
    margin: 0 0 20px;
    font-size: 22px;
    color: #1e293b;
    text-align: center;
}

/* Group Selector */
.eh-attendance-group-selector {
    margin-bottom: 24px;
}

.eh-attendance-group-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 15px;
}

.eh-attendance-dropdown {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    color: #1f2937;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
}

.eh-attendance-dropdown:focus {
    outline: none;
    border-color: #3b82f6;
}

/* No Students Message */
.eh-no-students {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 15px;
    font-style: italic;
}

/* Controls (Select All button) */
.eh-attendance-controls {
    margin-bottom: 16px;
}

.eh-select-all-btn {
    width: 100%;
    padding: 12px 20px;
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.eh-select-all-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.eh-select-all-btn:active {
    transform: scale(0.98);
}

/* Students List */
.eh-students-list {
    margin-bottom: 20px;
}

/* Student Row */
.eh-student-row {
    display: flex;
    align-items: center;
    padding: 16px;
    margin-bottom: 2px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    user-select: none;
    min-height: 60px;
}

.eh-student-row:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.eh-student-row:active {
    transform: scale(0.99);
}

/* Checked State - Using both class and CSS selector */
.eh-student-row.checked {
    background: #d1fae5 !important;
    border-color: #10b981 !important;
}

.eh-student-row.checked:hover {
    background: #a7f3d0 !important;
}

/* Update the ::before when checked */
.eh-student-row.checked::before {
    background: #10b981 !important;
    border-color: #10b981 !important;
}

/* Hide default checkbox visually but keep it functional */
.eh-attendance-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 100%;
    width: 100%;
    left: 0;
    top: 0;
    margin: 0;
    z-index: 5;
}

/* When checkbox is checked via label */
.eh-attendance-checkbox:checked ~ .eh-student-name {
    color: #065f46;
}

.eh-attendance-checkbox:checked ~ .eh-checkmark {
    display: block !important;
}

/* Custom Checkbox */
.eh-student-row::before {
    content: '';
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 2px solid #9ca3af;
    border-radius: 6px;
    background: #fff;
    margin-right: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
    pointer-events: none;
}



/* Student Name */
.eh-student-name {
    flex: 1;
    font-size: 16px;
    color: #1f2937;
    font-weight: 500;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.eh-student-row.checked .eh-student-name {
    color: #065f46;
}

/* Checkmark Icon */
.eh-checkmark {
    display: none;
    font-size: 20px;
    color: #10b981;
    font-weight: bold;
    margin-left: auto;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.eh-student-row.checked .eh-checkmark {
    display: block;
}

/* Submit Button */
.eh-attendance-submit {
    margin-top: 24px;
}

.eh-submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.eh-submit-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.eh-submit-btn:active {
    transform: translateY(0);
}

.eh-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Success Message */
.eh-success-message {
    padding: 16px;
    margin-bottom: 20px;
    background: #d1fae5;
    border: 2px solid #10b981;
    border-radius: 8px;
    color: #065f46;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Error Message */
.eh-error-message {
    padding: 16px;
    margin-bottom: 20px;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #991b1b;
    font-weight: 500;
    text-align: center;
}

/* Loading State */
.eh-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 15px;
}

.eh-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Button Loading State */
.eh-submit-btn.loading {
    position: relative;
    color: transparent;
}

.eh-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Tablet and Desktop (optional wider layout) */
@media (min-width: 600px) {
    .eh-attendance-container {
        padding: 24px;
    }

    .eh-attendance-container h2 {
        font-size: 26px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .eh-student-row {
        padding: 14px 12px;
    }

    .eh-student-name {
        font-size: 15px;
    }

    .eh-student-row::before {
        width: 24px;
        height: 24px;
        margin-right: 10px;
    }
}