:root {
    /* Colors - Light Theme */
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --accent: #f43f5e;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --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);

    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --nav-height: 70px;
    --header-height: 60px;
}

[data-theme="dark"] {
    --bg-app: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: #f1f5f9;
    direction: rtl;
    overflow: hidden;
}

.app-container {
    max-width: 480px;
    height: 100vh;
    margin: 0 auto;
    background-color: var(--bg-app);
    position: relative;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Layout Parts */
.top-nav {
    height: var(--header-height);
    padding: 0 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.screen-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
}

/* Welcome Screen */
.welcome-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg-app) 100%);
}

.welcome-logo {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

.welcome-screen h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 800;
}

.welcome-screen p {
    color: var(--text-muted);
    margin-bottom: 40px;
}

.welcome-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 16px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 8px;
    width: auto;
    margin: 0 auto;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    text-align: right;
    width: 100%;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1rem;
    -webkit-user-select: text;
    user-select: text;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Home Tabs / Cards */
.top-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.tab-card {
    background: var(--bg-card);
    padding: 16px 8px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s;
}

.tab-card:active {
    transform: scale(0.95);
}

.tab-card i {
    font-size: 1.5rem;
    color: var(--primary);
}

.tab-card span {
    font-size: 0.75rem;
    font-weight: 700;
}

.urgent-tab {
    background: #fee2e2;
    border-color: #fca5a5;
}

.urgent-tab i {
    color: var(--accent);
}

/* Urgent Banner */
.urgent-banner {
    background: #111827;
    color: #fbbf24;
    padding: 10px 15px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    font-weight: 700;
    font-size: 0.9rem;
}

.urgent-icon {
    font-size: 1.2rem;
}

/* Card Improvements */
.card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.urgent-border {
    border: 2px solid var(--accent) !important;
    animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
    0% {
        border-color: var(--accent);
    }

    50% {
        border-color: #fca5a5;
    }

    100% {
        border-color: var(--accent);
    }
}

.badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 5px;
    font-weight: 700;
}

.badge-red {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-yellow {
    background: #fef9c3;
    color: #854d0e;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

/* Simple Mode UI */
.simple-ui .tab-card {
    padding: 24px 10px;
}

.simple-ui .tab-card span {
    font-size: 1rem;
}

.simple-ui .tab-card i {
    font-size: 2rem;
}

.simple-ui p {
    font-size: 1.2rem;
}

.simple-ui h2 {
    font-size: 1.8rem;
}

/* Reputation System */
.reputation-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.rep-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.rep-badge.verified {
    background: #ccfbf1;
    color: #0f766e;
}

.rep-badge.orders {
    background: #f1f5f9;
    color: #475569;
}

/* Provider Ranking */
.rank-badge {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: -5px;
}

.provider-badges {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

/* Chat Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg {
    max-width: 80%;
    padding: 12px;
    border-radius: var(--radius-md);
    position: relative;
    font-size: 0.9rem;
}

.msg-in {
    align-self: flex-start;
    background: #e2e8f0;
    border-bottom-right-radius: 4px;
}

.msg-out {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-left-radius: 4px;
}

.chat-bar {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background-color: var(--bg-card);
}

.chat-bar input {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    outline: none;
}

/* Modal & Bottom Nav (Legacy Keep) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    animation: slideUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 100000;
}

.form-input {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: white !important;
    color: black !important;
    font-size: 1rem;
    -webkit-user-select: text !important;
    user-select: text !important;
    pointer-events: auto !important;
}

.section-title {
    margin: 24px 0 16px;
    border-right: 4px solid var(--primary);
    padding-right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.active-requests {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

/* Services Grid Enhancement */
.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.service-item {
    background: white;
    padding: 16px 8px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
    border: 1px solid var(--border);
}

.service-item:active {
    transform: scale(0.95);
}

.service-item .icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 8px;
}

.service-item span {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Urgent Mode Styles */
.urgent-banner {
    background: #fff5f5;
    border: 1.5px solid #feb2b2;
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    animation: pulse 2s infinite;
}

.urgent-icon {
    font-size: 1.5rem;
    background: #fed7d7;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.map-overlay-controls {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 20;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.call-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ccfbf1;
    color: var(--primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    display: none;
}

h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 16px;
}

h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

h4 {
    font-size: 1.1rem;
    font-weight: 700;
}

small {
    color: var(--text-muted);
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 8px;
    display: flex;
    align-items: center;
    position: relative;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Verification & Badges */
.rep-badge.pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px dashed #f59e0b;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
}

.verification-step {
    border-right: 4px solid var(--border);
    transition: all 0.3s ease;
    padding: 16px;
    margin-bottom: 12px;
}

.verification-step.done {
    border-right-color: var(--success) !important;
    background: #f0fdf4 !important;
}

.verification-step h4 {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.verification-step.done h4::after {
    content: '✅';
    font-size: 0.9rem;
}

.rep-badge.verified {
    background: #dcfce7;
    color: #166534;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
}

.points-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}