* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Bootstrap overrides */
.navbar {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color) !important;
}

.nav-tabs {
    border-bottom: 2px solid var(--border-color) !important;
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    font-weight: 600;
    border: none;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color) !important;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
}

.form-control, .form-select {
    border: 1px solid var(--border-color) !important;
    padding: 10px 12px;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 1px solid var(--border-color) !important;
}

/* Page Management */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Admin Tab Styles */
#adminTabs {
    position: relative;
    z-index: 10;
}

.tab-pane {
    display: none;
    position: relative;
    width: 100%;
}

.tab-pane.show,
.tab-pane.active {
    display: block !important;
}

#studentsTab.show.active,
#teachersTab.show.active {
    display: block !important;
    visibility: visible !important;
}

#adminStudentForm {
    width: 100%;
}

/* Responsive spacing for Students Tab */
#studentsTab {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
#studentsTab .row {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
#studentsTab .card {
    margin-bottom: 0 !important;
}

/* Auth Page Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.auth-logo {
    font-size: 64px;
    margin-bottom: 20px;
}

.auth-header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 16px;
    opacity: 0.9;
}

.auth-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.3s ease-out;
}

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

.auth-box h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 8px;
}

/* Password visibility toggle */
.input-group .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--text-secondary);
    background-color: transparent;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.input-group .btn-outline-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}

.input-group .btn-outline-secondary:active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.password-toggle-icon {
    font-size: 18px;
}

.form-section {
    display: none;
}

.form-section.active {
    display: block;
}

.form-section h2 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 24px;
}

.form-subtitle {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 14px;
}

.form-section input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-section input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.password-input-wrapper input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    margin-bottom: 0;
}

.password-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.dropdown-list {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.info-box {
    margin-top: 20px;
    padding: 12px 14px;
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    padding: 8px 16px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-left: 10px;
}

.btn-secondary:hover {
    background-color: #475569;
}

.form-toggle {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.form-toggle a {
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.form-toggle a:hover {
    text-decoration: underline;
}

.info-text {
    margin-top: 15px;
    padding: 12px;
    background-color: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.pending-icon {
    font-size: 64px;
    text-align: center;
    margin-bottom: 20px;
}

#pendingApproval {
    text-align: center;
}

#pendingApproval h2 {
    color: var(--warning-color);
    margin-bottom: 15px;
}

#pendingApproval p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    padding: 20px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 3px solid var(--primary-color);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.navbar h2 {
    color: var(--primary-color);
    font-size: 24px;
    margin: 0;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: #f0f9ff;
    border-radius: 20px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 14px;
}

.user-avatar {
    font-size: 18px;
}

.btn-logout {
    padding: 8px 16px;
    background-color: #fee2e2;
    color: #991b1b;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-logout:hover {
    background-color: #fecaca;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* Statistics Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-align: center;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.stat-card h3 {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
    position: relative;
    bottom: -2px;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 20px;
}

.section-header h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.section-header input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    flex-grow: 1;
    max-width: 350px;
    transition: all 0.3s;
}

.section-header input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.form-grid input,
.form-grid select {
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-grid input:focus,
.form-grid select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* List Container */
.list-container {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.list-item {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
}

.list-item:hover {
    background-color: #fafbfc;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.list-item-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.list-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.list-item-detail {
    display: flex;
    flex-direction: column;
}

.list-item-detail strong {
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 600;
}

/* Users List (Admin Panel) */
.users-list {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.user-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-item:last-child {
    border-bottom: none;
}

.user-info h4 {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.user-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.user-actions {
    display: flex;
    gap: 10px;
}

.btn-approve {
    padding: 8px 16px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-approve:hover {
    background-color: #059669;
}

.btn-reject {
    padding: 8px 16px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-reject:hover {
    background-color: #dc2626;
}

.btn-remove {
    padding: 8px 16px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-remove:hover {
    background-color: #dc2626;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background-color: #dbeafe;
    color: #1e40af;
}

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

/* Attendance specific */
.attendance-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.attendance-item:last-child {
    border-bottom: none;
}

.attendance-buttons {
    display: flex;
    gap: 10px;
}

.btn-present {
    padding: 8px 20px;
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-present:hover {
    background-color: #059669;
}

.btn-absent {
    padding: 8px 20px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-absent:hover {
    background-color: #dc2626;
}

.btn-present.marked,
.btn-absent.marked {
    opacity: 1;
    font-weight: 600;
}

.btn-present:not(.marked),
.btn-absent:not(.marked) {
    opacity: 0.5;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-present {
    background-color: #d1fae5;
    color: #065f46;
}

.status-absent {
    background-color: #fee2e2;
    color: #991b1b;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Auth Page Responsive */
    .auth-container {
        padding: 20px 15px;
        min-height: 100vh;
    }

    .auth-header {
        margin-bottom: 30px;
    }

    .auth-logo {
        font-size: 48px;
        margin-bottom: 15px;
    }

    .auth-header h1 {
        font-size: 28px;
    }

    .auth-header p {
        font-size: 14px;
    }

    .auth-box {
        padding: 30px 20px;
        max-width: 100%;
        width: 100%;
    }

    .auth-box h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    /* Dashboard Responsive */
    .navbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .navbar h2 {
        font-size: 20px;
        text-align: center;
    }

    .nav-right {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .user-badge {
        justify-content: center;
        width: 100%;
    }

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

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .section-header input {
        width: 100%;
        max-width: 100%;
    }

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

    .list-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .list-item-details {
        grid-template-columns: 1fr;
    }

    .user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .attendance-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .attendance-buttons {
        width: 100%;
    }

    .attendance-buttons button {
        width: 100%;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-control-sm {
        max-width: 100% !important;
    }
}
/* Extra Small Devices (max 480px) */
@media (max-width: 480px) {
    .auth-container {
        padding: 15px 10px;
    }

    .auth-logo {
        font-size: 40px;
        margin-bottom: 10px;
    }

    .auth-header h1 {
        font-size: 24px;
        margin-bottom: 5px;
    }

    .auth-header p {
        font-size: 13px;
    }

    .auth-box {
        padding: 20px 15px;
        border-radius: 8px;
    }

    .auth-box h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .form-label {
        font-size: 13px;
    }

    .form-control {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 14px;
    }

    .error-message {
        font-size: 12px;
    }
}

/* Mobile Dashboard Dropdown Styles */
.stat-card-sm {
    background: var(--card-bg);
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    text-align: center;
    border-left: 3px solid var(--primary-color);
    transition: all 0.2s ease;
}

.stat-card-sm:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.stat-card-sm h6 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card-sm small {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
}

.stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background-color: #f0f9ff;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    white-space: nowrap;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
}

.stat-value {
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 700;
}

.nav-link-sm {
    padding: 0.5rem 0.75rem !important;
    font-size: 13px !important;
    font-weight: 600;
}

/* Mobile menu styles */
#mobileMenu {
    animation: slideDown 0.3s ease-in-out;
}

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

/* iPhone/Small phones (max 480px) */
@media (max-width: 480px) {
    #studentsTab {
        margin-top: 1rem !important;
    }
}

/* Tablets (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    #studentsTab {
        margin-top: 1rem !important;
    }
}

/* Laptops/Desktops (769px+) */
@media (min-width: 769px) {
    #studentsTab {
        margin-top: 1rem !important;
    }
}

/* Mobile Navigation Styles */
#mobileMenu .nav-link {
    padding: 0.75rem 1rem !important;
    color: var(--text-primary) !important;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#mobileMenu .nav-link:hover {
    background-color: #f0f9ff !important;
    color: var(--primary-color) !important;
    border-left: 3px solid var(--primary-color);
    padding-left: calc(1rem - 3px) !important;
}

#mobileMenu .nav-link.active {
    background-color: #f0f9ff;
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    padding-left: calc(1rem - 3px) !important;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .navbar {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .navbar-brand {
        font-size: 16px;
    }
    
    #mobileMenu {
        padding-top: 0.5rem;
    }
}