/* =============================================
   الحلقات الأسرية - حلقة تحفيظ القرآن الأسرية
   Custom Styles
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #5eead4;
    --secondary: #d4a843;
    --secondary-light: #fbbf24;
    --accent: #1e3a5f;
    --bg-main: #f0fdf9;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-dark: #042f2e;
    --text-primary: #134e4a;
    --text-secondary: #5f6b7a;
    --text-light: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: rgba(13, 148, 136, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(13, 148, 136, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== Background Pattern ========== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(13, 148, 136, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(212, 168, 67, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(30, 58, 95, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ========== Login Page ========== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #042f2e 0%, #0f766e 50%, #0d9488 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(212, 168, 67, 0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(94, 234, 212, 0.08) 0%, transparent 60%);
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: 0 8px 25px rgba(212, 168, 67, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 8px 25px rgba(212, 168, 67, 0.3);
    }

    50% {
        box-shadow: 0 8px 35px rgba(212, 168, 67, 0.5);
    }
}

.login-card h1 {
    color: #fff;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-card .subtitle {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.login-card .form-control {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

.login-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.2);
    outline: none;
}

.login-card .form-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    border: none;
    border-radius: 12px;
    color: #1a1a1a;
    font-family: 'Tajawal', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 168, 67, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

/* ========== App Shell ========== */
.app-shell {
    position: relative;
    z-index: 1;
    padding-bottom: 80px;
    min-height: 100vh;
}

/* ========== Header ========== */
.app-header {
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 12px 16px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.user-info h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.user-info span {
    font-size: 0.8rem;
    opacity: 0.7;
}

.header-dropdown-content {
    display: none;
    position: absolute;
    top: 50px;
    left: 0;
    background-color: var(--bg-card);
    min-width: 185px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
}

.header-dropdown-content.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.header-dropdown-content button {
    color: var(--text-primary);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: right;
    background: none;
    border: none;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.header-dropdown-content button:hover {
    background-color: rgba(13, 148, 136, 0.05);
    color: var(--primary);
}

.header-dropdown-content button.danger-item:hover {
    background-color: rgba(239, 68, 68, 0.05);
    color: var(--danger);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 6px 4px;
    text-align: center;
    transition: var(--transition);
}

.stat-pill:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.stat-pill .number {
    font-size: 1.1rem;
    font-weight: 800;
    display: block;
    line-height: 1.1;
}

.stat-pill .label {
    font-size: 0.7rem;
    opacity: 0.7;
    display: block;
}

/* ========== Content Area ========== */
.content-area {
    padding: 20px;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .icon {
    font-size: 1.2rem;
}

/* ========== Cards ========== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Assignment Card */
.assignment-card {
    position: relative;
    overflow: hidden;
}

.assignment-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.assignment-card.type-حفظ::before {
    background: var(--primary);
}

.assignment-card.type-تلاوة::before {
    background: var(--secondary);
}

.assignment-card.type-مراجعة::before {
    background: var(--accent);
}

.assignment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.assignment-type {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    color: #fff;
}

.type-حفظ .assignment-type {
    background: var(--primary);
}

.type-تلاوة .assignment-type {
    background: var(--secondary);
    color: #1a1a1a;
}

.type-مراجعة .assignment-type {
    background: var(--accent);
}

.assignment-surah {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.assignment-ayah {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.assignment-student {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.assignment-student .mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.assignment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.assignment-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(13, 148, 136, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #fff;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: rgba(13, 148, 136, 0.05);
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition);
    direction: rtl;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6b7a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-left: 36px;
}

/* ========== Bottom Navigation ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 200;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-light);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 10px;
    position: relative;
}

.nav-item .nav-icon {
    font-size: 1.4rem;
    line-height: 1;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}

.nav-item .badge {
    position: absolute;
    top: 2px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ========== Pages (sections) ========== */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Student Card ========== */
.student-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.student-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.student-info {
    flex: 1;
    min-width: 0;
}

.student-info h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.student-info .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.student-points {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.1), rgba(251, 191, 36, 0.1));
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-weight: 700;
    color: var(--secondary);
    font-size: 0.9rem;
}

/* ========== Leaderboard ========== */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.leaderboard-item .rank {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.rank-1 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.rank-2 {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #1a1a1a;
}

.rank-3 {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
}

.rank-other {
    background: rgba(13, 148, 136, 0.1);
    color: var(--primary);
}

.leaderboard-item .lb-info {
    flex: 1;
}

.leaderboard-item .lb-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.leaderboard-item .lb-info .streak {
    font-size: 0.8rem;
    color: var(--text-light);
}

.lb-points {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--secondary);
}

/* ========== Progress Bar ========== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(13, 148, 136, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ========== Status Badge ========== */
.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-done {
    background: rgba(13, 148, 136, 0.1);
    color: var(--primary);
}

.status-reviewed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: none;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin: 0 auto 16px;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

/* ========== Toast Notification ========== */
.app-toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.app-toast {
    background: var(--bg-dark);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.app-toast.hiding {
    opacity: 0;
    transform: translateY(-10px);
}

/* Toast icon shared styles */
.app-toast .toast-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Success: green circle with checkmark */
.app-toast.success {
    border-right: 3px solid var(--success);
}

.app-toast.success .toast-icon {
    background: var(--success);
}

.app-toast.success .toast-icon::after {
    content: '';
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translate(-1px, -1px);
    display: block;
}

/* Error: red circle with X */
.app-toast.error {
    border-right: 3px solid var(--danger);
}

.app-toast.error .toast-icon {
    background: var(--danger);
}

.app-toast.error .toast-icon::before,
.app-toast.error .toast-icon::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.app-toast.error .toast-icon::before {
    transform: rotate(45deg);
}

.app-toast.error .toast-icon::after {
    transform: rotate(-45deg);
}

/* Info: teal circle with i */
.app-toast.info {
    border-right: 3px solid var(--primary);
}

.app-toast.info .toast-icon {
    background: var(--primary);
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    font-style: italic;
    font-family: Georgia, serif;
    line-height: 22px;
    text-align: center;
}

.app-toast.info .toast-icon::after {
    content: 'i';
    display: block;
    width: 100%;
    text-align: center;
    line-height: 22px;
}

/* Warning: amber circle with ! */
.app-toast.warning {
    border-right: 3px solid var(--warning);
}

.app-toast.warning .toast-icon {
    background: var(--warning);
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    line-height: 22px;
    text-align: center;
}

.app-toast.warning .toast-icon::after {
    content: '!';
    display: block;
    width: 100%;
    text-align: center;
    line-height: 22px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ========== PWA Install Banner ========== */
.pwa-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius);
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-md);
}

.pwa-banner.show {
    display: flex;
}

.pwa-banner p {
    flex: 1;
    font-size: 0.9rem;
}

.pwa-banner .btn-install {
    background: #fff;
    color: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.pwa-banner .btn-close-banner {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

/* ========== Sync Indicator ========== */
.sync-indicator {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-light);
    z-index: 400;
    transition: var(--transition);
}

.sync-indicator.online {
    background: var(--success);
}

.sync-indicator.syncing {
    background: var(--warning);
    animation: pulse 1s infinite;
}

.sync-indicator.offline {
    background: var(--danger);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ========== Loading Spinner ========== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(13, 148, 136, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== Color Picker Grid ========== */
.color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text-primary);
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
    .content-area {
        max-width: 600px;
        margin: 0 auto;
    }

    .modal-content {
        border-radius: 24px;
        margin-bottom: 20px;
    }

    .modal-overlay {
        align-items: center;
    }

    .bottom-nav {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
}

/* ========== Surah List ========== */
.surah-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

.surah-option {
    padding: 8px 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
}

.surah-option:hover,
.surah-option.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ========== Points Animation ========== */
.points-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    color: #1a1a1a;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: 800;
    z-index: 600;
    animation: pointsPop 1.5s ease forwards;
    box-shadow: 0 10px 40px rgba(212, 168, 67, 0.5);
}

@keyframes pointsPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -70%) scale(0.8);
    }
}