/* SafePath v2 - Professional & Elegant Design */

:root {
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #3B82F6;
    --success: #059669;
    --success-light: #10B981;
    --warning: #D97706;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --bg-dark: #111827;
    --bg-darker: #0D1117;
    --bg-card: #1F2937;
    --border-color: #374151;
    --border-light: #4B5563;
    --white: #FFFFFF;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --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);
    --transition: all 0.2s ease;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-darker);
    color: var(--white);
    font-size: 14px;
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar - 30% width */
.sidebar {
    width: 30%;
    min-width: 320px;
    max-width: 480px;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Header */
.sidebar-header {
    padding: 20px 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 8px;
}

.logo i {
    color: var(--primary-light);
    font-size: 26px;
}

.tagline {
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: 0.3px;
}

/* Search Form */
.search-form {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-of-type {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 14px;
    transition: var(--transition);
}

.input-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-field i {
    color: var(--text-light);
    font-size: 14px;
    margin-right: 10px;
}

.input-field input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--white);
    padding: 12px 0;
    font-size: 14px;
    font-family: inherit;
}

.input-field input::placeholder {
    color: var(--text-light);
}

.swap-container {
    display: flex;
    justify-content: center;
    margin: 8px 0;
}

.swap-btn {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.swap-btn:hover {
    background: var(--primary-light);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.swap-btn i {
    font-size: 14px;
}

/* Travel Mode */
.travel-mode {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.travel-mode > label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.mode-btn i {
    font-size: 16px;
}

.mode-btn span {
    font-size: 11px;
    font-weight: 500;
}

.mode-btn:hover {
    background: var(--border-color);
    color: var(--white);
}

.mode-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Action Buttons */
.action-buttons {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--white);
}

.btn-outline:hover {
    background: var(--bg-card);
    border-color: var(--border-light);
}

/* Results Section */
.results-section {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    min-height: 0;
}

.routes-panel h3 {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.routes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.route-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.route-card:hover {
    border-color: var(--border-light);
    background: rgba(255, 255, 255, 0.03);
}

.route-card.safest {
    border-color: var(--success);
    background: rgba(5, 150, 105, 0.1);
}

.route-number {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.route-info {
    flex: 1;
    min-width: 0;
}

.route-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 4px;
}

.safest-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    background: var(--success);
    color: var(--white);
    border-radius: 4px;
}

.route-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.route-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.route-stats i {
    font-size: 10px;
}

.places-stat {
    color: var(--primary-light);
    font-weight: 500;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 28px;
    color: var(--primary-light);
    margin-bottom: 12px;
    opacity: 0.7;
}

.empty-state p {
    font-size: 13px;
    line-height: 1.6;
    max-width: 260px;
}

/* Footer */
.sidebar-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-darker);
    flex-shrink: 0;
    margin-top: auto;
}

.sidebar-footer p {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

/* Map Section - 70% */
.map-section {
    flex: 1;
    position: relative;
    background: var(--bg-darker);
}

#googleMap {
    width: 100%;
    height: 100%;
}

/* Route Details Card */
.route-details {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    min-width: 280px;
    max-width: 340px;
    box-shadow: var(--shadow-lg);
}

.details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.details-header h4 {
    font-size: 14px;
    font-weight: 600;
}

.close-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--bg-card);
    color: var(--white);
}

.details-content {
    padding: 16px;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
}

.detail-row i {
    width: 16px;
    color: var(--text-light);
    margin-top: 2px;
}

.detail-row span {
    color: var(--text-secondary);
    flex: 1;
}

.detail-row.highlight {
    color: var(--success-light);
}

.detail-row.highlight i {
    color: var(--success-light);
}

.detail-row.highlight span {
    color: var(--success-light);
    font-weight: 500;
}

/* Map Controls */
.map-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
}

.control-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.control-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loader {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loader p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

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

/* Utility */
.hidden {
    display: none !important;
}

/* Scrollbar */
.results-section::-webkit-scrollbar {
    width: 6px;
}

.results-section::-webkit-scrollbar-track {
    background: transparent;
}

.results-section::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.results-section::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Responsive Design */

/* Large laptops (13-15 inch) */
@media (max-width: 1400px) {
    .sidebar {
        width: 28%;
        min-width: 300px;
        max-width: 380px;
    }
    
    .sidebar-header {
        padding: 20px 18px;
    }
    
    .logo {
        font-size: 20px;
        gap: 10px;
    }
    
    .logo i {
        font-size: 22px;
    }
    
    .search-form,
    .travel-mode,
    .action-buttons {
        padding: 16px 18px;
    }
    
    .results-section {
        padding: 16px 18px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* Medium screens (smaller laptops) */
@media (max-width: 1200px) {
    .sidebar {
        width: 32%;
        min-width: 280px;
        max-width: 340px;
    }
    
    .sidebar-header {
        padding: 18px 16px;
    }
    
    .tagline {
        font-size: 12px;
    }
    
    .search-form,
    .travel-mode,
    .action-buttons {
        padding: 14px 16px;
    }
    
    .results-section {
        padding: 14px 16px;
    }
    
    .input-field input {
        padding: 10px 0;
        font-size: 13px;
    }
    
    .mode-btn {
        padding: 10px 6px;
    }
    
    .mode-btn i {
        font-size: 14px;
    }
    
    .mode-btn span {
        font-size: 10px;
    }
    
    .btn {
        padding: 11px 14px;
        font-size: 12px;
        gap: 6px;
    }
    
    .route-card {
        padding: 12px;
        gap: 10px;
    }
    
    .route-number {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .route-stats {
        gap: 12px;
        font-size: 11px;
    }
    
    .route-details {
        min-width: 240px;
        max-width: 280px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 35%;
        min-width: 260px;
    }
    
    .sidebar-header {
        padding: 16px 14px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .search-form,
    .travel-mode,
    .action-buttons,
    .results-section {
        padding: 12px 14px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .swap-btn {
        width: 32px;
        height: 32px;
    }
    
    .swap-btn i {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-width: unset;
        max-width: unset;
        height: auto;
        max-height: 55vh;
        order: 2;
    }
    
    .map-section {
        height: 45vh;
        order: 1;
    }
    
    .sidebar-header {
        padding: 14px 16px;
    }
    
    .search-form,
    .travel-mode,
    .action-buttons,
    .results-section {
        padding: 14px 16px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .action-buttons {
        flex-direction: row;
    }
    
    .btn {
        flex: 1;
        padding: 12px 14px;
        font-size: 12px;
    }
    
    .route-details {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .results-section {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .mode-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .mode-btn {
        padding: 10px 4px;
    }
    
    .mode-btn span {
        font-size: 9px;
    }
    
    .route-stats {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .sidebar-header {
        padding: 12px 14px;
    }
    
    .logo {
        font-size: 16px;
        gap: 8px;
    }
    
    .tagline {
        font-size: 11px;
    }
}
