:root {
    /* Light Mode - Sharp professional palette */
    --primary-color: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --secondary-color: #06b6d4;
    --background: #fafafa;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: rgba(15, 23, 42, 0.06);
    --shadow-md: rgba(15, 23, 42, 0.08);
    --shadow-lg: rgba(15, 23, 42, 0.12);
    --success: #10b981;
    --info: #0ea5e9;
    --warning: #f59e0b;
    --error: #ef4444;
    --radius: 12px;
    --radius-lg: 16px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.3s var(--ease-out);
    --transition-fast: 0.2s var(--ease-out);
    --transition-slow: 0.45s var(--ease-out);
}

[data-theme="dark"] {
    --primary-color: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-light: #5eead4;
    --secondary-color: #22d3ee;
    --background: #0f172a;
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: rgba(0, 0, 0, 0.2);
    --shadow-md: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);
    --success: #34d399;
    --info: #38bdf8;
    --warning: #fbbf24;
    --error: #f87171;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

body {
    font-family: 'Heebo', 'Segoe UI', system-ui, sans-serif;
    background: var(--background);
    min-height: 100vh;
    padding: 12px;
    direction: rtl;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    font-weight: 500;
    line-height: 1.5;
    animation: bodyLoad 0.5s var(--ease-out);
}

@keyframes bodyLoad {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px var(--shadow), 0 0 0 1px var(--border-color);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: box-shadow var(--transition), transform var(--transition);
    animation: containerIn 0.5s var(--ease-out) 0.1s both;
}

@keyframes containerIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container:focus-within {
    box-shadow: 0 8px 32px var(--shadow-md), 0 0 0 1px var(--border-color);
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 32px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%);
    pointer-events: none;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    position: relative;
    animation: headerTitle 0.6s var(--ease-out) 0.15s both;
}

.subtitle {
    font-size: 1.05rem;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    animation: headerSubtitle 0.6s var(--ease-out) 0.25s both;
}

@keyframes headerTitle {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes headerSubtitle {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 0.95;
        transform: translateY(0);
    }
}

.search-section {
    padding: 30px;
    background: var(--surface);
    border-bottom: 2px solid var(--border-color);
    transition: opacity var(--transition-slow);
}

.search-section, .designer-section {
    animation: sectionFade 0.4s var(--ease-out) both;
}

@keyframes sectionFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.search-bar-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

#addressInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
    direction: rtl;
    background: var(--background);
    color: var(--text-primary);
}

#addressInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.locate-btn {
    padding: 15px 25px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.locate-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.35);
}

.locate-btn:active {
    transform: translateY(0);
    transition-duration: 0.1s;
}

.distance-selector {
    margin-bottom: 25px;
}

.distance-selector label {
    display: block;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

#distanceSlider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

#distanceSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-fast), background var(--transition);
}

#distanceSlider::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

#distanceSlider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#distanceValue {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2em;
}

.generate-btn {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.45);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
    box-shadow: none;
}

.map-container {
    height: 600px !important;
    width: 100% !important;
    margin: 0;
    position: relative;
    z-index: 1;
    background: var(--background);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    min-height: 600px;
    animation: mapReveal 0.6s var(--ease-out) 0.2s both;
}

@keyframes mapReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Leaflet map styles */
#map {
    width: 100% !important;
    height: 100% !important;
    min-height: 600px !important;
    z-index: 1;
    position: relative;
}

.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 1.1rem;
    position: absolute;
    width: 100%;
    z-index: 0;
    background: var(--background);
    gap: 10px;
}

/* Ensure Leaflet container is visible */
.leaflet-container {
    background: var(--background) !important;
    font-family: inherit;
    height: 100% !important;
    width: 100% !important;
}

/* Leaflet controls styling */
.leaflet-control-zoom {
    border: 2px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px var(--shadow) !important;
    background: var(--background) !important;
}

.leaflet-control-zoom a {
    background-color: var(--background) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
}

.leaflet-control-zoom a:hover {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--text-primary) !important;
}

.start-marker,
.end-marker {
    animation: pulse 2s infinite;
}

.route-info {
    padding: 25px 30px;
    background: var(--surface);
    border-top: 2px solid var(--border-color);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.route-info.panel-visible {
    opacity: 1;
    transform: translateY(0);
}

.route-info h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.route-info p {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 16px;
}

.route-map-hint {
    margin-top: 14px;
    padding: 12px 14px;
    background: rgba(13, 148, 136, 0.08);
    border-right: 4px solid var(--primary-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.route-map-hint i {
    margin-left: 6px;
    color: var(--primary-color);
}

.route-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.start-timer-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 15px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.start-timer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

.start-timer-btn:active {
    transform: translateY(0);
}

.go-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 15px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.go-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

.go-btn:active {
    transform: translateY(0);
}

.walking-panel {
    padding: 25px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-top: 2px solid var(--border-color);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.walking-panel.panel-visible {
    opacity: 1;
    transform: translateY(0);
}

.timer-section {
    text-align: center;
    margin-bottom: 25px;
}

.timer-section h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
}

.timer-display {
    font-size: 3em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin: 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s var(--ease-out);
}

.timer-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.pause-btn, .stop-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pause-btn {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-dark);
}

.pause-btn:hover {
    background: white;
    transform: translateY(-2px);
}

.pause-btn:active, .stop-btn:active {
    transform: translateY(0);
}

.stop-btn {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.stop-btn:hover {
    background: #dc3545;
    transform: translateY(-2px);
}

.progress-section {
    margin-top: 25px;
    text-align: center;
}

.progress-section h4 {
    margin-bottom: 10px;
    font-size: 1.1em;
}

.progress-bar {
    width: 100%;
    height: 25px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    width: 0%;
    transition: width 0.35s var(--ease-out);
    border-radius: 15px;
}

.progress-section p {
    font-size: 1.2em;
    font-weight: 600;
    margin-top: 10px;
}

.results-panel {
    padding: 25px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-top: 2px solid var(--border-color);
    text-align: center;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-spring);
}

.results-panel.panel-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.results-panel h3 {
    font-size: 1.8em;
    margin-bottom: 20px;
}

#resultsDetails {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
}

.result-item {
    padding: 10px 0;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item strong {
    display: inline-block;
    width: 120px;
    text-align: right;
    margin-left: 15px;
}

.share-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: center;
}

.share-btn, .new-route-btn {
    flex: 1;
    max-width: 200px;
    padding: 15px 25px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-btn:active, .new-route-btn:active {
    transform: translateY(0);
}

.share-btn {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
}

.share-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.new-route-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.new-route-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.navigation-marker {
    z-index: 1000;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    }
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--primary-color);
    font-weight: 600;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 30px;
    border: 1px solid #f5c6cb;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 20px;
    right: 20px;
    max-width: 400px;
    margin: 0 auto;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 40px var(--shadow-lg);
    animation: toastIn 0.4s var(--ease-spring) forwards;
    pointer-events: auto;
    border: 1px solid rgba(255,255,255,0.2);
}

.toast.toast-success {
    background: var(--success);
    color: white;
}

.toast.toast-error {
    background: var(--error);
    color: white;
}

.toast.toast-info {
    background: var(--info);
    color: white;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
}

/* Navigation Bar */
.navbar {
    background: var(--surface);
    box-shadow: 0 1px 0 var(--border-color), 0 4px 20px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: box-shadow var(--transition), background var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.nav-btn {
    padding: 10px 16px;
    background: var(--background);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition), transform var(--transition), border-color var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    min-height: 44px;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}

.nav-btn i {
    font-size: 1rem;
}

.nav-btn:hover,
.nav-btn:active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-btn:hover {
    transform: translateY(-1px);
}

.nav-btn span {
    display: inline;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 20px;
    min-height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle:hover {
    background: var(--primary-dark);
}

/* Dark Mode Toggle */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--shadow);
}

.theme-toggle:active {
    transform: scale(0.96);
    transition-duration: 0.1s;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: pageIn 0.4s var(--ease-out) forwards;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mode Selector */
.mode-selector {
    padding: 20px 30px;
    background: var(--surface);
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border-color);
}

.mode-btn {
    flex: 1;
    padding: 15px;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(0);
}

/* Designer Mode */
.designer-section {
    padding: 20px 30px;
    background: var(--surface);
    border-bottom: 2px solid var(--border-color);
}

.designer-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.designer-btn {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.designer-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.designer-btn:active {
    transform: translateY(0);
}

.designer-hint {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.designer-marker {
    cursor: move !important;
    transition: transform 0.25s var(--ease-spring);
}

.designer-marker:hover {
    transform: scale(1.12);
}

.designer-route-line {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    animation: routePulse 2.5s var(--ease-in-out) infinite;
}

@keyframes routePulse {
    0%, 100% {
        opacity: 0.92;
    }
    50% {
        opacity: 1;
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    overflow: auto;
    transition: background-color 0.3s var(--ease-out);
}

.modal.modal-visible {
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 24px 48px var(--shadow-lg), 0 0 0 1px var(--border-color);
    position: relative;
    color: var(--text-primary);
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-spring);
}

.modal.modal-visible .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.close {
    color: var(--text-secondary);
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    left: 20px;
    top: 20px;
}

.close:hover {
    color: var(--text-primary);
}

/* Auth Tabs */
#authTabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

#authTabs .tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
}

#authTabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-tab {
    display: none;
}

.auth-tab.active {
    display: block;
}

.auth-tab h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.auth-tab input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    direction: rtl;
    background: var(--background);
    color: var(--text-primary);
}

.auth-tab input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.error-message {
    color: var(--error);
    margin-top: 10px;
    font-size: 14px;
}

/* Save Track Button */
.save-track-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--warning) 0%, #ea580c 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
}

.save-track-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
    cursor: pointer;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.save-track-submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.save-track-submit-btn:hover {
    background: var(--primary-dark);
}

/* Store */
.store-controls {
    padding: 20px 30px;
    background: var(--surface);
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border-color);
}

.store-search {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    direction: rtl;
    background: var(--background);
    color: var(--text-primary);
}

.store-search:focus {
    outline: none;
    border-color: var(--primary-color);
}

.refresh-btn {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn:hover {
    background: var(--primary-dark);
}

.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px;
}

.track-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: 0 2px 12px var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    animation: cardIn 0.45s var(--ease-out) both;
}

.tracks-grid .track-card:nth-child(1) { animation-delay: 0.05s; }
.tracks-grid .track-card:nth-child(2) { animation-delay: 0.1s; }
.tracks-grid .track-card:nth-child(3) { animation-delay: 0.15s; }
.tracks-grid .track-card:nth-child(4) { animation-delay: 0.2s; }
.tracks-grid .track-card:nth-child(5) { animation-delay: 0.25s; }
.tracks-grid .track-card:nth-child(6) { animation-delay: 0.3s; }
.tracks-grid .track-card:nth-child(7) { animation-delay: 0.35s; }
.tracks-grid .track-card:nth-child(8) { animation-delay: 0.4s; }
.tracks-grid .track-card:nth-child(9) { animation-delay: 0.45s; }
.tracks-grid .track-card:nth-child(n+10) { animation-delay: 0.5s; }

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.track-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px var(--shadow-md);
    border-color: var(--primary-color);
}

.track-header {
    margin-bottom: 15px;
}

.track-header h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.2em;
}

.track-author {
    color: var(--text-secondary);
    font-size: 14px;
}

.track-author i {
    margin-left: 5px;
}

.track-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.track-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

.track-stats i {
    margin-left: 5px;
}

.track-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.track-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.use-btn {
    background: var(--primary-color);
    color: white;
}

.use-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.like-btn, .save-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.like-btn:hover, .save-btn:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.delete-btn {
    background: var(--error);
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Tracks Tabs */
.tracks-tabs {
    padding: 20px 30px 0;
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border-color);
}

.tracks-tabs .tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.tracks-tabs .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Profile */
.profile-content {
    padding: 30px;
}

.profile-info {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    padding: 30px;
    background: var(--surface);
    border-radius: 15px;
    align-items: center;
}

.profile-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: white;
    box-shadow: 0 4px 15px var(--shadow);
}

.profile-details h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.profile-details p {
    color: var(--text-secondary);
    margin: 5px 0;
}

.profile-edit {
    background: var(--surface);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.profile-edit h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.profile-edit input,
.profile-edit textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    direction: rtl;
    font-family: inherit;
    background: var(--background);
    color: var(--text-primary);
}

.profile-edit input:focus,
.profile-edit textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.save-profile-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.save-profile-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 10px;
        margin: 0 auto 10px;
    }
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
    
    .search-section {
        padding: 20px 15px;
    }
    
    .search-bar-container {
        flex-direction: column;
        gap: 10px;
    }
    
    #addressInput {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 15px;
    }
    
    .locate-btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .distance-selector {
        margin-bottom: 15px;
    }
    
    .distance-selector label {
        font-size: 16px;
    }
    
    .generate-btn {
        padding: 15px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .map-container {
        height: 50vh !important;
        min-height: 300px !important;
        max-height: 500px !important;
    }
    
    #map {
        min-height: 300px !important;
    }
    
    .route-info {
        padding: 15px;
    }
    
    .route-info h3 {
        font-size: 1.2em;
    }
    
    .route-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .route-buttons button {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
    
    .timer-display {
        font-size: 2em;
    }
    
    .timer-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .timer-controls button {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
    
    .share-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .share-btn, .new-route-btn {
        max-width: 100%;
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Mobile Navigation */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--background);
        flex-direction: column;
        align-items: stretch;
        padding: 60px 20px 20px;
        box-shadow: -2px 0 10px var(--shadow);
        transition: right 0.35s var(--ease-out);
        overflow-y: auto;
        gap: 10px;
        z-index: 1001;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 15px;
        min-height: 48px;
        font-size: 16px;
    }
    
    .nav-btn span {
        display: inline;
    }
    
    .nav-brand h2 {
        font-size: 1.1em;
    }
    
    /* Overlay for mobile menu */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        backdrop-filter: blur(2px);
    }
    
    .nav-overlay.active {
        display: block;
    }
    
    .tracks-grid {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 15px;
    }
    
    .track-card {
        padding: 15px;
    }
    
    .track-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .track-btn {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
    
    .profile-info {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }
    
    .profile-edit {
        padding: 20px 15px;
    }
    
    .profile-edit input,
    .profile-edit textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
        min-height: 44px;
    }
    
    .designer-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .designer-btn {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }
    
    .designer-hint {
        font-size: 14px;
        padding: 10px;
    }
    
    /* Modals */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 20px 15px;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 10px 10px 0 0;
    }
    
    .modal-content h2 {
        font-size: 1.3em;
    }
    
    .auth-tab input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
        min-height: 44px;
    }
    
    .auth-submit-btn {
        min-height: 44px;
        font-size: 16px;
    }
    
    .close {
        font-size: 28px;
        width: 44px;
        height: 44px;
        line-height: 44px;
    }
    
    .theme-toggle {
        bottom: 15px;
        left: 15px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    /* Forms */
    input, textarea, select, button {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Buttons - ensure touch-friendly */
    button {
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Store search */
    #storeSearch {
        font-size: 16px;
        padding: 12px;
        min-height: 44px;
    }
    
    /* Tabs */
    .tabs {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .tab-btn {
        padding: 10px 15px;
        min-height: 44px;
        font-size: 14px;
    }
    
    /* Page padding */
    .page {
        padding: 10px;
    }
    
    /* Walking panel */
    .walking-panel {
        padding: 15px;
    }
    
    .walking-panel h3 {
        font-size: 1.2em;
    }
    
    /* Results panel */
    .results-panel {
        padding: 20px 15px;
    }
    
    .results-panel h3 {
        font-size: 1.3em;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .container {
        border-radius: 0;
        margin: 0;
    }
    
    header {
        padding: 15px 10px;
    }
    
    header h1 {
        font-size: 1.3em;
    }
    
    .search-section {
        padding: 15px 10px;
    }
    
    .map-container {
        height: 40vh !important;
        min-height: 250px !important;
    }
    
    .nav-menu {
        width: 85%;
    }
}
