/* assets/css/style.css */
:root {
    --primary-color: #f44336;
    --secondary-color: #2196F3;
    --bg-dark: #121212;
    --bg-light: #ffffff;
    --text-color: #333333;
    --card-bg: rgba(255, 255, 255, 0.95);
    --glass-bg: rgba(255, 255, 255, 0.8);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    height: 100%; width: 100%; overflow: hidden;
    background-color: var(--bg-dark);
}

#map {
    height: 100%; width: 100%; z-index: 1;
}

/* UI Elements */
.top-bar {
    position: absolute; top: 15px; left: 15px; right: 15px;
    height: 60px; z-index: 1000; display: flex;
    justify-content: space-between; align-items: center;
    padding: 0 20px; border-radius: 20px;
    background: var(--glass-bg); backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.3);
}

.logo {
    display: flex; align-items: center; gap: 10px;
}

.logo span {
    font-weight: 800; font-size: 18px; color: #333; letter-spacing: -0.5px;
}

.logo span span {
    color: var(--primary-color);
}

.speed-display {
    background: rgba(0,0,0,0.8); color: #fff; padding: 8px 15px;
    border-radius: 12px; font-weight: 700; font-size: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1);
}

.fab-container {
    position: absolute; bottom: 30px; right: 20px;
    display: flex; flex-direction: column; gap: 15px; z-index: 1000;
}

.fab {
    width: 65px; height: 65px; border-radius: 50%;
    border: none; color: white; font-size: 26px; cursor: pointer;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.fab:active { transform: scale(0.9); }
.fab-primary { background: var(--primary-color); }
.fab-secondary { background: var(--secondary-color); }
.fab-parking { background: #03A9F4; }

/* Radar Marker Styling */
.custom-radar-marker {
    background: white; border-radius: 50%; border: 3px solid var(--primary-color);
    box-shadow: 0 4px 10px rgba(244, 67, 54, 0.4);
    text-align: center; line-height: 26px;
    width: 32px !important; height: 32px !important;
}

.custom-radar-marker i {
    color: var(--primary-color); font-size: 14px;
    display: inline-block; vertical-align: middle; line-height: inherit;
}

/* Parking Marker Styling */
.custom-parking-marker {
    background: #03A9F4; border-radius: 8px; border: 2px solid white;
    box-shadow: 0 4px 10px rgba(3, 169, 244, 0.4);
    text-align: center; line-height: 28px;
    width: 32px !important; height: 32px !important;
}

.custom-parking-marker i {
    color: white; font-size: 16px;
    display: inline-block; vertical-align: middle; line-height: inherit;
}

/* Driving Mode Overlay */
.driving-mode-overlay {
    position: fixed; inset: 0; background: rgba(18, 18, 18, 0.98); 
    z-index: 5000; display: flex; flex-direction: column;
    padding: 20px; transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform: translateY(100%); visibility: hidden;
}

.driving-mode-overlay.active {
    transform: translateY(0); visibility: visible;
}

.driving-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 0; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 20px;
}

.driving-header h3 {
    color: #fff; font-size: 24px; font-weight: 800; letter-spacing: 1px;
}

.close-driving {
    background: rgba(255,255,255,0.1); border: none; color: #fff;
    width: 45px; height: 45px; border-radius: 50%; font-size: 22px; cursor: pointer;
}

.huge-btn-grid {
    display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr;
    gap: 15px; flex: 1; padding-bottom: 20px;
}

.huge-btn {
    border: none; border-radius: 24px; color: white; display: flex;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 15px; font-size: 18px; font-weight: 700; cursor: pointer;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); transition: transform 0.1s;
    text-align: center; padding: 15px;
}

.huge-btn:active { transform: scale(0.95); }
.huge-btn i { font-size: 40px; }
.huge-btn span { font-size: 14px; opacity: 0.9; }

.sabit-bg { background: linear-gradient(135deg, #f44336, #c62828); }
.mobil-bg { background: linear-gradient(135deg, #2196F3, #1565C0); }
.eds-bg { background: linear-gradient(135deg, #ff9800, #ef6c00); }
.kirmizi-bg { background: linear-gradient(135deg, #4CAF50, #2E7D32); }
.polis-bg { background: linear-gradient(135deg, #9C27B0, #6A1B9A); }
.kaza-bg { background: linear-gradient(135deg, #FF5252, #B71C1C); }
.yol-bg { background: linear-gradient(135deg, #FFC107, #FF8F00); color: #333 !important; }
.other-bg { background: linear-gradient(135deg, #607D8B, #455A64); }

/* Success Flash Overlay */
.success-flash {
    position: fixed; inset: 0; background: rgba(76, 175, 80, 0.9);
    z-index: 6000; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; pointer-events: none; transition: all 0.3s;
}

.success-flash.show {
    opacity: 1; visibility: visible;
}

.flash-content {
    text-align: center; color: white;
}

.flash-content i { font-size: 100px; margin-bottom: 20px; }
.flash-content span { font-size: 32px; font-weight: 900; display: block; }

/* Radar Proximity Warning Overlay */
.radar-warning-overlay {
    position: fixed; bottom: 120px; left: 15px; transform: translateY(50px);
    z-index: 7000; width: calc(100% - 105px); max-width: 320px;
    background: linear-gradient(135deg, #FF5722 0%, #D32F2F 100%);
    border-radius: 16px; padding: 12px 15px; color: white;
    box-shadow: 0 10px 30px rgba(211, 47, 47, 0.6);
    display: flex; align-items: center; justify-content: flex-start;
    visibility: hidden; opacity: 0; transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    pointer-events: none; /* Let clicks pass through the overlay itself */
}

.radar-warning-overlay.show {
    visibility: visible; opacity: 1; transform: translateY(0);
}

.close-alert-btn {
    position: absolute; top: -10px; left: -10px;
    width: 28px; height: 28px; border-radius: 50%;
    background: white; color: #D32F2F; border: 3px solid #D32F2F;
    font-size: 14px; font-weight: bold; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); z-index: 10;
    pointer-events: auto; /* Re-enable clicks for the close button */
}

.warning-box { display: flex; align-items: center; gap: 15px; }
.warning-icon { font-size: 35px; }
.warning-text h2 { font-size: 18px; font-weight: 900; letter-spacing: -0.5px; }
.warning-text p { font-size: 14px; font-weight: 600; opacity: 0.9; margin-top: 2px; }
.limit-badge {
    position: absolute; top: -10px; right: -10px;
    background: #fff; color: #333; width: 42px; height: 42px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 900; border: 3px solid #D32F2F;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Edit Confirm Bar */
.edit-confirm-bar {
    position: absolute; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
    background: rgba(33, 150, 243, 0.95); color: white; padding: 15px 20px;
    border-radius: 12px; z-index: 4000; display: flex; flex-direction: column;
    align-items: center; gap: 10px; width: 90%; max-width: 400px;
    box-shadow: 0 10px 25px rgba(33,150,243,0.4);
    opacity: 0; visibility: hidden; transition: all 0.3s ease; text-align: center;
}

.edit-confirm-bar.active {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

.edit-confirm-bar span { font-weight: 600; font-size: 14px; }
.confirm-btns { display: flex; gap: 10px; width: 100%; }
.confirm-btns button {
    flex: 1; padding: 10px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer;
}
.cancel-edit-btn { background: rgba(255,255,255,0.2); color: white; }
.confirm-location-btn { background: white; color: #2196F3; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    z-index: 3000; display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; visibility: hidden; transition: 0.3s;
}

.modal-overlay.active {
    opacity: 1; visibility: visible;
}

.modal {
    background: white; width: 100%; border-radius: 30px 30px 0 0;
    padding: 30px; transform: translateY(100%); transition: 0.3s ease-out;
    max-width: 500px;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
}

.modal-header h3 { font-size: 20px; color: var(--bg-dark); }
.close-btn { background: none; border: none; font-size: 28px; cursor: pointer; color: #999; }

.radar-types {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 15px;
}

.type-btn {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 15px 10px; border-radius: 12px; border: 2px solid #f0f0f0;
    background: #fdfdfd; cursor: pointer; transition: 0.2s;
}

.type-btn i { font-size: 20px; color: #555; }
.type-btn[data-type="sabit"] i { color: #f44336; }
.type-btn[data-type="mobil"] i { color: #2196F3; }
.type-btn[data-type="kirmizi_isik"] i { color: #4CAF50; }
.type-btn[data-type="eds"] i { color: #ff9800; }
.type-btn[data-type="polis_cevirmesi"] i { color: #9C27B0; }
.type-btn[data-type="kaza"] i { color: #FF5252; }
.type-btn[data-type="yol_calismasi"] i { color: #FFC107; }
.type-btn[data-type="diger"] i { color: #607D8B; }
.type-btn span { font-size: 11px; font-weight: 600; color: #666; text-align: center; }
.type-btn.selected { border-color: var(--primary-color); background: #fff5f5; }
.type-btn.selected i, .type-btn.selected span { color: var(--primary-color); }

.speed-limit-input { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.speed-limit-input label { font-size: 14px; font-weight: 600; color: #555; }
.speed-limit-input input { padding: 14px; border-radius: 12px; border: 2px solid #eee; font-size: 16px; outline: none; transition: border-color 0.2s; font-family: 'Inter', sans-serif; }
.speed-limit-input input:focus { border-color: var(--secondary-color); }

.submit-btn {
    width: 100%; padding: 16px; border-radius: 16px; border: none;
    background: var(--primary-color); color: white; font-size: 16px; font-weight: 700;
    cursor: pointer; margin-top: 25px; box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.submit-btn:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; }

/* Toast Notification */
#toastContainer {
    position: fixed; top: 85px; left: 50%; transform: translateX(-50%);
    width: auto; z-index: 10000;
}

.toast {
    background: white; color: #333; padding: 12px 20px; border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2); margin-bottom: 10px;
    display: flex; align-items: center; gap: 12px; font-size: 14px;
    font-weight: 600; transform: translateY(-100px); opacity: 0; transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show { transform: translateY(0); opacity: 1; }

.toast.error {
    background: #f44336; color: #fff;
    box-shadow: 0 10px 40px rgba(244, 67, 54, 0.4);
}

/* Search UI */
.search-container {
    position: absolute; top: 85px; left: 15px; right: 15px; z-index: 1000;
    transition: all 0.3s;
}
.search-container.hide {
    opacity: 0; visibility: hidden; transform: translateY(-20px); pointer-events: none;
}
.search-input-wrapper {
    position: relative; display: flex; align-items: center;
    background: var(--glass-bg); backdrop-filter: blur(10px);
    border-radius: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.3);
}
.search-icon {
    position: absolute; left: 20px; color: #555; font-size: 18px;
}
#addressSearch {
    width: 100%; padding: 18px 50px; border: none; border-radius: 20px;
    background: transparent; font-size: 16px; font-weight: 600; outline: none;
    color: var(--text-color);
}
.clear-search-btn {
    position: absolute; right: 15px; background: none; border: none; font-size: 18px; color: #999; cursor: pointer; padding: 5px;
}
.search-results {
    margin-top: 10px; background: white; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden; display: none; max-height: 250px; overflow-y: auto;
}
.search-results.active { display: block; }
.search-result-item {
    padding: 15px 20px; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: background 0.2s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f5f5f5; }
.search-result-item i { color: var(--secondary-color); font-size: 18px; }
.search-result-text { display: flex; flex-direction: column; }
.search-result-text strong { font-size: 15px; color: #333; }
.search-result-text small { font-size: 12px; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }

/* Navigation UI */
.route-info-panel {
    position: absolute; top: 85px; left: 15px; right: 15px;
    z-index: 1000; display: flex; flex-direction: column;
    border-radius: 20px;
    background: linear-gradient(135deg, #1e88e5, #1565c0); color: white;
    box-shadow: 0 8px 32px rgba(33, 150, 243, 0.4); border: 1px solid rgba(255,255,255,0.3);
    opacity: 0; visibility: hidden; transform: translateY(-20px); transition: all 0.3s;
    overflow: hidden;
}

.route-info-panel.active {
    opacity: 1; visibility: visible; transform: translateY(0);
}

.route-info-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 15px; min-height: 60px;
}

.route-stats { display: flex; flex-direction: column; }
.route-stats #routeDistance { font-size: 18px; font-weight: 800; }
.route-stats #routeDuration { font-size: 14px; opacity: 0.9; }

.route-actions { display: flex; gap: 8px; align-items: center; }

.cancel-route-btn, .show-alts-btn {
    background: rgba(255,255,255,0.2); border: none; color: white;
    padding: 8px 15px; border-radius: 12px; font-weight: 600; cursor: pointer;
}

.show-alts-btn { background: rgba(0,0,0,0.2); }

.alt-routes-container {
    display: none; padding: 15px; background: rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.2);
}

.alt-routes-container.open { display: block; }
.alt-routes-title { font-size: 13px; font-weight: 700; text-transform: uppercase; margin-bottom: 10px; opacity: 0.9; }
.alt-routes-list { display: flex; flex-direction: column; gap: 10px; }

.alt-route-item {
    background: rgba(255,255,255,0.9); color: #333;
    padding: 12px; border-radius: 12px; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    border: 2px solid transparent; transition: all 0.2s;
}

.alt-route-item.selected {
    border-color: #f44336; background: #fff;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.2);
}

.alt-route-name { font-weight: 700; font-size: 14px; }
.alt-route-meta { font-size: 12px; color: #666; display: flex; gap: 10px; }
.alt-route-item.selected .alt-route-meta { color: #555; }

.start-nav-btn {
    width: 100%; padding: 16px; border-radius: 16px; border: none;
    background: linear-gradient(135deg, #4CAF50, #2E7D32); color: white; font-size: 16px; font-weight: 700;
    cursor: pointer; margin-bottom: 5px; box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.start-nav-btn:active { transform: scale(0.98); }

.divider { text-align: center; margin: 15px 0; color: #999; font-size: 14px; position: relative; }
.divider::before, .divider::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: #eee; }
.divider::before { left: 0; }
.divider::after { right: 0; }

/* User Marker */
.user-location-marker div {
    animation: pulse-user 2s infinite;
}

@keyframes pulse-user {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 15px rgba(33, 150, 243, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(33, 150, 243, 0); }
}

/* Marker Cluster */
.marker-cluster-small { background-color: rgba(229, 57, 53, 0.6); }
.marker-cluster-small div { background-color: rgba(229, 57, 53, 0.85); color: white; border-radius: 50%; }
.marker-cluster-medium { background-color: rgba(211, 47, 47, 0.6); }
.marker-cluster-medium div { background-color: rgba(211, 47, 47, 0.85); color: white; border-radius: 50%; }
.marker-cluster-large { background-color: rgba(183, 28, 28, 0.6); }
.marker-cluster-large div { background-color: rgba(183, 28, 28, 0.85); color: white; border-radius: 50%; }

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent; border: none; color: var(--text-color);
    font-size: 22px; cursor: pointer; padding: 5px; transition: color 0.3s;
}

/* Dark Mode Overrides */
body.dark-mode {
    --bg-light: #1e1e1e;
    --text-color: #f1f1f1;
    --card-bg: rgba(30, 30, 30, 0.95);
    --glass-bg: rgba(20, 20, 20, 0.85);
}

body.dark-mode .logo span { color: #fff; }
body.dark-mode .modal { background: var(--bg-light); color: var(--text-color); }
body.dark-mode .modal-header h3 { color: var(--text-color); }
body.dark-mode .type-btn { background: #2c2c2c; border-color: #444; }
body.dark-mode .type-btn span { color: #ccc; }
body.dark-mode .speed-limit-input input { background: #2c2c2c; color: #fff; border-color: #555; }
body.dark-mode .speed-limit-input label { color: #ccc; }
body.dark-mode .search-results { background: var(--bg-light); }
body.dark-mode .search-result-item { border-bottom-color: #444; }
body.dark-mode .search-result-item:hover { background: #2c2c2c; }
body.dark-mode .search-result-text strong { color: #eee; }
body.dark-mode .search-result-text small { color: #999; }
body.dark-mode #addressSearch { color: #eee; }
body.dark-mode .close-btn { color: #ccc; }
body.dark-mode .divider::before, body.dark-mode .divider::after { background: #555; }
body.dark-mode .custom-radar-marker { background: #1e1e1e; }
body.dark-mode .custom-parking-marker { border-color: #1e1e1e; }
body.dark-mode .leaflet-popup-content-wrapper { background: var(--bg-light); color: var(--text-color); border-radius: 12px; }
body.dark-mode .leaflet-popup-tip { background: var(--bg-light); }

/* Hız Koridoru Asistanı Paneli */
.corridor-panel {
    position: fixed; top: 85px; right: 15px; width: 300px;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px);
    border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 2000; display: none; flex-direction: column;
    overflow: hidden; transition: all 0.3s ease; border: 2px solid #2196F3;
}
body.dark-mode .corridor-panel { background: rgba(30,30,30,0.95); color: #fff; }
.corridor-panel.active { display: flex; }
.corridor-panel.danger { border-color: #f44336; box-shadow: 0 10px 30px rgba(244, 67, 54, 0.4); }
.corridor-panel.danger .corridor-header { background: #f44336; color: white; }
.corridor-header { background: #2196F3; padding: 12px 15px; color: white; display: flex; justify-content: space-between; align-items: center; font-weight: bold; font-size: 16px; transition: background 0.3s; }
.close-corridor-btn { background: none; border: none; color: white; font-size: 18px; cursor: pointer; }
.corridor-body { padding: 15px; }
.corridor-stats { display: flex; justify-content: space-between; margin-bottom: 15px; }
.stat-box { text-align: center; flex: 1; }
.stat-label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
body.dark-mode .stat-label { color: #aaa; }
.stat-value { display: block; font-size: 24px; font-weight: bold; color: #333; }
body.dark-mode .stat-value { color: #fff; }
.corridor-status { background: #e8f5e9; padding: 10px; border-radius: 8px; text-align: center; margin-bottom: 15px; font-weight: bold; color: #4CAF50; transition: all 0.3s; }
.corridor-panel.danger .corridor-status { background: #ffebee; color: #f44336; }
.wait-time { font-size: 14px; margin-top: 5px; color: #d32f2f; }
.corridor-controls { display: flex; gap: 10px; }
.corridor-select { flex: 2; padding: 8px; border-radius: 6px; border: 1px solid #ccc; background: #fff; color: #333; outline: none; }
body.dark-mode .corridor-select { background: #444; border-color: #555; color: #fff; }
.toggle-corridor-btn { flex: 1; background: #FFC107; color: #333; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; transition: background 0.2s; }
.show-corridor-btn { position: absolute; top: 155px; right: 15px; width: 45px; height: 45px; border-radius: 50%; background: #fff; color: #2196F3; border: 2px solid #2196F3; box-shadow: 0 4px 10px rgba(0,0,0,0.2); display: flex; justify-content: center; align-items: center; font-size: 20px; cursor: pointer; z-index: 1000; }
body.dark-mode .show-corridor-btn { background: #333; color: #64B5F6; border-color: #64B5F6; }
