/* =====================================================
   THEME & RTL OVERRIDES
   Comprehensive dark mode and Arabic language support
   ===================================================== */

/* === SECTION BACKGROUNDS === */
[data-theme="light"] .hero {
    background: var(--bg-hero);
}

[data-theme="dark"] .hero {
    background: var(--bg-hero);
}

[data-theme="light"] .bio {
    background: var(--bg-secondary);
}

[data-theme="dark"] .bio {
    background: var(--bg-secondary);
}

[data-theme="light"] .practice-areas {
    background: var(--bg-primary);
}

[data-theme="dark"] .practice-areas {
    background: var(--bg-primary);
}

/* === AREA CARDS === */
[data-theme="light"] .area-card {
    background: var(--bg-card);
}

[data-theme="dark"] .area-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .area-card h3 {
    color: var(--text-primary);
}

[data-theme="dark"] .area-card p {
    color: var(--text-secondary);
}

/* === TESTIMONIALS === */
[data-theme="light"] .testimonials {
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-secondary) 100%);
}

[data-theme="dark"] .testimonials {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .testimonials .section-title h2 {
    color: var(--text-primary);
}

[data-theme="dark"] .testimonials .section-title p {
    color: var(--text-secondary);
}

[data-theme="light"] .testimonial-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .testimonial-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: none;
}

[data-theme="light"] .testimonial-text {
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .testimonial-text {
    color: var(--text-secondary);
}

[data-theme="dark"] .testimonial-author h4 {
    color: var(--text-primary);
}

[data-theme="dark"] .testimonial-author p {
    color: var(--gold-accent);
}

[data-theme="dark"] .quote-icon {
    color: var(--gold-accent);
    opacity: 0.5;
}

/* === CONTACT SECTION === */
[data-theme="light"] .contact {
    background: var(--bg-secondary);
}

[data-theme="dark"] .contact {
    background: var(--bg-secondary);
}

[data-theme="light"] .contact-info {
    background: var(--navy-primary);
}

[data-theme="dark"] .contact-info {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

[data-theme="dark"] .contact-info h3 {
    color: var(--text-primary);
}

[data-theme="dark"] .contact-details h4 {
    color: var(--gold-accent);
}

[data-theme="dark"] .contact-details p,
[data-theme="dark"] .contact-details a {
    color: var(--text-primary);
}

[data-theme="dark"] .contact-item {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .contact-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* === CONTACT FORM === */
[data-theme="light"] .contact-form {
    background: var(--bg-card);
}

[data-theme="dark"] .contact-form {
    background: var(--bg-card);
}

[data-theme="dark"] .contact-form h3 {
    color: var(--text-primary);
}

[data-theme="dark"] .form-group label {
    color: var(--text-primary);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .form-group select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
    color: var(--text-tertiary);
}

[data-theme="dark"] .form-group select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* === FOOTER === */
[data-theme="light"] footer {
    background: var(--bg-footer);
}

[data-theme="dark"] footer {
    background: var(--bg-footer);
}

/* === BIO SECTION === */
[data-theme="dark"] .bio-text h2 {
    color: var(--text-primary);
}

[data-theme="dark"] .bio-text h3 {
    color: var(--gold-accent);
}

[data-theme="dark"] .bio-text p {
    color: var(--text-secondary);
}

[data-theme="dark"] .credential-badge {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* === SECTION TITLES === */
[data-theme="dark"] .section-title h2 {
    color: var(--text-primary);
}

[data-theme="dark"] .section-title p {
    color: var(--text-secondary);
}

/* =====================================================
   RTL (RIGHT-TO-LEFT) SUPPORT FOR ARABIC
   ===================================================== */

/* Base RTL direction */
body[dir="rtl"] {
    text-align: right;
}

/* =====================================================
   HEADER & NAVIGATION RTL LAYOUT
   Logo: far right | Nav menu: center | Controls: far left
   ===================================================== */

/* RTL Header - use natural RTL flow instead of row-reverse */
body[dir="rtl"] header {
    direction: rtl;
}

/* Nav container uses flex-direction: row (normal) but RTL direction handles positioning */
body[dir="rtl"] nav {
    flex-direction: row;
    direction: rtl;
}

/* Logo appears first in RTL (on the right) */
body[dir="rtl"] .logo {
    order: 0;
    margin-left: auto;
    margin-right: 0;
}

/* Navigation links in the middle - items naturally flow RTL */
body[dir="rtl"] .nav-links {
    order: 1;
    flex-direction: row;
    direction: rtl;
}

/* Header controls (theme/lang toggles) on the far left */
body[dir="rtl"] .header-controls {
    order: 2;
    flex-direction: row-reverse;
    margin-right: auto;
    margin-left: 0;
}

/* Nav toggle button (mobile) position */
body[dir="rtl"] .nav-toggle {
    order: 3;
    margin-right: auto;
    margin-left: 0;
}

/* Hero section */
body[dir="rtl"] .hero-content {
    text-align: center;
}

body[dir="rtl"] .hero-buttons {
    flex-direction: row;
}

/* Bio section */
body[dir="rtl"] .bio-content {
    direction: rtl;
}

body[dir="rtl"] .bio-text {
    text-align: right;
}

body[dir="rtl"] .credentials {
    justify-content: flex-start;
}

body[dir="rtl"] .bio-image::before {
    left: auto;
    right: -20px;
}

/* Practice Areas */
body[dir="rtl"] .area-card {
    text-align: right;
}

/* Testimonials */
body[dir="rtl"] .testimonial-card {
    text-align: right;
}

body[dir="rtl"] .testimonial-author {
    flex-direction: row-reverse;
}

body[dir="rtl"] .author-info {
    text-align: right;
}

/* Contact section */
body[dir="rtl"] .contact-container {
    direction: ltr;
    /* Keeps Info on Left and Form on Right visually */
}

body[dir="rtl"] .contact-info,
body[dir="rtl"] .contact-form {
    direction: rtl;
    /* Ensures internal content remains RTL */
}

body[dir="rtl"] .contact-item {
    flex-direction: row-reverse;
    text-align: right;
}

body[dir="rtl"] .contact-details {
    text-align: right;
}

body[dir="rtl"] .contact-form {
    text-align: right;
}

body[dir="rtl"] .form-group {
    text-align: right;
}

body[dir="rtl"] .form-group input,
body[dir="rtl"] .form-group textarea,
body[dir="rtl"] .form-group select {
    text-align: right;
    direction: rtl;
}

body[dir="rtl"] .form-row {
    direction: rtl;
}

/* Footer */
body[dir="rtl"] .footer-content {
    direction: rtl;
}

body[dir="rtl"] .footer-section {
    text-align: right;
}

body[dir="rtl"] .footer-links a:hover {
    transform: translateX(-5px);
}

body[dir="rtl"] .social-links {
    flex-direction: row-reverse;
}

/* Mobile navigation RTL */
@media (max-width: 768px) {
    body[dir="rtl"] .nav-links {
        right: auto;
        left: -100%;
        flex-direction: column;
    }

    body[dir="rtl"] .nav-links.active {
        left: 0;
        right: auto;
    }
}

/* Section titles RTL */
body[dir="rtl"] .section-title {
    text-align: center;
}

/* Navigation underline animation RTL */
body[dir="rtl"] .nav-links a::after {
    left: auto;
    right: 0;
}

/* Hide elements by lang */
[data-lang="en"] .lang-ar {
    display: none;
}

[data-lang="ar"] .lang-en {
    display: none;
}

/* Scrollbar styling for RTL */
body[dir="rtl"]::-webkit-scrollbar {
    width: 8px;
}

body[dir="rtl"]::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

body[dir="rtl"]::-webkit-scrollbar-thumb {
    background: var(--gold-accent);
    border-radius: 4px;
}