/* ==========================================
   المحول الذكي الشامل - ملف الأنماط الرئيسي
   Smart Converter PWA - Main Stylesheet
   الإصدار: 3.0.0 | التاريخ: 2026
   ========================================== */

/* ===== المتغيرات الأساسية (CSS Variables) ===== */
:root {
    /* الألوان الرئيسية */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    
    /* الوضع الفاتح (افتراضي) */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --hover-bg: #f1f5f9;
    --header-bg: rgba(255, 255, 255, 0.85);
    --footer-bg: #1e293b;
    --footer-text: #f1f5f9;
}

/* الوضع المظلم */
body.dark-mode {
    --bg-primary: #0b1120;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --hover-bg: #2d3a4f;
    --header-bg: rgba(15, 23, 42, 0.85);
    --footer-bg: #020617;
    --footer-text: #e2e8f0;
}

/* ===== إعادة ضبط (Reset) ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    scroll-padding-top: 80px; /* تعويض ارتفاع الشريط الثابت */
}

body {
    font-family: 'Tajawal', 'Cairo', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ===== الحاوية الأساسية ===== */
.container {
    width: 90%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== روابط ===== */
a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

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

/* ===== قوائم ===== */
ul {
    list-style: none;
}

/* ===== أزرار ===== */
button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

/* ===== الصور ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== شريط التنقل الرئيسي (Header) ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

/* الشعار */
.logo {
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* قائمة التنقل */
.nav-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-menu a {
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    font-size: 1rem;
    white-space: nowrap;
}

.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

/* زر تغيير الوضع */
#theme-toggle {
    font-size: 1.5rem;
    padding: 0.25rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

#theme-toggle:hover {
    transform: scale(1.1);
    background-color: var(--primary-color);
    color: white;
}

/* زر القائمة للجوال */
.nav-toggle {
    display: none;
    font-size: 2rem;
    color: var(--text-primary);
}

/* ===== القسم الرئيسي (Hero) ===== */
.hero {
    padding: 4rem 0;
    text-align: center;
    background: radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.1) 0%, transparent 50%);
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.hero-subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 2rem;
}

/* ===== قسم الأدوات ===== */
.tools {
    padding: 4rem 0;
}

.tools h2 {
    text-align: center;
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 3rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

/* بطاقة الأداة */
.tool-card {
    background: var(--bg-card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px var(--shadow-color), 0 10px 10px -5px var(--shadow-color);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 40px -15px var(--shadow-color);
}

.tool-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 900;
    text-align: center;
}

.tool-body {
    padding: 2rem 1.5rem;
}

.tool-body p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    text-align: center;
}

/* صندوق المحول */
.converter-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-group input,
.input-group select {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group input[readonly] {
    background: var(--bg-secondary);
    font-weight: 700;
    color: var(--primary-color);
}

.swap-button {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.swap-button:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(180deg);
    border-color: var(--primary-color);
}

.convert-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: fit-content;
    margin: 0 auto;
}

.convert-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

/* ===== الأسئلة الشائعة (FAQ) ===== */
.faq {
    padding: 4rem 0;
    background: var(--bg-secondary);
}

.faq h2 {
    text-align: center;
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 3rem;
}

.faq-grid {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

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

.faq-question {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.faq-question::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.faq-item.active .faq-question::after {
    content: '−';
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    color: var(--text-secondary);
}

.faq-item.active .faq-answer {
    max-height: 200px;
    margin-top: 1rem;
}

/* ===== التذييل (Footer) ===== */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 4rem 0 2rem;
    margin-top: 2rem;
}

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

.footer-about h3,
.footer-links h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: white;
}

.footer-about p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
}

.footer-links ul li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.2s ease;
}

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

.footer-copyright {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* ===== صفحة من نحن (About) ===== */
.about-hero {
    padding: 4rem 0 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.about-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1rem;
}

.about-section {
    padding: 4rem 0;
}

.about-section:nth-child(even) {
    background: var(--bg-secondary);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.about-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

/* إحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-top: 3rem;
}

.stat-item {
    text-align: center;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.stat-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* قيمنا */
.values-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 3rem;
}

.value-card {
    text-align: center;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

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

.value-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

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

/* روابط سريعة للأدوات */
.tools-links {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin: 3rem 0;
}

.tool-link-card {
    text-align: center;
    padding: 1.5rem 0.5rem;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.tool-link-card:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.tool-link-card .tool-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* ===== صفحة الخصوصية ===== */
.privacy-container {
    max-width: 900px;
    margin: 3rem auto;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.privacy-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.privacy-header h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.last-updated {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.privacy-content h3 {
    color: var(--primary-color);
    margin: 2rem 0 1rem;
    padding-right: 1rem;
    border-right: 4px solid var(--primary-color);
}

.privacy-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.privacy-content ul {
    margin: 1rem 0 2rem 2rem;
    color: var(--text-secondary);
}

.privacy-content li {
    margin-bottom: 0.5rem;
}

/* ===== إعلانات AdSense ===== */
.adsense-responsive {
    margin: 2rem auto;
    max-width: 100%;
    overflow: hidden;
    border-radius: 16px;
    background: var(--bg-secondary);
    min-height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
}

/* ===== التصميم المتجاوب ===== */
@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tools-links {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        flex-direction: column;
        background: var(--header-bg);
        backdrop-filter: blur(10px);
        width: 70%;
        height: calc(100vh - 70px);
        padding: 2rem;
        transition: right 0.3s ease;
        gap: 1.5rem;
        border-left: 1px solid var(--border-color);
        box-shadow: -5px 0 15px var(--shadow-color);
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu a {
        font-size: 1.1rem;
        width: 100%;
        display: block;
        padding: 0.75rem 0;
    }
    
    .hero {
        padding: 3rem 0;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .values-grid {
        grid-template-columns: 1fr;
    }
    
    .tools-links {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .privacy-container {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input,
    .input-group select {
        width: 100%;
    }
    
    .tools-links {
        grid-template-columns: 1fr;
    }
    
    .stat-item {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* ===== تحسينات الأداء ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== شريط التمرير ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}


/* ===== أنماط محول العملات ===== */
.currency-select {
    min-width: 180px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.currency-select:hover {
    border-color: var(--primary-color);
}

.currency-select option {
    padding: 0.5rem;
    font-family: 'Tajawal', sans-serif;
}

/* تحسين عرض العملات في القائمة */
.currency-select option[value="USD"] { background-color: rgba(37, 99, 235, 0.05); }
.currency-select option[value="SAR"] { background-color: rgba(16, 185, 129, 0.05); }
.currency-select option[value="EGP"] { background-color: rgba(245, 158, 11, 0.05); }

/* تحسين العرض على الجوال */
@media (max-width: 480px) {
    .currency-select {
        min-width: 100%;
        font-size: 0.9rem;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
}


/* ===== أنماط المحتوى الغني SEO ===== */
.seo-content {
    max-width: 1000px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.content-block {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.content-block h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.content-block h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin: 1.5rem 0 1rem;
}

.content-block h4 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 1rem 0 0.5rem;
}

.content-block p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.content-block ul, .content-block ol {
    margin: 1rem 0 1.5rem 2rem;
    color: var(--text-secondary);
}

.content-block li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.content-block .faq-mini {
    margin-top: 1.5rem;
}

.content-block .faq-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.content-block .faq-item h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.tool-content {
    border-right: 4px solid var(--primary-color);
}

.conclusion {
    text-align: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(139, 92, 246, 0.1));
}

@media (max-width: 768px) {
    .content-block h2 {
        font-size: 1.6rem;
    }
    
    .content-block h3 {
        font-size: 1.3rem;
    }
    
    .content-block {
        padding: 1.5rem;
    }
}
