/* RTL Overrides for Arabic Version */
/* This file should be loaded after styles.css in the Arabic version */

/* ========== BASE RTL SETUP ========== */
body {
    direction: rtl;
    font-family: 'Tajawal', 'Open Sans', 'Segoe UI', Tahoma, sans-serif;
    letter-spacing: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Import Tajawal font */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');

/* ========== CONTAINER AND LAYOUT FIXES ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Remove default margins */
* {
    margin-inline-start: 0;
    margin-inline-end: 0;
}

/* ========== NAVIGATION RTL ========== */
.navbar {
    direction: rtl;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: white;
}

.navbar .container {
    flex-direction: row-reverse;
    padding: 1rem 20px;
}

.nav-brand {
    margin-left: auto;
    margin-right: 0;
}

.nav-brand.has-horizontal-logo span {
    display: inline-block;
    margin-right: 10px;
    margin-left: 0;
}

.nav-menu {
    flex-direction: row-reverse;
    margin-left: 0;
    margin-right: auto;
}

.nav-link {
    margin-left: 0;
    margin-right: 2rem;
}

.nav-menu li:last-child .nav-link {
    margin-right: 0;
}

.nav-link::after {
    right: 0;
    left: auto;
}

.hamburger {
    margin-left: 0;
    margin-right: auto;
    order: -1;
}

/* ========== MOBILE NAVIGATION RTL ========== */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        right: -100%;
        left: auto;
        top: 70px;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: white;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        z-index: 998;
        overflow-y: auto;
        flex-direction: column;
        padding: 2rem 0;
        text-align: right;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    /* Remove overlay pseudo-element */
    .nav-menu::before,
    .nav-menu::after {
        display: none !important;
    }
    
    .nav-menu li {
        margin: 1rem 0;
    }
}

/* ========== SECTIONS RTL ========== */
.section {
    direction: rtl;
    padding: 80px 0;
    width: 100%;
    box-sizing: border-box;
}

.section-title,
.section-subtitle {
    text-align: center;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 50px 0 100px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    direction: rtl;
    text-align: center;
    justify-items: center;
}

.stat-item {
    width: 100%;
    text-align: center;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

/* ========== CONTENT SECTIONS RTL ========== */

/* Challenge Cards */
.challenges-grid {
    direction: rtl;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.challenge-card {
    text-align: right;
}

.challenge-card ul {
    padding-right: 0;
    padding-left: 1.5rem;
}

.challenge-card li {
    text-align: right;
}

/* Solutions Tabs */
.tab-buttons {
    flex-direction: row-reverse;
}

.tab-content {
    text-align: right;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    justify-items: center;
}

.feature {
    text-align: center;
    width: 100%;
}

.feature i,
.feature h4,
.feature p {
    text-align: center;
    margin: 0 auto;
}

/* Security Plan */
.security-plan {
    direction: rtl;
}

.phase {
    text-align: right;
}

.phase ul {
    padding-right: 0;
    padding-left: 1.5rem;
}

.phase li {
    text-align: right;
    padding-right: 1.5rem;
    padding-left: 0;
    position: relative;
}

.phase li::before {
    right: 0;
    left: auto;
}

/* Renovation Items */
.renovation-items {
    direction: rtl;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.reno-item {
    text-align: center;
}

/* ========== BUDGET SECTION RTL ========== */
.budget-types {
    direction: rtl;
}

.budget-card {
    text-align: right;
}

.budget-icon {
    margin: 0 auto 20px;
}

.budget-info {
    text-align: right;
}

.budget-list {
    padding: 0;
}

.budget-list li {
    display: flex;
    flex-direction: row-reverse;
    text-align: right;
}

.budget-list i {
    margin-left: 10px;
    margin-right: 0;
}

.legal-note {
    display: flex;
    flex-direction: row-reverse;
    text-align: right;
}

.legal-note i {
    margin-left: 10px;
    margin-right: 0;
}

.payment-options {
    text-align: right;
}

.option {
    display: flex;
    flex-direction: row-reverse;
    text-align: right;
}

.option i {
    margin-left: 10px;
    margin-right: 0;
}

/* ========== TRANSPARENCY SECTION RTL ========== */
.transparency-section {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 25px;
    padding: 50px;
    margin-top: 50px;
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
    overflow: hidden;
    direction: rtl;
    text-align: right;
}

/* Background pattern */
.transparency-section::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

.transparency-section h3 {
    position: relative;
    z-index: 1;
    font-size: 28px;
    margin-bottom: 30px;
    text-align: center;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row-reverse;
}

.transparency-section h3 i {
    font-size: 36px;
    margin-left: 15px;
    margin-right: 0;
    vertical-align: middle;
}

.transparency-content {
    position: relative;
    z-index: 1;
    direction: rtl;
}

.transparency-content > p {
    font-size: 18px;
    text-align: center;
    margin-bottom: 15px;
    opacity: 0.95;
}

.transparency-content ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    direction: rtl;
}

.transparency-content li {
    padding: 15px;
    display: flex;
    flex: 0 1 calc(50% - 20px);
    align-items: flex-start;
    margin: 10px;
    border-radius: 10px;
    transition: all 0.3s ease;
    flex-direction: row; /* Changed from row-reverse to row */
    text-align: right;
    direction: rtl;
}

.transparency-content li:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Icon styling - positioned on the right */
.transparency-content li i {
    color: #4caf50;
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    margin-right: 0;
    margin-left: 12px; /* Space between icon and text */
    order: -1; /* This ensures icon comes first (right side in RTL) */
}

/* Text content */
.transparency-content li span {
    flex: 1;
    text-align: right;
    direction: rtl;
}

.transparency-content li strong {
    display: inline;
    color: white;
    font-weight: 600;
    margin: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .transparency-section {
        padding: 30px 20px;
        text-align: right;
    }
    
    .transparency-content ul {
        flex-direction: column;
    }
    
    .transparency-content li {
        flex: 1 1 100%;
        margin: 5px 0;
        padding: 12px;
    }
    
    .transparency-section h3 {
        font-size: 22px;
        flex-wrap: wrap;
    }
    
    .transparency-section h3 i {
        margin-left: 10px;
        font-size: 28px;
    }
    
    .transparency-content li i {
        margin-left: 10px;
    }
}

/* Animation keyframe */
@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0.1; }
}

/* ========== TIMELINE RTL ========== */
.timeline-modern {
    background: #ffffff;
    padding: 80px 0;
    direction: rtl;
}

.timeline-wrapper {
    direction: ltr; /* Keep timeline structure LTR */
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.timeline-item {
    direction: rtl;
    position: relative;
    margin-bottom: 80px;
    display: block;
}

.timeline-badge {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    border-radius: 50%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    border: 4px solid white;
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.3);
    z-index: 3;
    top: -30px;
}

.timeline-panel {
    background: white;
    border-radius: 15px;
    padding: 50px 30px 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 45%;
    margin-top: 30px;
    text-align: right;
    direction: rtl;
}

.timeline-panel::before {
    display: none;
}

.timeline-heading {
    text-align: right;
    direction: rtl;
}

.timeline-body {
    text-align: right;
    direction: rtl;
}

.timeline-body ul {
    padding-right: 0;
    padding-left: 1.5rem;
    list-style: none;
}

.timeline-body li {
    padding: 8px 0;
    padding-right: 25px;
    padding-left: 0;
    text-align: right;
    position: relative;
}

.timeline-body li::before {
    content: '✓';
    position: absolute;
    right: 0;
    left: auto;
    color: var(--success);
    font-weight: bold;
}

.timeline-date {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
    margin-top: 5px;
}

/* Desktop Timeline RTL */
@media (min-width: 1024px) {
    .timeline-line {
        right: 50%;
        left: auto;
        transform: translateX(50%);
    }
    
    .timeline-item.right .timeline-panel {
        float: left;
        margin-right: 55%;
        margin-left: 0;
    }
    
    .timeline-item.right .timeline-badge {
        right: 77.5%;
        left: auto;
        transform: translateX(50%);
    }
    
    .timeline-item.left .timeline-panel {
        float: right;
        margin-left: 55%;
        margin-right: 0;
    }
    
    .timeline-item.left .timeline-badge {
        right: 22.5%;
        left: auto;
        transform: translateX(50%);
    }
}

/* Mobile Timeline RTL */
@media (max-width: 1023px) {
    .timeline-line {
        right: 30px;
        left: auto;
    }
    
    .timeline-badge {
        right: 30px;
        left: auto;
        transform: translateX(50%);
        top: -30px;
    }
    
    .timeline-panel {
        width: calc(100% - 90px);
        margin-right: 90px !important;
        margin-left: 0 !important;
        float: none !important;
        padding-top: 50px;
    }
}

/* ========== FORMS RTL ========== */
.survey-form,
.contact-form {
    text-align: right;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.form-group {
    text-align: right;
}

.form-group input,
.form-group select,
.form-group textarea {
    text-align: right;
    direction: rtl;
}

.rating-scale {
    flex-direction: row-reverse;
}

.radio-group {
    align-items: flex-start;
}

.radio-group label {
    text-align: right;
}

.priority-list {
    direction: rtl;
}

.priority-item {
    flex-direction: row-reverse;
}

.priority-item label {
    text-align: right;
}

.survey-actions {
    text-align: center;
}

.privacy-note {
    text-align: center;
    flex-direction: row-reverse;
}

.privacy-note i {
    margin-left: 5px;
    margin-right: 0;
}

/* Contact Section */
.contact-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.contact-info {
    text-align: center;
    width: 100%;
}

.info-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.info-item i {
    order: 2;
    margin: 0;
}

/* ========== FOOTER RTL ========== */
.footer {
    direction: rtl;
    text-align: right;
    width: 100%;
    padding: 3rem 0 1rem;
}

.footer-content {
    direction: rtl;
}

.footer ul {
    padding-right: 0;
}

.footer-bottom {
    text-align: center;
}

/* ========== RESPONSIVE RTL ========== */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .section {
        padding: 60px 0;
    }
    
    .hero {
        padding: 40px 0 80px;
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 0 15px;
    }
    
    .stat-item {
        padding: 1.5rem 1rem;
        min-height: 120px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .hero-stats {
        gap: 0.75rem;
        padding: 0 10px;
    }
    
    .stat-item {
        padding: 1.2rem 0.5rem;
        min-height: 110px;
    }
}

/* ========== UTILITY CLASSES RTL ========== */
.text-left {
    text-align: right !important;
}

.text-right {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

/* Text elements */
h1, h2, h3, h4, h5, h6, p {
    text-align: inherit;
    margin-left: 0;
    margin-right: 0;
}

/* Icons */
i.fas, i.far, i.fab {
    display: inline-block;
}

/* Form elements */
input[type="checkbox"],
input[type="radio"] {
    margin-left: 5px;
    margin-right: 0;
}

select {
    background-position: left 0.7rem center;
    padding-right: 1rem;
    padding-left: 2.5rem;
}

/* Animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: slideInRight 0.5s ease-out forwards;
}

/* ========== OVERRIDE FIXES ========== */
/* Ensure full width sections */
.hero,
.challenges,
.solutions,
.budgets-explanation,
.timeline-modern,
.feedback-survey,
.contact,
.footer {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Remove any extra margins */
body > * {
    max-width: 100%;
    overflow-x: hidden;
}

/* Print styles */
@media print {
    body {
        direction: rtl;
    }
    
    .section {
        text-align: right;
    }
}


/* ========== HERO COUNTER RTL ========== */
.hero-counter {
    margin-top: 20px;
    font-size: 18px;
    opacity: 0.9;
    direction: rtl;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-direction: row-reverse;
}

.hero-counter .separator {
    margin: 0 15px;
}

.hero-counter strong {
    color: var(--secondary-color);
    font-size: 20px;
    font-weight: 700;
    margin: 0 5px;
}

.hero-counter i {
    font-size: 16px;
    margin: 0 5px;
}

.hero-counter i.fa-circle {
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .hero-counter {
        font-size: 16px;
        flex-wrap: wrap;
        line-height: 1.5;
    }
    
    .hero-counter strong {
        font-size: 18px;
    }
    
    .hero-counter .separator {
        display: none;
    }
}