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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #153677, #4e085f);
    min-height: 100vh;
    padding: 20px;
    transition: all 0.3s ease;
}

body.dark {
    background: linear-gradient(135deg, #0f3460, #2d1b3c);
    color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 25px 30px;
    border-radius: 25px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: #fff;
    font-size: 2.5em;
    display: flex;
    align-items: center;
    gap: 15px;
}

header div button {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    margin-left: 12px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

header div button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

/* VOICE PANEL */
.voice-panel {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 380px;
    max-width: 90vw;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 25px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.voice-panel.active {
    display: block;
    animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#closeVoice {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s;
}

#closeVoice:hover { color: white; transform: rotate(90deg); }

#voiceStatus {
    font-size: 18px;
    text-align: center;
    margin-top: 20px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ROUTE PLANNER */
.route-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.route-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.route-inputs div {
    position: relative;
}

.route-inputs label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
    opacity: 0.9;
}

.route-inputs input {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 18px 20px;
    border-radius: 15px;
    font-size: 16px;
}

.route-inputs input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.route-inputs input:focus {
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    outline: none;
}

#planRoute {
    width: 100%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    font-size: 18px;
    padding: 18px;
    font-weight: 600;
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(240, 147, 251, 0.4);
}

#routeResult .route-info {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.distance {
    font-size: 3em;
    font-weight: 800;
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 15px 0;
}

.duration { font-size: 1.4em; opacity: 0.9; }

/* SECTIONS */
section {
    background: rgba(255, 255, 255, 0.95);
    margin-bottom: 30px;
    padding: 35px;
    border-radius: 25px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.4s ease;
}

section:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

body.dark section {
    background: rgba(20, 20, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

h2 {
    color: #002765;
    margin-bottom: 30px;
    font-size: 1.6em;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
}

body.dark h2 { color: #e0e0ff; }

input, textarea, select {
    width: 100%;
    padding: 18px 20px;
    margin-bottom: 20px;
    border: 2px solid #edeef0;
    border-radius: 15px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

input:focus, textarea:focus, select:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
    outline: none;
}

textarea { height: 140px; resize: vertical; }

.quick-actions, .map-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

button {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    padding: 15px 28px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.3);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(255, 107, 107, 0.4);
}

button:active { transform: translateY(-1px); }

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#map {
    border-radius: 20px;
    margin-bottom: 25px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    height: 450px;
}

.result-box {
    margin-top: 20px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 20px;
    border-left: 6px solid #ff6b6b;
    box-shadow: inset 0 3px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.result-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #ff6b6b);
    background-size: 300% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

body.dark .result-box {
    background: linear-gradient(135deg, #2d3748, #4a5568);
    border-left-color: #63b3ed;
}

ul#historyList {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 10px;
}

ul#historyList::-webkit-scrollbar {
    width: 8px;
}

ul#historyList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

ul#historyList::-webkit-scrollbar-thumb {
    background: linear-gradient(#ff6b6b, #ff8e8e);
    border-radius: 10px;
}

ul#historyList li {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    margin-bottom: 18px;
    padding: 25px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 5px solid #ff6b6b;
    position: relative;
    overflow: hidden;
}

ul#historyList li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
}

body.dark ul#historyList li {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    border-left-color: #63b3ed;
}

ul#historyList li:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ff6b6b;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

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

@media (max-width: 768px) {
    .route-inputs { grid-template-columns: 1fr; gap: 20px; }
    header { flex-direction: column; gap: 20px; padding: 20px; }
    .voice-panel { width: 95vw; right: 2.5vw; top: 20px; }
    section { padding: 25px 20px; margin-bottom: 20px; }
    .quick-actions, .map-controls { flex-direction: column; }
    #map { height: 350px; }
}