/* Quran Tracking System Styles */

/* Import the League Spartan font */
@font-face {
    font-family: 'League Spartan';
    src: url('../fixed-study-tracker/LeagueSpartan-VariableFont_wght.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* CSS Variables - Green Theme */
:root {
    --primary-color: #2e7d32;
    --secondary-color: #1b5e20;
    --accent-color: #4caf50;
    --background-color: #f1f8e9;
    --card-background: #ffffff;
    --text-color: #2e7d32;
    --border-color: #c8e6c9;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --shadow: 0 4px 20px rgba(46, 125, 50, 0.1);
    --shadow-hover: 0 8px 30px rgba(46, 125, 50, 0.15);
    --gradient-primary: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    --gradient-secondary: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    --islamic-pattern: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(76, 175, 80, 0.1) 10px, rgba(76, 175, 80, 0.1) 20px);
    --islamic-pattern-2: repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(46, 125, 50, 0.05) 15px, rgba(46, 125, 50, 0.05) 30px);
    --islamic-border: repeating-linear-gradient(45deg, var(--accent-color), var(--accent-color) 2px, transparent 2px, transparent 8px);
}

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

body {
    font-family: 'League Spartan', Arial, sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: var(--islamic-pattern), var(--islamic-pattern-2);
    background-size: 100px 100px, 60px 60px;
    background-position: 0 0, 30px 30px;
    transition: all 0.3s ease;
}

/* RTL Support for Arabic */
body[dir="rtl"] {
    text-align: right;
}

body[dir="rtl"] .content-card h3,
body[dir="rtl"] .content-card p,
body[dir="rtl"] .content-card h4 {
    direction: rtl;
    text-align: center;
}

body[dir="rtl"] .dashboard-header {
    flex-direction: row-reverse;
}

body[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

body[dir="rtl"] .user-info {
    flex-direction: row-reverse;
}

/* Removed RTL direction from top-cards to prevent layout issues */

body[dir="rtl"] .content-item,
body[dir="rtl"] .session-item {
    flex-direction: row-reverse;
}

body[dir="rtl"] .modal-content {
    text-align: right;
}

body[dir="rtl"] .form-group {
    text-align: right;
}

body[dir="rtl"] .modal-actions {
    flex-direction: row-reverse;
}

body[dir="rtl"] .admin-actions {
    direction: rtl;
}

body[dir="rtl"] .login-header {
    right: 20px; /* Keep it on the right to avoid container shifting */
    left: auto;
}

/* Fix login container positioning for RTL */
body[dir="rtl"] .login-container {
    direction: ltr; /* Force LTR for layout stability */
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
}

body[dir="rtl"] .login-card {
    direction: ltr; /* Force LTR for layout stability */
    text-align: center; /* Ensure center alignment */
    margin: 0 auto;
}

/* Arabic Font Support */
body[dir="rtl"] {
    font-family: 'Arial', 'Tahoma', 'Segoe UI', sans-serif;
}

body[dir="rtl"] h1,
body[dir="rtl"] h2,
body[dir="rtl"] h3,
body[dir="rtl"] h4,
body[dir="rtl"] h5,
body[dir="rtl"] h6 {
    font-family: 'Arial', 'Tahoma', 'Segoe UI', sans-serif;
}

/* Login Section */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Login Header */
.login-header {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.login-card {
    background: var(--card-background);
    padding: 50px;
    border-radius: 25px;
    box-shadow: 0 25px 50px rgba(46, 125, 50, 0.3);
    text-align: center;
    max-width: 450px;
    width: 90%;
    border: 3px solid var(--accent-color);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--islamic-pattern);
    opacity: 0.1;
    z-index: -1;
}

.login-card::after {
    content: '☪';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: var(--accent-color);
    opacity: 0.2;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.login-card h2 {
    color: var(--primary-color);
    margin-bottom: 35px;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 25px;
}

/* Surah Selection Container */
.surah-selection-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.surah-selection-container select {
    flex: 1;
    min-width: 150px;
}

.form-group input {
    width: 100%;
    padding: 18px 20px;
    border: 3px solid var(--border-color);
    border-radius: 15px;
    font-size: 16px;
    font-family: 'League Spartan', Arial, sans-serif;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(43, 93, 138, 0.1);
    transform: translateY(-2px);
}

.login-btn {
    background: var(--gradient-secondary);
    color: white;
    border: none;
    padding: 18px 35px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'League Spartan', Arial, sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.4);
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(240, 147, 251, 0.6);
}

/* Dashboard Section */
.dashboard-container {
    min-height: 100vh;
    background: var(--background-color);
}

/* Header */
.dashboard-header {
    background: var(--gradient-primary);
    color: white;
    padding: 25px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.1) 100%);
    animation: shimmer 15s ease-in-out infinite;
}

.dashboard-header::after {
    content: '☪ 📖 ☪';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 20px;
    animation: fadeInOut 4s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.user-info {
    display: flex;
    gap: 35px;
    font-size: 18px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.user-info span {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 20px;
    border-radius: 25px;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

/* Special styling for editing mode */
.user-info .editing-mode {
    background: rgba(255, 193, 7, 0.25) !important;
    border-color: rgba(255, 193, 7, 0.5) !important;
    color: #ffc107 !important;
    font-weight: bold;
}

/* Special styling for dashboard mode */
.user-info .dashboard-mode {
    background: rgba(52, 152, 219, 0.25) !important;
    border-color: rgba(52, 152, 219, 0.5) !important;
    color: #3498db !important;
    font-weight: bold;
}

.user-info span:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

/* Language Toggle Button */
.language-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    min-width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Arial', sans-serif;
}

.language-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.language-toggle-btn.active {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.6);
    color: #4caf50;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(15px);
    position: relative;
    z-index: 1;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Main Content */
.main-content {
    padding: 50px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Top Cards Row */
.top-cards {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    margin-bottom: 50px;
    width: 100%;
    box-sizing: border-box;
    direction: ltr; /* Force LTR for layout */
    min-height: 450px; /* Increased minimum height */
    align-items: stretch; /* Ensure cards stretch to fill height */
}

.content-card {
    background: var(--card-background);
    border: 3px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    min-height: 450px; /* Increased minimum height */
    position: relative;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

/* Leaderboard Card Specific Styling */
.leaderboard-card {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border: 3px solid #ffc107;
}

.leaderboard-content {
    margin-top: 20px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    border: 2px solid rgba(255, 193, 7, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 193, 7, 0.6);
    transform: translateY(-2px);
}

.leaderboard-item.current-user {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
    border-color: #1b5e20;
}

.leaderboard-rank {
    font-weight: bold;
    font-size: 1.2em;
    min-width: 30px;
}

.leaderboard-rank.first {
    color: #ffd700;
}

.leaderboard-rank.second {
    color: #c0c0c0;
}

.leaderboard-rank.third {
    color: #cd7f32;
}

.leaderboard-name {
    flex: 1;
    margin: 0 12px;
    font-weight: 500;
}

.leaderboard-points {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--primary-color);
}

.leaderboard-item.current-user .leaderboard-points {
    color: white;
}
    overflow: hidden;
    direction: ltr; /* Force LTR for layout */
    display: flex;
    flex-direction: column;
    height: 100%; /* Fill available height */
}

.content-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-secondary);
}

.content-card::after {
    content: '☪';
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    color: var(--accent-color);
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.5; }
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.content-card h3 {
    font-size: 26px;
    margin-bottom: 25px;
    color: var(--primary-color);
    text-align: center;
    font-weight: bold;
    position: relative;
}

.content-card h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-secondary);
    border-radius: 2px;
}

.content-items {
    min-height: 220px;
}

/* Assignment-style items (like .upassign from study tracker) */
.content-item {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    padding: 18px 0;
    border: none;
    margin-top: 18px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    background: var(--card-background);
    transition: all 0.3s ease-in-out;
    backdrop-filter: blur(5px);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.content-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--islamic-border);
    background-size: 8px 4px;
    transition: all 0.3s ease;
}

.content-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-hover);
    background: linear-gradient(135deg, #f1f8e9, #e8f5e8);
    border-color: var(--primary-color);
}

.content-item:hover::before {
    width: 8px;
}

.content-item h4 {
    font-family: 'League Spartan';
    font-size: 22px;
    margin: 0;
    padding: 0 20px;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    color: var(--text-color);
    font-weight: 600;
}

/* Delete button for content items */
.delete-btn {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--danger-color);
    color: white;
    border: none;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

/* Teacher delete buttons are always visible */
.teacher-delete-btn {
    opacity: 1 !important;
}

/* Move button for content items */
.move-btn {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--success-color);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

/* Teacher move buttons are always visible */
.teacher-move-btn {
    opacity: 1 !important;
}

.move-btn:hover {
    background: #2e7d32;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

/* Only show delete button on hover for regular users */
.content-item:hover .delete-btn:not(.teacher-delete-btn),
.session-item:hover .delete-btn:not(.teacher-delete-btn) {
    opacity: 1;
}

.delete-btn:hover {
    background: #d32f2f;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4);
}

/* Signup link styling */
.signup-link {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.signup-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    color: white;
}

/* Add Content Button */
.add-content-btn {
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-secondary);
    color: white;
    border: none;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    transition: all 0.3s ease;
}

.add-content-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.6);
}

/* Mobile touch improvements */
@media (max-width: 768px) {
    .add-content-btn {
        width: 70px;
        height: 70px;
        font-size: 32px;
        bottom: 20px;
        right: 20px;
        /* Better touch target size */
        min-height: 44px; /* iOS recommended minimum */
        min-width: 44px;
    }
    
    .add-content-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Prevent text selection on mobile */
    .add-content-btn {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Ensure teacher buttons are always visible */
.teacher-mode .add-content-btn {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Past Sessions Card (like .settings-card from study tracker) */
.past-sessions-card {
    background: var(--card-background);
    border: 3px solid var(--border-color);
    border-radius: 20px;
    padding: 35px;
    min-height: 450px;
    position: relative;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.past-sessions-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-primary);
}

.past-sessions-card::after {
    content: '📖';
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 28px;
    color: var(--accent-color);
    opacity: 0.3;
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.past-sessions-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.past-sessions-card h3 {
    font-size: 30px;
    margin-bottom: 30px;
    color: var(--primary-color);
    text-align: center;
    font-weight: bold;
    position: relative;
}

.past-sessions-card h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.sessions-list {
    min-height: 320px;
}

/* Session Item (assignment-style) */
.session-item {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    padding: 18px 0;
    border: none;
    margin-top: 18px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    background: var(--card-background);
    transition: all 0.3s ease-in-out;
    backdrop-filter: blur(5px);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.session-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--islamic-border);
    background-size: 8px 4px;
    transition: all 0.3s ease;
}

.session-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-hover);
    background: linear-gradient(135deg, #f1f8e9, #e8f5e8);
    border-color: var(--primary-color);
}

.session-item:hover::before {
    width: 8px;
}

.session-item .session-date {
    font-family: 'League Spartan';
    font-size: 18px;
    margin: 0;
    padding: 0 20px;
    flex: 1;
    text-align: center;
    color: var(--text-color);
    font-weight: 600;
}

.session-item .session-hifz {
    font-family: 'League Spartan';
    font-size: 18px;
    margin: 0;
    padding: 0 20px;
    flex: 1;
    text-align: center;
    color: var(--text-color);
    font-weight: 600;
}

.session-item .session-revision {
    font-family: 'League Spartan';
    font-size: 18px;
    margin: 0;
    padding: 0 20px;
    flex: 1;
    text-align: center;
    color: var(--text-color);
    font-weight: 600;
}

.session-item .session-score {
    font-family: 'League Spartan';
    font-size: 18px;
    margin: 0;
    padding: 0 20px;
    flex: 0.5;
    text-align: center;
    color: var(--text-color);
    font-weight: 600;
}

/* Grade Colors */
.grade-10, .grade-9 { color: #27ae60 !important; }
.grade-8, .grade-7 { color: #3498db !important; }
.grade-6, .grade-5 { color: #f39c12 !important; }
.grade-4, .grade-3 { color: #e67e22 !important; }
.grade-2, .grade-1 { color: #e74c3c !important; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Force modal visibility when show class is present */
.modal.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force teacher options modal to be visible */
#teacherOptionsModal {
    display: none;
}

#teacherOptionsModal.show,
#teacherOptionsModal[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 2000 !important;
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 40px;
    border-radius: 25px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    position: relative;
    border: 3px solid var(--border-color);
    animation: modalSlideIn 0.3s ease-out;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    transform: translateZ(0); /* Force hardware acceleration */
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--islamic-border);
    background-size: 30px 5px;
}

.modal-content::after {
    content: '☪';
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    color: var(--accent-color);
    opacity: 0.2;
}

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

.modal-close {
    position: absolute;
    right: 25px;
    top: 25px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: var(--danger-color);
    background: rgba(231, 76, 60, 0.1);
    transform: rotate(90deg);
}

.modal-content h3 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 28px;
    text-align: center;
    font-weight: bold;
}

.modal-content .form-group {
    margin-bottom: 25px;
}

.modal-content label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--text-color);
    font-size: 16px;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 15px 18px;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    font-family: 'League Spartan', Arial, sans-serif;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
    transform: translateY(-2px);
}

.modal-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 35px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    font-family: 'League Spartan', Arial, sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.6);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.6);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.6);
}

/* Detailed Modal Styles */
.detailed-modal {
    max-width: 700px !important;
}

.confirmation-modal {
    max-width: 600px !important;
}

/* Mobile Modal Styles */
@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
        max-height: 85vh;
        border-radius: 15px;
    }
    
    .modal-content h3 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .modal-content .form-group {
        margin-bottom: 20px;
    }
    
    .modal-content input,
    .modal-content select {
        padding: 12px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn {
        width: 100%;
        padding: 15px;
    }
}

/* Ensure modal forms are scrollable */
.modal-content form {
    max-height: none;
    overflow: visible;
}

/* Custom scrollbar for modals */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Ayah range dropdown container */
#hifzAyahRangeContainer,
#revisionAyahRangeContainer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#hifzAyahRangeContainer select,
#revisionAyahRangeContainer select {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
}

#hifzAyahRangeContainer span,
#revisionAyahRangeContainer span {
    font-weight: 500;
    color: #333;
}

.detailed-content,
.confirmation-content {
    margin: 20px 0;
    line-height: 1.6;
}

/* Stats Container Styles */
.stats-container {
    text-align: left;
}

.stats-section {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(76, 175, 80, 0.05);
    border-radius: 15px;
    border-left: 4px solid var(--accent-color);
}

.stats-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 18px;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.stat-number {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.assignment-details {
    max-height: 200px;
    overflow-y: auto;
}

.teacher-assignment-stat {
    padding: 10px 15px;
    margin: 8px 0;
    background: white;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.user-ids {
    max-height: 150px;
    overflow-y: auto;
}

.id-group {
    padding: 10px 15px;
    margin: 8px 0;
    background: white;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    font-family: monospace;
    font-size: 14px;
    word-break: break-all;
}

/* Account Created Styles */
.account-created-container {
    text-align: center;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: bounce 0.6s ease-in-out;
}

.account-details {
    background: rgba(76, 175, 80, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: bold;
    color: var(--text-color);
}

.detail-value {
    color: var(--primary-color);
    font-weight: 500;
}

.id-highlight {
    background: var(--accent-color);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: bold;
}

.important-note {
    background: rgba(255, 152, 0, 0.1);
    border: 2px solid var(--warning-color);
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    color: #856404;
}

/* Delete Student Modal Styles */
.delete-student-content {
    margin: 20px 0;
}

.student-preview {
    background: rgba(76, 175, 80, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid var(--accent-color);
}

.student-preview h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.student-details p {
    margin: 8px 0;
    padding: 5px 0;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.student-details p:last-child {
    border-bottom: none;
}

.student-details strong {
    color: var(--text-color);
    min-width: 100px;
    display: inline-block;
}

/* Delete Teacher Modal Styles */
.delete-teacher-content {
    margin: 20px 0;
}

.teacher-preview {
    background: rgba(76, 175, 80, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid var(--accent-color);
}

.teacher-preview h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.teacher-details p {
    margin: 8px 0;
    padding: 5px 0;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.teacher-details p:last-child {
    border-bottom: none;
}

.teacher-details strong {
    color: var(--text-color);
    min-width: 120px;
    display: inline-block;
}

/* Delete Confirmation Styles */
.delete-confirmation-container {
    text-align: center;
}

.warning-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: pulse 1s ease-in-out infinite;
}

.warning-message {
    color: var(--danger-color);
    font-size: 18px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 10px;
    border: 2px solid var(--danger-color);
}

.consequences {
    text-align: left;
    background: rgba(255, 152, 0, 0.05);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.consequences h5 {
    color: var(--warning-color);
    margin-bottom: 15px;
    text-align: center;
}

.consequences ul {
    list-style: none;
    padding: 0;
}

.consequences li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.consequences li::before {
    content: '⚠️';
    position: absolute;
    left: 0;
    top: 8px;
    font-size: 14px;
}

.final-warning {
    color: var(--danger-color);
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 10px;
    border: 2px solid var(--danger-color);
}

.id-display {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c5530;
    background: #e8f5e8;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    border: 3px solid #4a7c59;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.program-info {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid #4a7c59;
}

.program-info h4 {
    margin-top: 0;
    color: #2c5530;
}

.program-info p {
    margin: 8px 0;
    font-size: 1.1em;
}

/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Students List */
.students-list {
    max-height: 400px;
    overflow-y: auto;
}

.student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin: 15px 0;
    background: var(--card-background);
    border-radius: 15px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.student-item:hover {
    background: linear-gradient(135deg, #f1f8e9, #e8f5e8);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.student-info {
    flex: 1;
}

.student-name {
    font-weight: bold;
    font-size: 20px;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.student-class {
    color: #6c757d;
    font-size: 16px;
}

/* Admin Dashboard */
.admin-dashboard {
    padding: 40px;
    text-align: center;
}

.admin-section h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 28px;
}

.admin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-actions:last-child {
    grid-template-columns: 1fr;
    justify-items: center;
}

/* Assignment Modal Styles */
.assignment-section {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 25px;
    margin-bottom: 25px;
    position: relative;
}

.assignment-section::after {
    content: '🔗';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    background: var(--card-background);
    padding: 0 10px;
    color: var(--accent-color);
}

.current-assignments h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 20px;
    text-align: center;
}

.current-assignments {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.current-assignments::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.teacher-assignment {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.teacher-assignment::before {
    content: '☪';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 16px;
    color: var(--accent-color);
    opacity: 0.3;
}

.teacher-assignment h5 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 8px;
}

.assigned-students {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.assigned-student {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 10px;
    border: 1px solid var(--accent-color);
    position: relative;
    overflow: hidden;
}

.assigned-student::before {
    content: '📖';
    position: absolute;
    left: 8px;
    font-size: 12px;
    opacity: 0.3;
}

.assigned-student span {
    font-weight: 600;
    color: var(--text-color);
    margin-left: 20px;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 14px;
    min-width: 80px;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.admin-section h2 {
    color: var(--primary-color);
    font-size: 36px;
    margin-bottom: 40px;
    font-weight: bold;
    position: relative;
}

.admin-section h2::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--gradient-secondary);
    border-radius: 2px;
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.admin-btn {
    background: var(--card-background);
    border: 3px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-height: 150px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.admin-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--islamic-border);
    background-size: 20px 3px;
}

.admin-btn::after {
    content: '☪';
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 20px;
    color: var(--accent-color);
    opacity: 0.2;
}

.admin-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-color);
    background: linear-gradient(135deg, #f1f8e9, #e8f5e8);
}

.admin-btn .icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.admin-btn {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}



/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-size: 18px;
    font-weight: 500;
    color: white;
}

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

/* Session Item Rows */
.session-item-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.session-item-row select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    color: var(--text-color);
    font-size: 14px;
}

.session-item-row input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    color: var(--text-color);
    font-size: 14px;
}

.session-item-row .btn-small {
    padding: 8px 12px;
    font-size: 14px;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-item-row .btn-small.remove {
    background: var(--danger-color);
    color: white;
}

.session-item-row .btn-small.remove:hover {
    background: #d32f2f;
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-cards {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .main-content {
        padding: 30px 20px;
    }
    
    .dashboard-header {
        padding: 20px 25px;
        flex-direction: column;
        gap: 20px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .content-item,
    .session-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 0;
    }
    
    .content-item h4,
    .session-item .session-date,
    .session-item .session-hifz,
    .session-item .session-revision,
    .session-item .session-score {
        font-size: 18px;
        padding: 5px;
    }
    
    /* Admin Dashboard Mobile */
    .admin-actions {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .admin-dashboard {
        padding: 20px;
    }
    
    .admin-btn {
        min-height: 100px;
        padding: 20px;
        font-size: 16px;
    }
    
    .admin-btn .icon {
        font-size: 32px;
    }
}

/* Teacher Dashboard Modals */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.class-item {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.class-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.class-item h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 18px;
}

.class-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

/* Teacher modal student items - more specific selector */
#studentSelectionModal .student-item {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 16px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    height: auto;
    min-height: 40px;
    margin: 2px 0;
    white-space: nowrap;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

#studentSelectionModal .student-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

#studentSelectionModal .student-item.assigned {
    background: #e8f5e8;
    border-color: #27ae60;
}

#studentSelectionModal .student-item.assigned::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    color: #27ae60;
    font-weight: bold;
    font-size: 18px;
}

#studentSelectionModal .student-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
    transform: scale(1);
    flex-shrink: 0;
    margin-right: 8px;
    display: inline-block;
}

#studentSelectionModal .student-info {
    flex: 1;
    display: inline-block;
    white-space: nowrap;
    overflow: visible;
    min-width: 0;
    flex-grow: 1;
    margin-left: 8px;
}

#studentSelectionModal .student-name {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.2;
    margin: 0;
    flex-shrink: 0;
    overflow: visible;
    white-space: nowrap;
    display: inline;
}

#studentSelectionModal .student-class {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    flex-shrink: 0;
    overflow: visible;
    white-space: nowrap;
    display: inline;
}

.teacher-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

.teacher-options .btn {
    min-width: 150px;
    padding: 15px 25px;
    font-size: 16px;
}

/* Removed duplicate modal-content styles */

@media (max-width: 480px) {
    .login-card {
        padding: 40px 25px;
        margin: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Checkbox group styles */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
}

.checkbox-label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.checkbox-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

.checkbox-label:has(input[type="checkbox"]:checked) {
    border-color: #667eea;
    background: #f0f4ff;
}
    
    .content-card,
    .past-sessions-card {
        padding: 25px 20px;
    }
}
