/* ===== CSS Variables & Theme ===== */
:root {
    --primary: #006233;
    --primary-light: #00844a;
    --primary-dark: #004d28;
    --accent: #d52b1e;
    --accent-light: #e8453a;
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: #006233;
    --text: #1a1a2e;
    --text-secondary: #555;
    --text-muted: #888;
    --border: #e0e0e0;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.14);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s ease;
    --font-ar: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --font-fr: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}

[data-theme="dark"] {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-header: #003d1f;
    --text: #e6edf3;
    --text-secondary: #adbac7;
    --text-muted: #768390;
    --border: #30363d;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-hover: 0 6px 24px rgba(0,0,0,0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ar);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

body[dir="ltr"] {
    font-family: var(--font-fr);
}

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

/* ===== Header ===== */
.header {
    background: var(--bg-header);
    color: white;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2.2rem;
}

.logo-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
    font-weight: 300;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.lang-toggle, .theme-toggle {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    border-radius: 50px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    font-family: var(--font-fr);
}

.theme-toggle {
    padding: 8px 12px;
}

.lang-toggle:hover, .theme-toggle:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, rgba(0, 98, 51, 0.95) 0%, rgba(0, 77, 40, 0.95) 100%), 
                url('https://images.unsplash.com/photo-1577416416829-d68786a59910?q=80&w=2000&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 60px 0 70px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid var(--accent);
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.3) 100%);
    z-index: 0;
}

.hero-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-desc {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--primary);
    opacity: 0.8;
}

[dir="rtl"] .search-icon {
    right: 18px;
}

[dir="ltr"] .search-icon {
    left: 18px;
}

.search-input {
    width: 100%;
    padding: 16px 52px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 4px 25px rgba(0,0,0,0.2);
    transition: all var(--transition);
    outline: none;
}

.search-input:focus {
    box-shadow: 0 4px 30px rgba(0,0,0,0.25);
    transform: scale(1.02);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ===== Stats Bar ===== */
.stats-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
    transition: background var(--transition);
}

.stats-inner {
    display: flex;
    justify-content: center;
    gap: 60px;
}

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

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

[data-theme="dark"] .stat-number {
    color: var(--primary-light);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Filter Tabs ===== */
.filter-section {
    padding: 24px 0 8px;
    position: sticky;
    top: 64px;
    z-index: 90;
    background: var(--bg);
    transition: background var(--transition);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    -ms-overflow-style: none;
}

.filter-tabs::-webkit-scrollbar {
    height: 4px;
}

.filter-tabs::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.filter-tab {
    white-space: nowrap;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}

.filter-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== Procedures Grid ===== */
.main-content {
    padding: 24px 0 60px;
}

.procedures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* ===== Procedure Card ===== */
.procedure-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.procedure-card::before {
    content: '';
    position: absolute;
    top: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity var(--transition);
}

[dir="rtl"] .procedure-card::before {
    right: 0;
}

[dir="ltr"] .procedure-card::before {
    left: 0;
}

.procedure-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.procedure-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 98, 51, 0.08);
    border-radius: var(--radius-sm);
    color: var(--primary);
}

.card-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    display: block;
}

[data-theme="dark"] .card-icon {
    background: rgba(0, 132, 74, 0.15);
    color: var(--primary-light);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
}

.card-category {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--primary);
    background: rgba(0, 98, 51, 0.08);
    padding: 3px 10px;
    border-radius: 50px;
    margin-top: 4px;
    font-weight: 600;
}

[data-theme="dark"] .card-category {
    color: var(--primary-light);
    background: rgba(0, 132, 74, 0.15);
}

.card-docs-preview {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.card-docs-preview span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-doc-count {
    font-weight: 700;
    color: var(--accent);
}

.card-arrow {
    position: absolute;
    bottom: 24px;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

[dir="rtl"] .card-arrow {
    left: 24px;
}

[dir="ltr"] .card-arrow {
    right: 24px;
}

.procedure-card:hover .card-arrow {
    color: var(--primary);
}

[dir="rtl"] .procedure-card:hover .card-arrow {
    transform: translateX(-4px);
}

[dir="ltr"] .procedure-card:hover .card-arrow {
    transform: translateX(4px);
}

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.no-results p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 10;
    line-height: 1;
}

[dir="rtl"] .modal-close {
    left: 16px;
}

[dir="ltr"] .modal-close {
    right: 16px;
}

.modal-close:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 30px 28px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.modal-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    display: block;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-category {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.modal-body {
    padding: 28px;
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.documents-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.documents-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    line-height: 1.5;
    border: 1px solid var(--border);
    transition: background var(--transition);
}

.documents-list li::before {
    content: '✅';
    flex-shrink: 0;
    font-size: 1rem;
}

.notes-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notes-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(213, 43, 30, 0.05);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid rgba(213, 43, 30, 0.1);
    color: var(--text-secondary);
}

.notes-list li::before {
    content: '⚠️';
    flex-shrink: 0;
}

.modal-where {
    padding: 12px 16px;
    background: rgba(0, 98, 51, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 98, 51, 0.1);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.resource-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resource-links li a,
.resource-links li .template-download-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.92rem;
    transition: all var(--transition);
    font-family: inherit;
    text-align: start;
    cursor: pointer;
}

.resource-links li a:hover,
.resource-links li .template-download-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 98, 51, 0.08);
}

.request-template {
    margin: 0;
    padding: 14px;
    white-space: pre-wrap;
    line-height: 1.65;
    font-family: inherit;
    font-size: 0.92rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}

/* ===== SEO Content ===== */
.seo-content {
    padding: 32px 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    transition: background var(--transition);
}

.seo-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.seo-desc {
    color: var(--text-secondary);
    margin-bottom: 18px;
    font-size: 0.95rem;
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.seo-category-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.seo-category-title {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.seo-procedure-item + .seo-procedure-item {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.seo-procedure-title {
    font-size: 0.92rem;
    margin-bottom: 6px;
    color: var(--text);
}

.seo-doc-list {
    margin: 0;
    padding-inline-start: 18px;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.45;
}

.seo-doc-list li + li {
    margin-top: 3px;
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 28px 0;
    text-align: center;
    transition: background var(--transition);
}

.footer-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.footer-disclaimer {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.4rem;
    }

    .hero-desc {
        font-size: 0.95rem;
    }

    .procedures-grid {
        grid-template-columns: 1fr;
    }

    .stats-inner {
        gap: 30px;
    }

    .logo-title {
        font-size: 1.3rem;
    }

    .logo-subtitle {
        font-size: 0.7rem;
    }

    .filter-section {
        top: 58px;
    }

    .modal {
        max-height: 90vh;
    }

    .modal-header {
        padding: 24px 20px;
    }

    .modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stats-inner {
        gap: 20px;
    }

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

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

    .search-input {
        padding: 14px 46px;
        font-size: 0.9rem;
    }

    .filter-tab {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Print Styles ===== */
@media print {
    .header, .hero, .stats-bar, .filter-section, .footer {
        display: none;
    }

    .procedure-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
