/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #f9f9fb;
    font-weight: 400;
}

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 12px, rgba(0, 0, 0, 0.1) 0px 8px 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: #dbeafe;
    border-radius: 50%;
    color: #2563eb;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #6b7280;
    font-size: 1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.75rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
    font-family: 'Inter', sans-serif;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.full-width-group {
    grid-column: 1 / -1; /* Span all columns */
}

.checkbox-list-table {
    width: 100%;
    margin-bottom: 0.5rem;
}

.checkbox-list-header {
    display: flex;
    font-weight: 600;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.95rem;
}

.checkbox-col-id {
    flex: 0 0 90px;
    min-width: 90px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.checkbox-col-name {
    flex: 1 1 120px;
    min-width: 120px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.checkbox-col-email {
    flex: 2 1 180px;
    min-width: 180px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.checkbox-col-select {
    flex: 0 0 70px;
    min-width: 70px;
    text-align: center;
}

.checkbox-list-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 0;
    background: white;
}

.checkbox-item-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.checkbox-item-row:hover {
    background-color: #f9fafb;
}

.checkbox-item-row:last-child {
    border-bottom: none;
}
.checkbox-item-id {
    flex: 0 0 90px;
    min-width: 90px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
    font-size: 0.85em;
}
.checkbox-item-name {
    flex: 1 1 120px;
    min-width: 120px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.checkbox-item-email {
    flex: 2 1 180px;
    min-width: 180px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.checkbox-item-select {
    flex: 0 0 70px;
    min-width: 70px;
    text-align: center;
}

.checkbox-item-select label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.checkbox-item-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid #d1d5db;
    cursor: pointer;
}

button {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 12px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
}

.primary-btn, #loginButton {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: rgba(37, 99, 235, 0.2) 0px 4px 12px;
}

.primary-btn:hover, #loginButton:hover {
    transform: translateY(-2px);
    box-shadow: rgba(37, 99, 235, 0.3) 0px 8px 20px;
}

.secondary-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.secondary-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

#loginButton {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
}

#loginButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    border: 2px solid #f3f4f6;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

.spinner.large {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.demo-info p {
    margin: 0;
    line-height: 1.5;
}

.admin-container {
    min-height: 100vh;
    background-color: #f9f9fb;
}

.admin-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 3px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-section .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border-radius: 12px;
    color: #2563eb;
    transition: transform 0.2s ease;
}

.logo-section .logo:hover {
    transform: scale(1.05);
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-email {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
}

.logout-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
}

.tab-container {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
}

.tab-button {
    background: transparent;
    color: #6b7280;
    border: none;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 120px;
    justify-content: center;
}

.tab-button:hover {
    background: #f9fafb;
    color: #374151;
    transform: translateY(-1px);
}

.tab-button.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: rgba(37, 99, 235, 0.2) 0px 4px 12px;
}

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 12px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: rgba(0, 0, 0, 0.08) 0px 8px 24px;
}

.stat-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-info h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    color: white;
    font-size: 1.5rem;
}

.stat-icon.teachers {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.stat-icon.students {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.classes {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.section-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 12px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.section-card:hover {
    box-shadow: rgba(0, 0, 0, 0.08) 0px 8px 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.section-header h1,
.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.section-header p {
    color: #6b7280;
    margin-top: 0.25rem;
    font-size: 0.95rem;
}

.section-header > div h1 {
    margin-bottom: 0.25rem;
}

.section-subtitle {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

form {
    margin-top: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}

.table-container {
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 2px 8px;
}

.data-table th {
    background: #f8fafc;
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1f2937;
    font-size: 0.95rem;
}

.data-table tbody tr:hover {
    background: #f9fafb;
    transition: background-color 0.2s ease;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

.empty-state svg {
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.95rem;
    color: #6b7280;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 8px 24px;
}

.message-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1001;
    max-width: 400px;
}

.message {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 8px 24px;
    border-left: 4px solid #10b981;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message.success {
    border-left-color: #10b981;
}

.message.error {
    border-left-color: #ef4444;
}

.message-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.message-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-weight: 600;
    font-size: 0.9rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.green {
    background: #d1fae5;
    color: #065f46;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }

    .tab-nav {
        overflow-x: auto;
        padding: 0.75rem 0;
    }

    .tab-button {
        min-width: 100px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem;
    }

    .message-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .section-card {
        padding: 1.5rem;
    }

    .section-header,
    .form-actions {
        gap: 0.75rem;
    }
}

/* Focus styles for accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stat-card,
    .section-card {
        border: 2px solid #374151;
    }

    .tab-button.active {
        border: 2px solid #1d4ed8;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Additional styles for existing components */
.attendance-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.attendance-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.attendance-item:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.attendance-item .student-name {
    font-weight: 500;
    color: #1f2937;
}

.attendance-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.attendance-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.attendance-toggle .toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 24px;
    font-size: 0.85em;
    padding-left: 0.3em;
    padding-right: 0.3em;
    vertical-align: middle;
}

.attendance-toggle input:checked + .toggle-label {
    background-color: #10b981;
}

.attendance-toggle input:not(:checked) + .toggle-label {
    background-color: #d1d5db;
}

.search-bar-container {
    margin-bottom: 1.5rem;
    position: relative;
}

.search-bar {
    width: 100%;
    padding: 0.875rem 1.125rem 0.875rem 2.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.search-bar:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.student-info-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.student-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-weight: 600;
    font-size: 0.85rem;
}

.student-info-text {
    display: flex;
    flex-direction: column;
}

.student-name {
    font-weight: 500;
    color: #1f2937;
}

.student-role {
    font-size: 0.85rem;
    color: #6b7280;
}

.student-email {
    color: #6b7280;
    font-size: 0.9rem;
}

.email-icon {
    color: #9ca3af;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.class-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.class-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 12px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
    cursor: pointer;
}

.class-card:hover {
    transform: translateY(-4px);
    box-shadow: rgba(0, 0, 0, 0.08) 0px 8px 24px;
}

.class-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.class-card-meta {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.class-card-room {
    color: #2563eb;
    font-weight: 500;
    font-size: 0.9rem;
}

.class-card-select-btn {
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
}

.attendance-details-section {
    margin-top: 2rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.attendance-insight-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 12px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.attendance-insight-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.attendance-insight-summary {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
}

.attendance-insight-summary.green { color: #22c55e; }
.attendance-insight-summary.red { color: #ef4444; }
.attendance-insight-summary.yellow { color: #eab308; }

.attendance-mini-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 8px;
    height: 60px;
    margin-top: 0.75rem;
    align-items: center;
}

.attendance-bar {
    width: 100%;
    border-radius: 4px;
    background: #e5e7eb;
    transition: all 0.3s ease;
    min-height: 4px;
}

.attendance-bar.green { background: #22c55e; }
.attendance-bar.red { background: #ef4444; }
.attendance-bar.yellow { background: #eab308; }

.attendance-bar-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
    text-align: center;
}