/* ========================================
   Quanta Platform - Main Stylesheet
   ======================================== */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@400;700;800&family=Cairo:wght@400;600;700;900&family=Tajawal:wght@400;500;700;900&display=swap');

/* Import Color System */
@import url('color-system.css');

/* Root Variables */
:root {
    /* ========================================
       NEW BRAND COLORS (v2.0 - Nov 2025)
       ======================================== */
    --color-primary: #005689;
    /* Deep Blue - Primary */
    --color-secondary: #007cb9;
    /* Ocean Blue - Secondary */
    --color-primary-light: #007cb9;
    /* Ocean Blue for light variant */
    --color-primary-dark: #003d5f;
    /* Darker Blue */
    --color-accent: #00D4FF;
    /* Cyan - Accent (matches unified-theme) */
    --color-light: #d5eeff;
    /* Sky Blue - Light backgrounds */

    /* OLD COLORS (Deprecated - Backup for reference)
       --color-primary-old: #e94822;     // Orange Red
       --color-primary-light-old: #f2910a;  // Orange
       --color-primary-dark-old: #2c2d34;   // Dark Gray
       --color-accent-old: #efd510;      // Yellow
    */

    /* Legacy color mappings (updated to new palette) */
    --color-azure: #d5eeff;
    /* Updated to light blue */
    --color-bassthalk: #007cb9;
    /* Updated to secondary */
    --color-white: #ffffff;
    --color-dark: #005689;
    /* Updated to primary */

    /* Gray Scale */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;

    --font-family: 'Almarai', sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    --border-radius: 0.5rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;
    --border-radius-full: 9999px;

    --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);

    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

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

body {
    font-family: var(--font-family);
    line-height: 1.7;
    color: #2d3748;
    /* Dark gray for better contrast */
    background-color: var(--color-white);
    direction: rtl;
    text-align: right;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: #1a202c !important;
    /* Dark color with important for visibility */
}

h1 {
    font-size: var(--font-size-4xl);
    font-weight: 800;
}

h2 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
}

h3 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

h4 {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

h5 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

h6 {
    font-size: var(--font-size-base);
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    color: #4a5568 !important;
    /* Medium gray with important for visibility */
    font-weight: 400;
    line-height: 1.7;
}

/* Text Visibility Fix - Enhanced */

/* Default dark text for light backgrounds */
section,
.section,
.container,
.card {
    color: #1a202c;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #111827 !important;
    font-weight: 700;
}

p,
span,
div,
label,
a {
    color: #374151 !important;
}

/* White text for colored/dark backgrounds - PRIORITY */
.bg-primary,
.bg-primary *,
.bg-primary h1,
.bg-primary h2,
.bg-primary h3,
.bg-primary h4,
.bg-primary h5,
.bg-primary h6,
.bg-primary p,
.bg-primary span,
.bg-primary div,
.bg-primary a,
.bg-primary label,
.bg-dark,
.bg-dark *,
[class*="bg-gradient"],
[class*="bg-gradient"] *,
[style*="background: linear-gradient"],
[style*="background: linear-gradient"] *,
[style*="background: var(--color-primary)"],
[style*="background: var(--color-primary)"] *,
[style*="background: #00"],
[style*="background: #00"] * {
    color: #ffffff !important;
}

/* Specific overrides for always white text */
.text-white,
.text-white *,
[style*="color: white"],
[style*="color: white"] *,
[style*="color: #fff"],
[style*="color: #fff"] * {
    color: #ffffff !important;
}

/* Button colors */
.btn {
    color: #ffffff !important;
    font-weight: 600;
}

.btn-white,
.btn-white * {
    color: #111827 !important;
    background: #ffffff !important;
}

.btn-outline {
    color: var(--color-primary) !important;
    background: transparent !important;
    border: 2px solid currentColor;
}

.btn-primary {
    background: var(--color-primary) !important;
    color: #ffffff !important;
}

/* Input and form elements */
input,
textarea,
select {
    color: #1a202c !important;
    background: #ffffff !important;
}

input::placeholder,
textarea::placeholder {
    color: #9ca3af !important;
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-dark);
}

/* Header/Navigation - Simplified */
.navbar {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 70px;
}

.navbar-brand {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1a202c;
    text-decoration: none;
    transition: var(--transition);
}

.navbar-brand:hover {
    color: var(--color-primary);
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

.navbar-menu li {
    display: inline-block;
}

.navbar-menu a {
    display: block;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.navbar-menu a:hover {
    color: var(--color-primary);
    background: #f0fdf4;
}

/* Ensure menu items are always visible - no accidental hiding */
.navbar-menu li {
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
}

.navbar-menu a {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--color-azure) 0%, var(--color-primary-light) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    position: relative;
    overflow: hidden;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-text h1 {
    font-size: var(--font-size-5xl);
    font-weight: 800;
    color: var(--color-gray-900);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-text .highlight {
    color: var(--color-primary);
    position: relative;
}

.hero-text .highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
}

.hero-text p {
    font-size: var(--font-size-xl);
    color: var(--color-gray-600);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-image {
    position: relative;
    text-align: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    transform: rotate(2deg);
    transition: var(--transition);
}

.hero-image img:hover {
    transform: rotate(0deg) scale(1.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: var(--border-radius-full);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: var(--font-size-base);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

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

.btn-white {
    background: var(--color-white);
    color: var(--color-gray-900);
    box-shadow: var(--shadow-md);
}

.btn-white:hover {
    background: var(--color-gray-100);
    transform: translateY(-2px);
}

/* Cards */
.card {
    background: var(--color-white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--color-gray-200);
}

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

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-icon {
    width: 3rem;
    height: 3rem;
    background: var(--color-azure);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-size: var(--font-size-xl);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-gray-900);
    margin: 0;
}

.card-text {
    color: var(--color-gray-600);
    line-height: 1.6;
}

/* Sections */
.section {
    padding: 5rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: var(--font-size-4xl);
    font-weight: 800;
    color: var(--color-gray-900);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: var(--font-size-xl);
    color: var(--color-gray-600);
    max-width: 600px;
    margin: 0 auto;
}

/* Grid */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Features Section */
.features {
    background: var(--color-gray-100);
}

.feature-card {
    text-align: center;
    padding: 3rem 2rem;
}

.feature-icon {
    width: 4rem;
    height: 4rem;
    background: var(--color-primary);
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--color-white);
    font-size: var(--font-size-2xl);
}

/* Stats Section */
.stats {
    background: var(--color-primary);
    color: var(--color-white);
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: var(--font-size-5xl);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: var(--font-size-lg);
    opacity: 0.9;
}

/* Footer */
.footer {
    background: var(--color-gray-900);
    color: var(--color-white);
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand {
    grid-column: span 2;
}

.footer-brand h3 {
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.footer-links h4 {
    margin-bottom: 1rem;
    color: var(--color-white);
}

.footer-links ul {
    list-style: none;
}

.footer-links a {
    color: var(--color-gray-400);
    text-decoration: none;
    transition: var(--transition);
    display: block;
    padding: 0.25rem 0;
}

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

.footer-bottom {
    border-top: 1px solid var(--color-gray-700);
    padding-top: 2rem;
    text-align: center;
    color: var(--color-gray-400);
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ======================================== */

/* Mobile (< 640px) */
@media (max-width: 640px) {
    :root {
        --font-size-4xl: 1.75rem;
        --font-size-3xl: 1.5rem;
        --font-size-2xl: 1.25rem;
    }

    body {
        font-size: 14px;
    }

    .container {
        padding: 0 0.75rem;
        max-width: 100%;
    }

    /* Navbar Mobile */
    .navbar {
        padding: 0.75rem 0;
        position: relative;
    }

    .navbar-content {
        padding: 0 0.75rem;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: block !important;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: #1a202c;
        padding: 0.5rem;
    }

    /* Navbar Mobile */
    .navbar-menu {
        display: none !important;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        gap: 0.5rem;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .navbar-menu.active {
        display: flex !important;
    }

    .navbar-menu li {
        width: 100%;
        display: block !important;
    }

    .navbar-menu a {
        width: 100%;
        padding: 1rem;
        display: block;
    }

    .navbar-menu li {
        width: 100%;
    }

    .navbar-menu a {
        display: block;
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        background: #f8f9fa;
        transition: all 0.2s;
    }

    .navbar-menu a:hover {
        background: var(--color-primary);
        color: white;
        transform: translateX(-5px);
    }

    /* Hero Mobile */
    .hero-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
        padding: 2rem 0;
    }

    .hero-text h1 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .hero-text p {
        font-size: 1rem;
    }

    .hero-image {
        order: -1;
    }

    /* Buttons Mobile */
    .btn,
    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Cards Mobile */
    .card {
        padding: 1.25rem;
    }

    .course-card {
        margin-bottom: 1rem;
    }

    /* Grids Mobile */
    .grid-2,
    .grid-3,
    .grid-4,
    .courses-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Footer Mobile */
    .footer {
        padding: 2rem 0 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }

    .footer-brand {
        grid-column: span 1;
    }

    /* Messages Mobile */
    .alert {
        max-width: 90vw !important;
        right: 5vw !important;
        top: 80px !important;
    }

    /* Tables Mobile */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Forms Mobile */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    /* Section Spacing Mobile */
    .section {
        padding: 2rem 0;
    }

    .section-header {
        margin-bottom: 1.5rem;
    }

    /* Stats Grid Mobile - 2 columns */
    .stats .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-item {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.875rem;
    }

    /* Feature Cards Mobile */
    .feature-card {
        text-align: center;
    }

    .feature-icon {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }

    /* Hero Buttons Mobile - Stack vertically */
    .hero-text>div {
        flex-direction: column !important;
        width: 100%;
    }

    .hero-text .btn {
        width: 100%;
    }

    /* CTA Section Mobile */
    .bg-azure>.container>.text-center>div {
        flex-direction: column !important;
    }

    /* Card Responsive Improvements */
    .card-header {
        flex-wrap: wrap;
    }

    .card-title {
        font-size: 1.125rem;
    }

    /* Touch-friendly spacing */
    a,
    button,
    .btn {
        min-height: 44px;
        /* iOS touch target recommendation */
        min-width: 44px;
    }

    /* Video Player Mobile */
    .video-container,
    iframe {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16/9;
    }

    /* Improve readability on small screens */
    body {
        line-height: 1.6;
    }

    p {
        line-height: 1.7;
    }
}

/* Tablet (641px - 768px) */
@media (min-width: 641px) and (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .navbar-menu {
        gap: 1rem;
    }

    .hero-text h1 {
        font-size: 2rem;
    }
}

/* Medium (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 720px;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Additional Text Contrast Fixes */
.bg-azure,
.bg-azure * {
    color: #111827 !important;
}

.bg-white,
.bg-white * {
    color: #1a202c !important;
}

/* Ensure visibility on all backgrounds */
section:not(.bg-primary):not(.bg-dark) h1,
section:not(.bg-primary):not(.bg-dark) h2,
section:not(.bg-primary):not(.bg-dark) h3,
section:not(.bg-primary):not(.bg-dark) h4 {
    color: #111827 !important;
}

section:not(.bg-primary):not(.bg-dark) p,
section:not(.bg-primary):not(.bg-dark) span,
section:not(.bg-primary):not(.bg-dark) div:not(.btn) {
    color: #374151 !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

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

.text-white {
    color: var(--color-white);
}

.text-gray-600 {
    color: var(--color-gray-600);
}

.text-gray-900 {
    color: var(--color-gray-900);
}

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

/* FORCE white text on bg-primary - HIGHEST PRIORITY */
.bg-primary,
.bg-primary *,
.bg-primary h1,
.bg-primary h2,
.bg-primary h3,
.bg-primary h4,
.bg-primary h5,
.bg-primary h6,
.bg-primary p,
.bg-primary span,
.bg-primary div:not(.btn-white),
.bg-primary a:not(.btn-white),
.bg-primary label {
    color: #ffffff !important;
}

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

.bg-gray-100 {
    background-color: var(--color-gray-100);
}

.bg-azure {
    background-color: var(--color-azure);
}