/* ====================================
   Eng1 PWA - Modern Dark Theme
   Inspired by Crypto Wallet UI
   ==================================== */

:root {
    /* الألوان الأساسية */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.05);
    
    /* ألوان النصوص */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* ألوان مميزة */
    --accent-blue: #0ea5e9;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-cyan: #06b6d4;
    
    /* تدرجات */
    --gradient-primary: linear-gradient(135deg, #0ea5e9:0%, #a855f7 100%);
    --gradient-card: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    --gradient-glow: linear-gradient(135deg, rgba(14, 165, 233, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
    
    /* الظلال والحدود */
    --border-glass: rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 40px rgba(14, 165, 233, 0.15);
    
    /* الخط */
    --font-family: 'Cairo', sans-serif;
    
    /* أحجام */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    direction: rtl;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* خلفية متحركة */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* الحاوية الرئيسية */
.app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: 80px;
}

/* ============ الهيدر ============ */
.app-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    border: 2px solid var(--border-glass);
}

.user-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-btn:hover {
    background: var(--bg-card);
    color: var(--accent-blue);
}

/* ============ الصفحة الرئيسية ============ */
.page-content {
    padding: 0 20px;
}

/* بطاقة الترحيب */
.welcome-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border-glass);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.welcome-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.welcome-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.welcome-number span {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* شريط التقدم */
.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* ============ إحصائيات ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border-glass);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 20px;
}

.stat-icon.blue { background: rgba(14, 165, 233, 0.2); color: var(--accent-blue); }
.stat-icon.purple { background: rgba(168, 85, 247, 0.2); color: var(--accent-purple); }
.stat-icon.green { background: rgba(34, 197, 94, 0.2); color: var(--accent-green); }
.stat-icon.orange { background: rgba(249, 115, 22, 0.2); color: var(--accent-orange); }

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============ قسم الدورات ============ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
}

.section-link {
    font-size: 13px;
    color: var(--accent-blue);
    text-decoration: none;
}

/* بطاقات الدورات */
.courses-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin: 0 -20px;
    padding: 0 20px 12px;
    scrollbar-width: none;
}

.courses-scroll::-webkit-scrollbar {
    display: none;
}

.course-card {
    flex-shrink: 0;
    width: 200px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border-glass);
    transition: all 0.3s ease;
}

.course-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow);
}

.course-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.course-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.course-lessons {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.course-progress {
    height: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.course-progress-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: var(--radius-full);
}

/* ============ المفردات اليومية ============ */
.vocab-card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 20px;
    border: 1px solid var(--border-glass);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.vocab-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    opacity: 0.1;
}

.vocab-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.vocab-source {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.vocab-phonetic {
    font-size: 14px;
    color: var(--text-muted);
    font-family: monospace;
    margin-bottom: 8px;
}

.vocab-target {
    font-size: 18px;
    color: var(--accent-blue);
    margin-bottom: 16px;
}

.vocab-actions {
    display: flex;
    gap: 8px;
}

.vocab-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.vocab-btn.primary {
    background: var(--gradient-primary);
    color: white;
}

.vocab-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.vocab-btn:hover {
    transform: scale(1.02);
}

/* ============ شريط التنقل السفلي ============ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 20px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: var(--radius-md);
}

.nav-item.active {
    color: var(--accent-blue);
}

.nav-item.active .nav-icon {
    background: rgba(14, 165, 233, 0.1);
}

.nav-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 20px;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* ============ صفحة تسجيل الدخول ============ */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 40px 24px;
}

.login-header {
    text-align: center;
    margin-bottom: 48px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 24px;
    box-shadow: var(--shadow-glow);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.login-form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============ رسائل ============ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

/* ============ التحميل ============ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ الحالة الفارغة ============ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-text {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============ Responsive ============ */
@media (min-width: 768px) {
    .app-container {
        max-width: 480px;
        margin: 0 auto;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* إخفاء السكرولبار */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}
