/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

html, body {
    min-height: 100%;
}

body {
    font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.6;
    overflow-x: hidden;
    text-align: right;
    direction: rtl;
}

.site-header {
    position: static;
    padding: 16px 0;
}

.site-logo {
    width: 160px;
    margin: 0 auto 16px;
    display: block;
}

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

.section {
    min-height: 100vh;
    display: block;
    padding-top: 20px;
    transition: opacity 0.3s ease;
}

#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    overflow: hidden;
}

#loadingState {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#resultState {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FAFAFA;
    font-family: 'Heebo', sans-serif;
    direction: rtl;
    text-align: center;
}

.hidden,
.section.hidden {
    display: none !important;
}

/* Hero Section */
.hero-content {
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
    padding-top: 40px;
}

.hero-title {
    font-size: clamp(2.1rem, 8vw, 3rem);
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 42px;
}

.trust-line {
    margin-top: 32px;
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Buttons */
.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    padding: 18px 32px;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    width: 100%;
    max-width: 100%;
    box-shadow: var(--shadow);
    margin-top: 16px;
}

#requestTowBtn {
    width: 100%;
    max-width: 390px;
    min-height: 72px;
    border-radius: 18px;
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.btn-large {
    padding: 24px 40px;
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    border-color: var(--accent);
    background-color: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-small {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-small:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent);
}

.btn-location {
    background-color: transparent;
    color: var(--text-primary);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    letter-spacing: 0.025em;
}

.btn-location:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-location:active {
    transform: translateY(0);
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-location.loading {
    pointer-events: none;
    opacity: 0.8;
    border-color: rgba(255, 255, 255, 0.4);
}

.location-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.btn-location:hover .location-icon {
    transform: scale(1.1);
}

.btn-location.success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.btn-location.success:hover {
    background-color: rgba(16, 185, 129, 0.15);
}

.btn-location.error {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.btn-location.error:hover {
    background-color: rgba(239, 68, 68, 0.15);
}

/* Checkbox Styles */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
    border: 2px solid var(--border);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    transition: all 0.2s ease;
}

.checkbox-container input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkbox-label {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.checkbox-label:hover {
    color: var(--accent);
}

/* Destination Field Animation */
#destinationGroup {
    transition: all 0.3s ease;
    overflow: hidden;
}

#destinationGroup.hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

#destinationGroup:not(.hidden) {
    max-height: 200px;
    opacity: 1;
}

/* Form Styles */
.form-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 28px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
}

input, select {
    width: 100%;
    padding: 16px 48px 16px 16px;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    appearance: none;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

select {
    padding-right: 16px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23b0b0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 40px;
}

/* Loading State */
.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-logo {
    width: 120px;
    margin-bottom: 24px;
}

.loading-card {
    background: white;
    border-radius: 20px;
    padding: 32px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    text-align: center;
    max-width: 340px;
    width: 100%;
}

.loader {
    width: 56px;
    height: 56px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.loading-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.loading-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Result State */
.result-content {
    max-width: 420px;
    margin: 0 auto;
    padding: 16px 12px 20px;
}

@media (max-width: 480px) {
    .result-content {
        padding: 12px 8px 16px;
    }
    
    .unified-card {
        max-width: 100%;
        margin: 12px 0 12px;
    }
    
    .result-actions {
        max-width: 100%;
        margin: 8px 0 12px;
    }
    
    .result-trust-lines {
        max-width: 100%;
        margin: 12px 0 0;
    }
    
    .success-icon {
        width: 72px;
        height: 72px;
    }
}

.success-indicator {
    margin-bottom: 16px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: transparent;
    border: 4px solid #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: #10b981;
    position: relative;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 4px;
    color: #1a1a1a;
    font-family: 'Heebo', sans-serif;
}

.result-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 12px;
    font-weight: 400;
    font-family: 'Heebo', sans-serif;
}

/* Info Card - Time, Price & Driver */
.info-card {
    width: 100%;
    max-width: 380px;
    margin: 16px auto 12px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    font-family: 'Heebo', sans-serif;
    overflow: hidden;
}

/* Time Hero Section */
.time-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.time-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.time-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
    font-family: 'Heebo', sans-serif;
}

.time-value {
    font-size: 2rem;
    font-weight: 900;
    color: #10b981;
    font-family: 'Heebo', sans-serif;
    line-height: 1.1;
}

/* Integrated Price Section */
.price-integrated {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
    background: transparent;
    border: none;
}

.price-label {
    font-size: 0.9rem;
    color: #92400e;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
    margin-bottom: 4px;
}

.price-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ea580c;
    font-family: 'Heebo', sans-serif;
}

.price-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(249, 115, 22, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: #f97316;
    font-size: 1.1rem;
    font-weight: 800;
}

/* Integrated Driver Section */
.driver-section {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 12px;
}

.driver-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #f3f4f6;
    flex-shrink: 0;
}

.driver-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.status-dot.online {
    background: #10b981;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.driver-details {
    flex: 1;
    text-align: right;
}

.driver-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
    font-family: 'Heebo', sans-serif;
}

.driver-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rating-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.star {
    color: #f59e0b;
}

.certified-badge {
    background: #dcfce7;
    color: #166534;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
}

/* RTL Support - Ensured throughout */
.unified-card,
.time-hero,
.price-integrated,
.driver-section,
.result-content,
.result-trust-lines,
.result-trust-line {
    direction: rtl;
    text-align: right;
}

/* SVG Icon RTL Support */
.trust-symbol svg,
.star svg,
.btn-icon svg {
    direction: ltr; /* Keep SVG icons in their natural direction */
}

/* Preserved IDs for JavaScript functionality - no styling changes needed */

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Result Actions */
.result-actions {
    width: 100%;
    max-width: 380px;
    margin: 8px auto 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-actions .btn-primary {
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Heebo', sans-serif;
    position: relative;
    overflow: hidden;
}

.result-actions .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.result-actions .btn-primary:hover::before {
    left: 100%;
}

.result-actions .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

.result-actions .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(255, 107, 53, 0.3);
}

.result-actions .btn-primary .btn-icon {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.result-actions .btn-secondary {
    height: 52px;
    border-radius: 12px;
    background: #ffffff;
    border: 2px solid #f97316;
    color: #f97316;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Heebo', sans-serif;
    position: relative;
}

.result-actions .btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.result-actions .btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.result-actions .btn-secondary .btn-icon {
    width: 22px;
    height: 22px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.result-actions .btn-secondary:hover .btn-icon {
    background: #e5e7eb;
}

.helper-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
}

/* Trust Section */
.result-trust-lines {
    width: 100%;
    max-width: 380px;
    margin: 24px auto 0;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.result-trust-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 16px 0;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: 'Heebo', sans-serif;
}

.result-trust-line:hover {
    background: #f9fafb;
    transform: translateY(-1px);
}

.trust-symbol {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.trust-symbol.green {
    background: #dcfce7;
    color: #16a34a;
}

.trust-symbol.gray {
    background: #f3f4f6;
    color: #6b7280;
}

.reassurance-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    opacity: 0.9;
}

/* Trust Section */
.trust-section {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.trust-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trust-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: right;
    padding: 14px 16px;
    border-radius: 16px;
    background-color: #f8fafc;
    border: 1px solid var(--border);
    width: 100%;
}

.trust-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    color: var(--accent);
}

.trust-item h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.trust-item p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }
    
    #hero {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 32px 0;
    }

    .site-logo {
        width: 140px;
        max-width: 75vw;
    }

    .hero-content {
        padding-top: 32px;
    }

    .hero-title {
        font-size: 2.25rem;
        line-height: 1.25;
    }

    .hero-subtitle {
        font-size: 1.05rem;
        line-height: 1.7;
        margin-bottom: 40px;
    }

    #requestTowBtn {
        max-width: 390px;
        min-height: 72px;
    }
    
    .btn-large {
        padding: 20px 32px;
        font-size: 1.125rem;
    }
    
    .form-container {
        padding: 24px 20px;
    }
    
    .form-title {
        font-size: 1.375rem;
    }
    
    .loading-content {
        padding: 32px 24px;
    }
    
    .result-content {
        padding: 32px 24px;
    }
    
    .result-title {
        font-size: 1.5rem;
    }
}

@media (min-width: 768px) {
    .action-buttons {
        flex-direction: row;
        gap: 16px;
    }
    
    .action-buttons button {
        flex: 1;
    }
}

/* Smooth transitions */
.section {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus states for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Loading animation for form submission */
.form-loading {
    pointer-events: none;
    opacity: 0.6;
}

.form-loading button {
    position: relative;
    color: transparent;
}

.form-loading button::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}
