/* css/style.css */

/* Core Variables & Tokens */
:root {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.85);
    --bg-card-solid: #1e293b;
    --bg-input: rgba(15, 23, 42, 0.6);
    
    --primary: #10b981; /* Emerald Green - perfect for outdoor/nature theme */
    --primary-hover: #059669;
    --primary-light: rgba(16, 185, 129, 0.15);
    
    --secondary: #64748b;
    --danger: #ef4444;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #10b981;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-fab: 0 4px 14px 0 rgba(0, 0, 0, 0.4);
    
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-main);
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Fullscreen Map */
#map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Leaflet dark theme override for attribution and overlays */
.leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.7) !important;
    color: var(--text-muted) !important;
    font-size: 9px !important;
}
.leaflet-control-attribution a {
    color: var(--primary) !important;
}
.leaflet-bar {
    border: none !important;
    box-shadow: var(--shadow-fab) !important;
}
.leaflet-bar a {
    background-color: var(--bg-card-solid) !important;
    color: var(--text-main) !important;
    border-bottom: 1px solid var(--border-color) !important;
}
.leaflet-bar a:hover {
    background-color: #334155 !important;
    color: var(--primary) !important;
}

/* Floating Action Buttons (FABs) */
.floating-controls {
    position: absolute;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}
.floating-controls button {
    pointer-events: auto;
}

.top-left {
    top: 20px;
    left: 20px;
}

.bottom-right {
    bottom: calc(20px + var(--safe-bottom));
    right: 20px;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-fab);
    transition: transform 0.2s, background-color 0.2s;
    font-size: 1.25rem;
}
.fab:active {
    transform: scale(0.92);
}

.fab.primary {
    background-color: var(--primary);
    color: #fff;
}
.fab.primary:hover {
    background-color: var(--primary-hover);
}

.fab.secondary {
    background-color: var(--bg-card-solid);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.fab.secondary:hover {
    background-color: #334155;
}

/* Slide-up Drawers */
.drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85%;
    background-color: var(--bg-card-solid); /* Solid slate background for maximum mobile performance */
    border-top: 1px solid var(--border-color);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    padding-bottom: var(--safe-bottom);
}

.drawer.hidden {
    transform: translateY(100%);
}

.drawer-header {
    padding: 16px 20px 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.drawer-handle {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background-color: rgba(255, 255, 255, 0.2);
}

.drawer-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.btn-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.btn-close:active {
    background: rgba(255, 255, 255, 0.15);
}

.drawer-content {
    overflow-y: auto;
    padding: 12px 20px 24px 20px;
    flex: 1;
}

/* Forms styling */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Category Selector (Pill radio buttons) */
.category-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-selector input[type="radio"] {
    display: none;
}

.cat-pill {
    padding: 10px 14px;
    border-radius: 20px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s, border-color 0.2s;
}

.category-selector input[type="radio"]:checked + .cat-pill {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 500;
}

/* Photo Upload Elements */
.photo-upload-container {
    position: relative;
    width: 100%;
}

.photo-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 120px;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-muted);
    transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}
.photo-upload-label:hover {
    border-color: var(--primary);
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.02);
}

.photo-upload-container input[type="file"] {
    display: none;
}

.photo-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-photo {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.85);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Coordinates block */
.coordinates-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}
.coordinates-info i {
    color: var(--primary);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s, transform 0.1s;
}
.btn:active {
    transform: scale(0.98);
}

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

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

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Search Filters & Layout */
.search-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input-wrapper input {
    padding-left: 44px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-categories {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
}
.filter-categories::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

.filter-pill {
    padding: 8px 12px;
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-pill.active {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}

.filter-settings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.filter-setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-setting-item .label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mode-toggle {
    display: flex;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    padding: 2px;
}
.mode-toggle input {
    display: none;
}
.mode-toggle label {
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-bottom: 0;
}
.mode-toggle input:checked + label {
    background-color: var(--primary);
    color: white;
}

/* Search results list */
.search-results-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.results-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.result-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.result-photo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background-color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

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

.result-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.result-badge {
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
}

.result-distance-block {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.result-distance {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
}

.result-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Detail Card Styling */
.detail-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-photo-wrapper {
    width: 100%;
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    position: relative;
}

.detail-photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
}

.detail-info-block {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-badge {
    padding: 6px 12px;
    border-radius: 20px;
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.detail-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-description {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e2e8f0;
}

.detail-route-card {
    background-color: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.route-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.route-metric.highlighted .metric-value {
    color: var(--primary);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

/* Notification Banner */
.notification-banner {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
}

.notification-banner.hidden {
    opacity: 0;
    transform: translate(-50%, -20px);
}

.notification-banner .message {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

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

/* Star Rating styling */
.rating-stars-selector {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.star-btn {
    background: none;
    border: none;
    padding: 6px;
    font-size: 1.8rem;
    cursor: pointer;
    color: #94a3b8; /* Default slate outline color */
    transition: color 0.15s, transform 0.1s;
}
.star-btn:active {
    transform: scale(0.9);
}
.star-btn .fa-solid {
    color: #f59e0b; /* Amber yellow for filled stars */
}

/* Detail rating display stars */
.detail-rating-display {
    display: flex;
    gap: 4px;
    font-size: 1.1rem;
}
.detail-rating-display .fa-star {
    color: #f59e0b; /* Amber */
}
.detail-rating-display .fa-regular {
    color: rgba(255, 255, 255, 0.15); /* Faded outline stars */
}

/* Search results list rating display */
.result-rating {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Red Delete Button */
.btn-danger {
    background-color: var(--danger);
    color: white;
}
.btn-danger:hover {
    background-color: #dc2626;
}

.top-right {
    top: 20px;
    right: 20px;
}

/* Login Screen */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.login-card {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    width: 64px;
    height: 64px;
    background-color: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 20px auto;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-left: 44px;
    padding-right: 44px;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: color 0.2s;
}

.btn-toggle-password:hover {
    color: var(--text-main);
}

.login-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-login {
    margin-top: 10px;
}

