/* ========== الأساسيات ========== */
:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --primary-light: #fdf2f2;
    --bg: #f8f9fa;
    --bg-secondary: #eef0f2;
    --card-bg: #ffffff;
    --white: #ffffff;
    --text: #2c3e50;
    --text-light: #666;
    --border: #e9ecef;
    --shadow: 0 5px 20px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== شريط التنقل ========== */
.navbar {
    background: var(--white);
    box-shadow: 0 2px 15px rgba(0,0,0,0.04);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    text-decoration: none;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 1.8rem;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* محول اللغة */
.lang-switch {
    position: relative;
    cursor: pointer;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #555;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
}

.dark-mode-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.auth-box {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-error {
    background: #ffe0e0;
    color: #c00;
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-align: center;
}

body.dark-mode .auth-box {
    background: var(--white);
}

.nav-link {
    color: #555;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

body.dark-mode .nav-link {
    color: #ccc;
}

body.dark-mode .nav-link:hover {
    background: #2a1a1a;
    color: var(--primary);
}
/* ========== Dark Mode ========== */
body.dark-mode {
    --bg: #1a1a2e;
    --bg-secondary: #0f0f23;
    --card-bg: #16213e;
    --white: #16213e;
    --text: #e0e0e0;
    --text-light: #aaa;
    --border: #2a2a4a;
    --shadow: 0 5px 20px rgba(0,0,0,0.3);
    background: var(--bg);
    color: var(--text);
}

body.dark-mode .navbar {
    background: #0f0f23;
    box-shadow: 0 2px 15px rgba(0,0,0,0.3);
}

body.dark-mode .hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-mode .hero h1 {
    color: #fff;
}

body.dark-mode .hero p {
    color: #ccc;
}

body.dark-mode .tool-card {
    background: var(--white);
    border-color: var(--border);
}

body.dark-mode .tool-card:hover {
    border-color: var(--primary);
}

body.dark-mode .cat-btn {
    background: var(--white);
    border-color: var(--border);
    color: var(--text);
}

body.dark-mode .upload-zone {
    background: var(--white);
    border-color: #3a3a5a;
}

body.dark-mode .upload-zone p {
    color: #aaa;
}

body.dark-mode .tool-option-input {
    background: #1a1a2e;
    border-color: #3a3a5a;
    color: #e0e0e0;
}

body.dark-mode .tool-option-input:focus {
    border-color: var(--primary);
}

body.dark-mode .file-item {
    background: #1a1a2e;
    border-color: #2a2a4a;
}

body.dark-mode .file-item:hover {
    background: #2a1a1a;
}

body.dark-mode .preview-zone {
    background: var(--white);
    border-color: #2a2a4a;
}

body.dark-mode .preview-item,
body.dark-mode .preview-order-item {
    background: #1a1a2e;
}

body.dark-mode .page-preview {
    background: #0f0f23;
    border-color: #3a3a5a;
}

body.dark-mode .page-block {
    background: #1a1a2e;
    border-color: #3a3a4a;
}

body.dark-mode .result-section {
    color: #e0e0e0;
}

body.dark-mode .footer {
    border-color: #2a2a4a;
    color: #aaa;
}

body.dark-mode .ad-banner {
    background: #1a1a2e;
    border-color: #3a3a5a;
    color: #aaa;
}

body.dark-mode .lang-option {
    color: #e0e0e0;
}

body.dark-mode .lang-option:hover {
    background: #1a1a2e;
}

body.dark-mode .dark-mode-toggle {
    color: #ccc;
}

body.dark-mode .dark-mode-toggle:hover {
    background: #2a1a1a;
}
.lang-switch > i {
    font-size: 1.3rem;
    color: #555;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.lang-switch > i:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.lang-dropdown {
    position: absolute;
    top: 130%;
    right: 0;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
}

.lang-switch.active .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    padding: 0.75rem 1.2rem;
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s;
    font-size: 0.9rem;
}

.lang-option:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.lang-option.active {
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
}

[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

/* زر تسجيل الدخول */
.btn-login {
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s;
}

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

/* ========== Hero ========== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text);
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto 2rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.3s;
}

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

/* ========== الحاوية ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ========== إعلان ========== */
.ad-banner {
    text-align: center;
    padding: 1rem;
    background: #f1f3f5;
    border-radius: var(--radius-sm);
    margin-bottom: 2rem;
    color: #888;
    border: 1px dashed #ccc;
}

/* ========== الفئات ========== */
.categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.cat-btn {
    padding: 0.6rem 1.3rem;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    color: var(--text);
    white-space: nowrap;
}

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

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

/* ========== شبكة الأدوات ========== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.2rem;
}

.tool-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.8rem 0.8rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.tool-card i {
    font-size: 2.5rem;
    color: var(--primary);
    transition: transform 0.3s;
}

.tool-card:hover i {
    transform: scale(1.15);
}

.tool-card span {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.4;
}

.tool-card.hidden {
    display: none;
}

/* ========== صفحة الأداة ========== */
.tool-page {
    max-width: 700px;
    margin: 3rem auto;
    text-align: center;
}

.tool-page-header {
    margin-bottom: 2rem;
}

.tool-page-header i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.tool-page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.tool-page-header p {
    color: var(--text-light);
}

/* منطقة الرفع */
.upload-zone {
    background: var(--white);
    border: 2px dashed #ddd;
    border-radius: var(--radius);
    padding: 3rem 2rem;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.upload-zone p {
    font-weight: 500;
    color: var(--text-light);
}

.upload-zone .browse {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
}

/* قائمة الملفات */
.file-list {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
}

[dir="rtl"] .file-list {
    text-align: right;
}

.file-item {
    padding: 0.6rem 0.8rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: grab;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
    user-select: none;
}

.file-item:hover {
    background: #fdf2f2;
    border-color: #e74c3c;
}

.file-item:active {
    cursor: grabbing;
}

.drag-handle {
    color: #999;
    font-size: 1.1rem;
    cursor: grab;
    letter-spacing: -2px;
    margin-right: 0.2rem;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: #999;
    font-size: 0.8rem;
}

.remove-file {
    color: #e74c3c;
    cursor: pointer;
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    transition: all 0.2s;
    margin-left: auto;
}

.remove-file:hover {
    background: #e74c3c;
    color: white;
}

/* خيارات */
.tool-option {
    margin: 1rem 0;
    text-align: left;
}

[dir="rtl"] .tool-option {
    text-align: right;
}

.tool-option label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.tool-option-input {
    width: 100%;
    padding: 0.65rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

.tool-option-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* زر المعالجة */
.btn-process {
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
    margin-top: 1rem;
}

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

.btn-process:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* شريط التقدم */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 1rem;
    display: none;
}

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

/* نتيجة */
.result-section {
    margin-top: 2rem;
    display: none;
}

.result-section.show {
    display: block;
}

.success-icon {
    font-size: 3rem;
    color: #27ae60;
}

/* ========== الفوتر ========== */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

.tool-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 500px) {
    .tool-options-grid {
        grid-template-columns: 1fr;
    }
}

/*----------------------*/

.preview-zone {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: left;
}

.preview-item {
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.3rem;
}

.preview-demo {
    margin-top: 0.5rem;
}


.preview-pages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-file {
    margin-bottom: 0.5rem;
}

.preview-images {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.preview-page-img {
    width: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.preview-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

.preview-image-item {
    text-align: center;
}

.preview-img-name {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.3rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-order {
    text-align: left;
    padding: 0.5rem;
}

.preview-order-item {
    padding: 0.4rem 0.8rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-num {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.preview-demo-box {
    text-align: center;
    padding: 1rem;
}

.page-preview {
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}



.pages-stack {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1rem;
}

.page-block {
    width: 70px;
    height: 90px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    background: #f8f9fa;
    position: relative;
}

.page-block.page-affected {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.page-block.page-affected .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}
/* منع scrolling لما adblock شغال */
body.adblock-blocked {
    overflow: hidden;
    height: 100vh;
}

/* إجبار إعلانات Adsterra على الظهور */
#adsterra-banner,
.adsterra-ad,
[id^="container-"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 300px !important;
    min-height: 90px !important;
    width: 100% !important;
}
/* ========== تجاوب ========== */
@media (max-width: 768px) {
    .navbar {
        padding: 0.6rem 1rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .tool-card {
        padding: 1.2rem 0.5rem;
    }
    
    .tool-card i {
        font-size: 2rem;
    }
    
    .upload-zone {
        padding: 2rem 1rem;
    }
}


/* ========== SEO Sections ========== */
.seo-section {
    background: var(--bg-secondary) !important;
}

.seo-section .seo-card {
    background: var(--card-bg) !important;
    color: var(--text);
}

.seo-section details {
    background: var(--card-bg) !important;
    border-color: var(--border) !important;
    color: var(--text);
}

.seo-section h2,
.seo-section h3 {
    color: var(--text);
}

.seo-section p,
.seo-section summary {
    color: var(--text-light);
}
