/* =============================================================== */
/* === Unified Stylesheet with Light & Dark Mode Support === */
/* =============================================================== */

:root {
    /* --- Light Mode Colors (Default) --- */
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-app: white;
    --bg-card: white;
    --bg-card-alt: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;

    /* --- Brand & Accent Colors (Shared between modes) --- */
    --primary: #eb4625;
    --primary-dark: #152963;
    --primary-light: #f57c63;
    --secondary: #10b981;
    --danger: #ef4444;
    --success: #10b981;

    /* --- Universal Styles --- */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
}

body.dark-mode {
    /* --- Dark Mode Color Overrides --- */
    --bg-primary: #111827; /* Dark blue background */
    --bg-app: #1f2937; /* Darker app container */
    --bg-card: #374151; /* Card background */
    --bg-card-alt: #1f2937; /* Alternative card background */
    --text-primary: #f8fafc; /* Light text */
    --text-secondary: #9ca3af; /* Lighter gray text */
    --border-color: #4b5563; /* Gray border for dark mode */

    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}


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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 0;
    direction: rtl;
    transition: background 0.3s ease;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    background-color: var(--bg-app);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow-x: hidden;
    padding-bottom: 80px;
    transition: var(--transition);
}


/* --- Header & Logo --- */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px 15px;
    text-align: center;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.header a { text-decoration: none; color: inherit; }
.logo { font-size: 28px; font-weight: 800; margin-bottom: 5px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.logo i { font-size: 32px; }
.tagline { font-size: 14px; opacity: 0.9; margin-bottom: 10px; }


/* --- Card Styles --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-title i { color: var(--primary); }


/* --- Form & Input Styles --- */
.form-input {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: var(--transition);
    margin-bottom: 15px;
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(235, 70, 37, 0.1);
    outline: none;
}
.input-container {
    display: flex;
    align-items: center;
    background: var(--bg-app);
    border-radius: 10px;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(235, 70, 37, 0.1);
}
.input-field {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    direction: ltr;
    background: transparent;
}


/* --- Buttons --- */
.btn { display: block; width: 100%; padding: 16px; border: none; border-radius: 10px; font-size: 16px; font-weight: 700; cursor: pointer; transition: var(--transition); text-align: center; font-family: 'Cairo', sans-serif; margin-top: 20px; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-secondary { background: var(--border-color); color: var(--text-primary); }
.btn-secondary:hover { background: #9ca3af; }


/* --- Index Page Specific --- */
.converter { background: var(--bg-card-alt); border-left: 4px solid var(--primary); }
.input-label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-primary); font-size: 14px; }
.currency { font-weight: 600; color: var(--primary); margin-left: 10px; font-size: 14px; }
.conversion-arrow { text-align: center; margin: 15px 0; color: var(--primary); font-size: 24px; }
.info-text { font-size: 13px; color: var(--text-secondary); text-align: center; margin-top: 10px; }


/* --- Global Elements (Footer, WhatsApp, etc.) --- */
.footer-nav {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    max-width: 500px;
    margin: 0 auto;
    background: var(--bg-app);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 100;
    border-top: 1px solid var(--border-color);
    transition: var(--transition);
}
.nav-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-secondary); font-size: 12px; transition: var(--transition); padding: 5px 10px; border-radius: 10px; }
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; margin-bottom: 5px; }


/* --- All other styles from the original unified file --- */
/* (I've included them below to ensure everything is covered) */
.status-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; background-color: rgba(255, 255, 255, 0.1); border-radius: 50px; margin-top: 10px; font-size: 13px; backdrop-filter: blur(10px); }
.status-item { display: flex; align-items: center; gap: 5px; }
.main-content { padding: 20px 15px; }
.alert { padding: 15px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; text-align: center; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.input-group { margin-bottom: 15px; }
.important-note { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 15px; margin-top: 20px; }
.note-title { color: #dc2626; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.note-title i { color: #dc2626; font-size: 18px; }
.note-list { list-style: none; padding: 0; }
.note-list li { margin-bottom: 8px; padding-right: 25px; position: relative; font-size: 14px; color: #991b1b; font-weight: 500; }
.note-list li::before { content: '⚠️'; position: absolute; right: 0; }
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-top: 20px; }
.feature-card { background: var(--bg-card); border-radius: 10px; padding: 15px; text-align: center; box-shadow: var(--shadow); transition: var(--transition); border: 1px solid var(--border-color); }
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 24px; margin-bottom: 10px; color: var(--primary); }
.feature-title { font-size: 14px; font-weight: 700; margin-bottom: 5px; color: var(--text-primary); }
.feature-desc { font-size: 12px; color: var(--text-secondary); }
.operational-hours { background: #fffbeb; border: 1px solid #fef3c7; border-radius: 10px; padding: 12px 15px; margin-bottom: 20px; text-align: center; font-size: 14px; color: #92400e; }
.operational-hours i { margin-left: 5px; }
.modal { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, 0.7); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.active { display: flex; }
.modal-content { background: var(--bg-card); border-radius: 20px; padding: 25px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { text-align: center; margin-bottom: 20px; }
.modal-title { font-size: 22px; font-weight: 700; color: var(--success); margin-bottom: 10px; }
.modal-body { margin-bottom: 20px; }
.modal-info { background: var(--bg-app); border-radius: 10px; padding: 15px; margin-bottom: 15px; text-align: center; }
.modal-info-title { font-weight: 700; margin-bottom: 5px; color: var(--primary); }
.modal-info-value { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { margin-top: 0; }
.search-tabs { display: flex; margin-bottom: 20px; border-bottom: 2px solid var(--border-color); background: var(--bg-card); border-radius: 10px; padding: 5px; }
.search-tabs .tab-link { flex: 1; padding: 12px; cursor: pointer; font-size: 14px; color: var(--text-secondary); border-radius: 8px; transition: var(--transition); text-align: center; font-weight: 600; }
.search-tabs .tab-link:hover { color: var(--primary); background: #fff4f2; }
body.dark-mode .search-tabs .tab-link:hover { background: #4b5563; }
.search-tabs .tab-link.active { color: var(--primary); background: #feece8; box-shadow: var(--shadow); }
body.dark-mode .search-tabs .tab-link.active { background: #374151; }
.search-content { display: none; animation: fadeIn 0.5s; }
.search-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.order-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px; margin-bottom: 15px; box-shadow: var(--shadow); border: 1px solid var(--border-color); transition: var(--transition); }
.order-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.order-id { font-size: 18px; font-weight: 800; color: var(--primary); }
.order-date { font-size: 14px; color: var(--text-secondary); }
.order-details { margin-bottom: 10px; }
.order-detail-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding: 8px 0; }
.order-detail-label { font-weight: 600; color: var(--text-primary); }
.order-detail-value { color: var(--text-secondary); font-weight: 500; }
.status-badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; text-align: center; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-paid { background: #dbeafe; color: #1e40af; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.back-home { display: inline-block; padding: 10px 20px; background: var(--primary); color: white; text-decoration: none; border-radius: 8px; margin-bottom: 20px; transition: var(--transition); }
.back-home:hover { background: var(--primary-dark); transform: translateY(-2px); }
.whatsapp-float { position: fixed; bottom: 80px; left: 15px; width: 60px; height: 60px; background: #25D366; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 100; animation: pulse 2s infinite; text-decoration: none; }
.whatsapp-float i { font-size: 28px; }
@keyframes pulse { from { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); } to { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); } }

/* =============================================================== */
/* === ENHANCED UI IMPROVEMENTS === */
/* =============================================================== */

/* --- Loading States --- */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Form Error States --- */
.form-input.error,
.input-container.error {
    border-color: var(--danger);
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-message {
    display: none;
    color: var(--danger);
    font-size: 13px;
    margin-top: -10px;
    margin-bottom: 10px;
    padding: 5px 10px;
    background: #fef2f2;
    border-radius: 6px;
    border-right: 3px solid var(--danger);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Toast Notifications --- */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.3s ease-out;
    max-width: 350px;
    border-right: 4px solid;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-color: var(--success);
    color: var(--success);
}

.toast-error {
    border-color: var(--danger);
    color: var(--danger);
}

.toast-info {
    border-color: var(--primary);
    color: var(--primary);
}

.toast i {
    font-size: 20px;
}

/* --- Input Highlight Animation --- */
.input-container.highlight {
    animation: highlight 0.3s ease-out;
}

@keyframes highlight {
    0% { background-color: rgba(235, 70, 37, 0.1); }
    100% { background-color: transparent; }
}

/* --- Enhanced Responsive Design --- */
@media (max-width: 768px) {
    .app-container {
        max-width: 100%;
        border-radius: 0;
    }
    
    .header {
        border-radius: 0;
        padding: 15px 10px;
    }
    
    .logo {
        font-size: 24px;
    }
    
    .tagline {
        font-size: 12px;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }
    
    .main-content {
        padding: 15px 10px;
    }
    
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .modal-content {
        max-width: 90%;
        padding: 20px;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
    
    .whatsapp-float {
        bottom: 90px;
        left: 10px;
        width: 50px;
        height: 50px;
    }
    
    .whatsapp-float i {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 20px;
    }
    
    .logo i {
        font-size: 24px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .form-input {
        padding: 12px;
        font-size: 14px;
    }
    
    .btn {
        padding: 14px;
        font-size: 15px;
    }
    
    .input-field {
        font-size: 16px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-info-value {
        font-size: 18px;
    }
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

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

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Success Checkmark Animation --- */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.success-checkmark .check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid var(--success);
}

.success-checkmark .check-icon::before {
    top: 3px;
    left: -2px;
    width: 30px;
    transform-origin: 100% 50%;
    border-radius: 100px 0 0 100px;
}

.success-checkmark .check-icon::after {
    top: 0;
    left: 30px;
    width: 60px;
    transform-origin: 0 50%;
    border-radius: 0 100px 100px 0;
    animation: rotate-circle 4.25s ease-in;
}

.success-checkmark .check-icon::before,
.success-checkmark .check-icon::after {
    content: '';
    height: 100px;
    position: absolute;
    background: var(--bg-card);
    transform: rotate(-45deg);
}

.success-checkmark .icon-line {
    height: 5px;
    background-color: var(--success);
    display: block;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
}

.success-checkmark .icon-line.line-tip {
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
    animation: icon-line-tip 0.75s;
}

.success-checkmark .icon-line.line-long {
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
    animation: icon-line-long 0.75s;
}

@keyframes rotate-circle {
    0% { transform: rotate(-45deg); }
    5% { transform: rotate(-45deg); }
    12% { transform: rotate(-405deg); }
    100% { transform: rotate(-405deg); }
}

@keyframes icon-line-tip {
    0% { width: 0; left: 1px; top: 19px; }
    54% { width: 0; left: 1px; top: 19px; }
    70% { width: 50px; left: -8px; top: 37px; }
    84% { width: 17px; left: 21px; top: 48px; }
    100% { width: 25px; left: 14px; top: 45px; }
}

@keyframes icon-line-long {
    0% { width: 0; right: 46px; top: 54px; }
    65% { width: 0; right: 46px; top: 54px; }
    84% { width: 55px; right: 0px; top: 35px; }
    100% { width: 47px; right: 8px; top: 38px; }
}

/* --- Improved Focus States --- */
.form-input:focus,
.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(235, 70, 37, 0.1);
}

/* --- Better Button States --- */
.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Dark Mode Improvements --- */
body.dark-mode .toast {
    background: var(--bg-card);
    color: var(--text-primary);
}

body.dark-mode .error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

body.dark-mode .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* Fix text colors in dark mode */
body.dark-mode .card-title,
body.dark-mode .input-label,
body.dark-mode .feature-title,
body.dark-mode .order-detail-label,
body.dark-mode .modal-info-value {
    color: var(--text-primary);
}

body.dark-mode .info-text,
body.dark-mode .feature-desc,
body.dark-mode .order-detail-value,
body.dark-mode .order-date {
    color: var(--text-secondary);
}

body.dark-mode .form-input,
body.dark-mode .input-field {
    color: var(--text-primary);
    background-color: var(--bg-card);
}

body.dark-mode .input-container {
    background: var(--bg-card);
}

body.dark-mode .operational-hours {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

body.dark-mode .important-note {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

body.dark-mode .note-title {
    color: #fca5a5;
}

body.dark-mode .note-title i {
    color: #fca5a5;
}

body.dark-mode .note-list li {
    color: #fca5a5;
    font-weight: 500;
}

body.dark-mode .alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

body.dark-mode .alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

body.dark-mode .alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* --- Accessibility Improvements --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --- Print Styles --- */
@media print {
    .header,
    .footer-nav,
    .whatsapp-float,
    .btn,
    .features {
        display: none;
    }
    
    .app-container {
        box-shadow: none;
    }
}