/* ============================================
   Arabic Internet Knowledge Test Website
   RTL Design - Blue & White Theme
   ============================================ */

/* CSS Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #0ea5e9;
    --accent: #06b6d4;
    --dark: #1e293b;
    --gray-dark: #334155;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --light: #f1f5f9;
    --white: #ffffff;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --shadow: 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);
    --radius: 12px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.7;
    direction: rtl;
    text-align: right;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
}

ul, ol {
    list-style: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
}

/* Navigation */
.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-weight: 500;
    color: var(--gray-dark);
    padding: 0.5rem 0;
    position: relative;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
}

@media (max-width: 768px) {
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        box-shadow: var(--shadow-lg);
    }
    
    .nav.active {
        display: flex;
    }
    
    .menu-toggle {
        display: block;
    }
}

/* Hero Section */
.hero {
    background: var(--gradient);
    padding: 8rem 0 4rem;
    color: var(--white);
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

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

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

.btn-primary:hover {
    background: var(--light);
    transform: translateY(-2px);
}

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

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

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

.btn-blue:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Section Styles */
.section {
    padding: 4rem 0;
}

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

.section-header h2 {
    color: var(--dark);
}

.section-header p {
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Card */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

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

.card-image {
    height: 180px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--white);
}

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

.card-content {
    padding: 1.5rem;
}

.card-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card-content p {
    color: var(--gray);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray-light);
}

.card-tag {
    background: var(--light);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Test Card Specific */
.test-card {
    text-align: center;
}

.test-card .card-image {
    height: 140px;
}

.test-icon {
    font-size: 3.5rem;
}

/* Article Card */
.article-card {
    display: flex;
    flex-direction: column;
}

.article-card .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-card .btn {
    margin-top: auto;
}

/* Category Navigation */
.category-nav {
    background: var(--white);
    padding: 1rem 0;
    border-bottom: 1px solid var(--light);
    margin-bottom: 2rem;
}

.category-nav-inner {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.category-link {
    padding: 0.5rem 1rem;
    background: var(--light);
    border-radius: 20px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition);
}

.category-link:hover,
.category-link.active {
    background: var(--primary);
    color: var(--white);
}

/* Test Page */
.test-header {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.test-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: var(--light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    transition: width 0.3s ease;
}

.test-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--primary);
}

/* Question Card */
.question-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.question-number {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.answer-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.answer-item:hover {
    border-color: var(--primary-light);
}

.answer-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

.answer-item.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.answer-item.wrong {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.answer-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-light);
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.answer-item.selected .answer-radio {
    border-color: var(--primary);
}

.answer-item.selected .answer-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

.answer-item.correct .answer-radio {
    border-color: var(--success);
}

.answer-item.correct .answer-radio::after {
    background: var(--success);
}

.answer-item.wrong .answer-radio {
    border-color: var(--error);
}

.answer-item.wrong .answer-radio::after {
    background: var(--error);
}

/* Explanation Box */
.explanation-box {
    background: rgba(6, 182, 212, 0.1);
    border-right: 4px solid var(--accent);
    padding: 1.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-top: 1.5rem;
}

.explanation-box h4 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.explanation-box p {
    margin-bottom: 0;
}

/* Test Navigation */
.test-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
}

/* Results Card */
.results-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.results-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.results-score {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.results-label {
    color: var(--gray);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    padding: 1rem;
    background: var(--light);
    border-radius: var(--radius);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

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

/* Article Page */
.article-header {
    background: var(--gradient);
    padding: 6rem 0 3rem;
    color: var(--white);
}

.article-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 1rem;
}

.article-content {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: -2rem;
    position: relative;
}

.article-content h2 {
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-content h3 {
    color: var(--dark);
    margin-top: 1.5rem;
}

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content ul,
.article-content ol {
    margin: 1.5rem 0;
    padding-right: 1.5rem;
}

.article-content li {
    margin-bottom: 0.75rem;
    position: relative;
    padding-right: 1.5rem;
}

.article-content ul li::before {
    content: '•';
    position: absolute;
    right: 0;
    color: var(--primary);
}

.article-content ol {
    counter-reset: list;
}

.article-content ol li {
    counter-increment: list;
}

.article-content ol li::before {
    content: counter(list);
    position: absolute;
    right: 0;
    color: var(--primary);
    font-weight: 600;
}

.article-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius);
    margin: 2rem 0;
}

.article-image-small {
    max-height: 250px;
}

/* Related Articles */
.related-articles {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light);
}

/* Contact Form */
.contact-form {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--light);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    min-height: 150px;
    resize: vertical;
}

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

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

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

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--gray-light);
    transition: var(--transition);
}

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

.footer-bottom {
    border-top: 1px solid var(--gray-dark);
    padding-top: 1.5rem;
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
}

/* 404 Page */
.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-code {
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.error-message {
    font-size: 1.5rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

/* Page Header */
.page-header {
    background: var(--gradient);
    padding: 6rem 0 3rem;
    color: var(--white);
    text-align: center;
}

/* Legal Pages */
.legal-content {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: -2rem;
    position: relative;
}

.legal-content h2 {
    color: var(--primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.legal-content h3 {
    color: var(--dark);
    margin-top: 1.5rem;
}

.legal-content ul {
    margin: 1rem 0;
    padding-right: 1.5rem;
}

.legal-content li {
    margin-bottom: 0.5rem;
    position: relative;
    padding-right: 1rem;
}

/* Stats Section */
.stats-section {
    background: var(--gradient);
    padding: 4rem 0;
    color: var(--white);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-text {
    opacity: 0.9;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
    margin: 0 auto 1rem;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .article-content,
    .legal-content {
        padding: 1.5rem;
    }
    
    .results-stats {
        grid-template-columns: 1fr;
    }
    
    .test-info {
        flex-direction: column;
        text-align: center;
    }
    
    .progress-bar {
        width: 100%;
    }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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