:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --accent-color: #4895ef;
    --danger-color: #f72585;
    --success-color: #4cc9f0;
    --warning-color: #f8961e;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --text-light: #f8f9fa;
    --text-dark: #212529;
    --bg-light: #ffffff;
    --bg-dark: #121212;
    --card-bg-light: #f8f9fa;
    --card-bg-dark: #1e1e1e;
    --border-light: #dee2e6;
    --border-dark: #333333;
}

.dark-mode {
    --primary-color: #4895ef;
    --secondary-color: #4361ee;
    --accent-color: #3f37c9;
    --bg-color: var(--bg-dark);
    --text-color: var(--text-light);
    --card-bg: var(--card-bg-dark);
    --border-color: var(--border-dark);
}

.light-mode {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --accent-color: #4895ef;
    --bg-color: var(--bg-light);
    --text-color: var(--text-dark);
    --card-bg: var(--card-bg-light);
    --border-color: var(--border-light);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 0;
    font-size: 2.5rem;
    font-weight: 700;
}

header p {
    color: var(--text-color);
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Theme Switcher */
.theme-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-checkbox {
    opacity: 0;
    position: absolute;
}

.theme-label {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    position: relative;
    height: 26px;
    width: 60px;
    transform: scale(1.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.theme-label .fa-moon {
    color: #f1c40f;
    font-size: 12px;
    margin-left: 5px;
}

.theme-label .fa-sun {
    color: #f39c12;
    font-size: 12px;
    margin-right: 5px;
}

.theme-ball {
    background-color: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    height: 22px;
    width: 22px;
    transform: translateX(0px);
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.theme-checkbox:checked + .theme-label .theme-ball {
    transform: translateX(34px);
}

.map-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

/* Base Map Styles */
#map {
    width: 100%;
    min-height: 400px; /* Minimum height */
    border-radius: 10px;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth animation */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Mobile Height Classes */
.map-container.expand-1 #map {
    height: 1000px; /* Single route */
}
.map-container.expand-2 #map {
    height: 1300px; /* Two routes */
}
.map-container.expand-3 #map {
    height: 1600px; /* Three routes */
}

/* Desktop Layout Adjustments */
@media (min-width: 780px) {
    .map-container {
        flex-direction: row;
    }
    
    .map-container.expand-1 #map {
        height: 1100px; 
    }
    .map-container.expand-2 #map {
        height: 1400px;
    }
    .map-container.expand-3 #map {
        height: 1550px;
    }
}

/* Dark Mode Styles */
.dark-mode .map-container {
    background-color: var(--dark-card-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.dark-mode #map {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.controls {
    width: 350px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    z-index: 1;
}

.input-with-icon input {
    padding: 12px 15px 12px 45px;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.input-with-icon input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
    outline: none;
}

button {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.travel-modes {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 12px 10px;
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.mode-btn i {
    font-size: 18px;
}

.mode-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.mode-btn:hover {
    background-color: var(--card-bg);
}

.mode-btn.active:hover {
    background-color: var(--secondary-color);
}

.route-info {
    margin-top: 20px;
    padding: 20px;
    background-color: var(--bg-color);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.route-info h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background-color: var(--card-bg);
    border-radius: 8px;
}

.info-item i {
    font-size: 20px;
    color: var(--primary-color);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(67, 97, 238, 0.1);
    border-radius: 50%;
}

.info-item .label {
    font-size: 12px;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 2px;
}

.info-item .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.secondary-btn {
    flex: 1;
    padding: 10px;
    background-color: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    font-size: 14px;
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.history-section {
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.history-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#route-history {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.history-item {
    padding: 15px;
    background-color: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.history-item h4 {
    color: var(--primary-color);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item h4 i {
    font-size: 14px;
}

.history-item p {
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 5px;
}

.history-item .history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--primary-color);
}

.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loader.hidden {
    display: none;
}

.loader-content {
    background-color: var(--card-bg);
    padding: 30px 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
}

.loader-content p {
    margin-top: 15px;
    color: var(--text-color);
    font-size: 16px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(67, 97, 238, 0.2);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.input-with-icon .error-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--danger-color);
    display: none;
}

.input-with-icon.error .error-icon {
    display: block;
}

.input-with-icon.error input {
    border-color: var(--danger-color);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Weather Effects */
.weather-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.raindrop {
    position: absolute;
    background: linear-gradient(transparent, var(--primary-color));
    width: 2px;
    height: 15px;
    animation: rainfall linear infinite;
    opacity: 0.6;
}

@keyframes rainfall {
    0% {
        transform: translateY(-50px) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100vh) translateX(10px);
        opacity: 0;
    }
}

/* Custom alerts */
.custom-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: 90%;
    max-width: 400px;
}

.alert-content {
    background-color: var(--card-bg);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid var(--primary-color);
}

.alert-content i {
    color: var(--primary-color);
    font-size: 20px;
}

/* Map mode toggle */
.map-mode-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background-color: var(--card-bg);
    padding: 8px 15px;
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    font-size: 14px;
}

.map-mode-toggle i {
    color: var(--primary-color);
}

.map-mode-toggle.active {
    background-color: var(--primary-color);
    color: white;
}

.map-mode-toggle.active i {
    color: white;
}
.show-map-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 26px;
    margin: 10px 0;
}

.show-map-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.show-map-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
}

.show-map-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .show-map-slider {
    background-color: var(--primary-color);
}

input:checked + .show-map-slider:before {
    transform: translateX(34px);
}

.show-map-slider i {
    color: white;
    font-size: 12px;
    z-index: 1;
}
/* Add these new styles */
.show-map-btn {
    width: 200px;
    margin: 20px auto;
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.show-map-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.show-map-btn:active {
    transform: translateY(0);
}

.input-with-icon .error-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--danger-color);
    display: none;
}

.input-with-icon.error .error-icon {
    display: block;
}

.input-with-icon.error input {
    border-color: var(--danger-color);
}

/* Responsive design */
@media (max-width: 992px) {
    .map-container {
        flex-direction: column;
    }
    
    .controls {
        width: 100%;
    }
    
    #map {
        height: 400px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 2rem;
    }
}
.input-with-icon.error {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.vibrate {
    animation: vibrate 0.3s linear infinite;
}

@keyframes vibrate {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}
/* Alternative Routes Section */
#alternative-routes {
    margin-top: 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.alt-routes-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.alt-routes-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-right: 0.75rem;
}

.alt-routes-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
}

.alt-routes-count {
    margin-left: auto;
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.alt-routes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.alt-route-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.alt-route-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.alt-route-card.fastest-route {
    border-left: 4px solid var(--success-color);
}

.alt-route-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-bottom-left-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.alt-route-badge i {
    margin-left: 0.5rem;
    font-size: 0.7rem;
}

.alt-route-main {
    display: flex;
    align-items: center;
    margin-top: 1.5rem;
}

.alt-route-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.alt-route-icon i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.alt-route-info {
    flex-grow: 1;
}

.alt-route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.alt-route-meta span {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.alt-route-meta i {
    margin-right: 0.3rem;
    font-size: 0.8rem;
}

.alt-route-difference {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
    margin-top: 0.3rem;
    background: var(--bg-color);
}

.alt-route-difference i {
    margin-right: 0.3rem;
}

.alt-route-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.btn-view-route {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.btn-view-route:hover {
    background: var(--primary-color);
    color: white;
}

.btn-view-route i {
    margin-right: 0.3rem;
    font-size: 0.8rem;
}

/* Dark mode adjustments */
.dark-mode .alt-route-card {
    background: var(--card-bg-dark);
    border-color: var(--border-color-dark);
}

.dark-mode .alt-route-difference {
    background: var(--bg-color-dark);
}/* استایل کارت مسیر اصلی */
.main-route-card {
    border: 2px solid var(--primary-color);
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(255,255,255,0.1) 100%);
    position: relative;
    overflow: hidden;
    animation: glow 1s infinite alternate, float 3s ease-in-out infinite;
}
@keyframes glow {
    0% { 
        box-shadow: 0 0 10px rgba(67, 97, 238, 0.5), 
                   0 0 20px rgba(67, 97, 238, 0.3);
    }
    100% { 
        box-shadow: 0 0 20px rgba(67, 97, 238, 0.8),
                   0 0 40px rgba(67, 97, 238, 0.5);
    }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* نشانگر مسیر اصلی */
.main-route-card::before {
    content: "RECOMMENDED";
    position: absolute;
    top: 12px;
    right: -30px;
    background: var(--primary-color);
    color: white;
    padding: 2px 35px;
    font-size: 11px;
    font-weight: bold;
    transform: rotate(45deg);
    animation: badgePulse 2s infinite;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(67, 97, 238, 0.3); }
    100% { box-shadow: 0 0 15px rgba(67, 97, 238, 0.6); }
}
@keyframes badgePulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}
.main-route-card .btn-view-route {
    background: var(--primary-color);
    color: white;
    animation: bounce 1s infinite alternate;
}

/* انیمیشن دکمه */
@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

#reset-routes-btn {
    /* Positioning */
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    
    /* Size & Shape */
    padding: 5px 12px;
    border-radius: 20px;
    min-width: 120px;
    height: 30px;
    
    /* Colors & Appearance */
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    
    /* Text */
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    
    /* Behavior */
    cursor: pointer;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    
    /* Animations */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: fadeIn 0.4s ease-out;
}

/* Icon styling */
#reset-routes-btn i {
    margin-right: 6px;
    font-size: 11px;
    transition: all 0.3s ease;
}

/* Hover effects */
#reset-routes-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Active/Click effect */
#reset-routes-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(67, 97, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0); }
}

/* Pulse animation only when visible */
#reset-routes-btn.showing {
    animation: pulse 2s infinite;
}
/* Marker label styling */
.gm-style .gm-style-iw-c {
    background-color: var(--primary-color) !important;
    color: white !important;
    padding: 8px !important;
    border-radius: 8px !important;
}

.gm-style .gm-style-iw-t::after {
    background-color: var(--primary-color) !important;
}