/* ============================================
   ABOUMALEK ACADEMY - PUBLIC STYLES
   Mobile-First, RTL Support
   ============================================ */

/* ============================================
   ROOT VARIABLES
   ============================================ */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --white: #ffffff;
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --gray-900: #1a202c;
    --font-family-ar: 'Cairo', sans-serif;
    --font-family-en: 'Inter', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-ar);
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 70px; /* Space for mobile nav */
}

body.ltr {
    font-family: var(--font-family-en);
}

/* ============================================
   RTL SUPPORT
   ============================================ */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .me-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

[dir="rtl"] .ms-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* ============================================
   HEADER / NAVIGATION
   ============================================ */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.site-header .navbar {
    padding: 0.75rem 0;
}

.site-header .navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-header .navbar-brand .brand-text {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-header .navbar-brand .brand-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.site-header .nav-link {
    color: var(--gray-700);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: color 0.2s ease;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: var(--primary-color);
}

.lang-switch .material-icons {
    font-size: 1.25rem;
    vertical-align: middle;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    min-height: calc(100vh - 200px);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
}

.hero-section h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-section p {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-section .btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

/* ============================================
   COURSE CARDS
   ============================================ */
.course-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.course-card .card-img {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.course-card .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-card .badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
}

[dir="rtl"] .course-card .badge {
    left: auto;
    right: 1rem;
}

.course-card .card-body {
    padding: 1.25rem;
}

.course-card .card-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.course-card .card-text {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.course-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.course-card .price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.course-card .level-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    border-radius: var(--radius);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
}

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

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

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* ============================================
   FORMS
   ============================================ */
.form-control {
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

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

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: var(--radius);
    border: none;
    padding: 1rem 1.25rem;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background-color: var(--dark-color);
    color: var(--gray-300);
}

.site-footer h5 {
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

/* Override Bootstrap's text-muted inside footer — gray text is invisible on dark bg */
.site-footer .text-muted {
    color: var(--gray-400) !important;
}

.site-footer a {
    color: var(--gray-400);
    transition: color 0.2s ease;
}

.site-footer a:hover {
    color: var(--white);
}

.footer-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--white) !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-brand .brand-logo {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

.social-links a:hover {
    background-color: var(--primary-color);
}

/* ============================================
   MOBILE BOTTOM NAVIGATION
   ============================================ */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1050;
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray-600);
    padding: 0.5rem;
    flex: 1;
    transition: color 0.2s ease;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--primary-color);
}

.mobile-bottom-nav .nav-item .material-icons {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.mobile-bottom-nav .nav-item span:last-child {
    font-size: 0.75rem;
    font-weight: 500;
}

/* ============================================
   SECTION TITLES
   ============================================ */
.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stats-card .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.stats-card .icon .material-icons {
    font-size: 2rem;
}

.stats-card .number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
}

.stats-card .label {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
}

/* ============================================
   UTILITIES
   ============================================ */
.icon-sm {
    font-size: 1rem;
    vertical-align: middle;
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow {
    box-shadow: var(--shadow) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0;
    }
    
    .hero-section h1 {
        font-size: 1.5rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    body {
        padding-bottom: 65px;
    }
}

@media (min-width: 992px) {
    .hero-section h1 {
        font-size: 3rem;
    }
    
    .hero-section p {
        font-size: 1.25rem;
    }
    
    body {
        padding-bottom: 0;
    }
    
    .mobile-bottom-nav {
        display: none;
    }
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* ============================================
   COURSE DETAIL PAGE
   ============================================ */
.course-detail-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    padding: 3rem 0;
}

.course-detail-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.course-meta-item {
    display: inline-flex;
    align-items: center;
    margin-left: 1.5rem;
    opacity: 0.9;
}

[dir="rtl"] .course-meta-item {
    margin-left: 0;
    margin-right: 1.5rem;
}

.course-meta-item .material-icons {
    margin-left: 0.5rem;
    font-size: 1.25rem;
}

[dir="rtl"] .course-meta-item .material-icons {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    max-width: 450px;
    margin: 2rem auto;
}

.auth-card h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.auth-card .subtitle {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gray-200);
}

.auth-divider span {
    background: var(--white);
    padding: 0 1rem;
    position: relative;
    color: var(--gray-500);
}

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

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}
