/* VeloPlan Custom Styles */

:root {
    --brand-orange: #fc4c02;
    --brand-dark: #242428;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.accent-text {
    color: var(--brand-orange);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Map Pattern Background */
.map-pattern {
    background-color: #e5e7eb;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Tab Styles */
.tab-btn {
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--brand-orange);
}

.active-tab {
    color: var(--brand-orange) !important;
    border-color: var(--brand-orange) !important;
}

/* Card Hover Effects */
.trip-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.trip-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Form Inputs */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--brand-orange);
    ring: 2px;
    ring-color: var(--brand-orange);
}

/* iOS date inputs — prevent blank gray boxes */
input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: white;
    color: #111827;
    min-height: 38px;
}

input[type="date"]:invalid,
input[type="date"][value=""] {
    color: #9ca3af;
}

/* Button Transitions */
button {
    transition: all 0.2s;
}

/* Country flag emoji support */
.country-flag {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
    font-size: 1.2em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

/* iOS smooth scrolling */
#app-container {
    -webkit-overflow-scrolling: touch;
}

/* Mobile modal: stretch to fill below the top gap, flex layout */
@media (max-width: 639px) {
    .mobile-modal {
        min-height: calc(100dvh - 3rem);
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
    }
    .mobile-modal form {
        display: flex;
        flex-direction: column;
        flex: 1;
    }
    .mobile-modal .form-actions {
        margin-top: auto;
        padding-top: 1rem;
    }
}

/* Leaflet z-index fix: Leaflet internally uses z-index 400-1000 for panes
   and controls. Creating a stacking context on the map container keeps those
   high values scoped inside, so they never compete with page-level overlays. */
#routes-map {
    isolation: isolate;
    z-index: 0;
    position: relative;
}

#elevation-container { overflow: hidden; }

/* Routes side-by-side layout — desktop (lg+) */
@media (min-width: 1024px) {
    #tab-routes {
        overflow: hidden;
    }
    #routes-left-panel {
        min-height: 0;
        overflow: hidden;          /* contain map + elevation within panel */
    }
    #routes-left-panel.has-elevation #routes-map {
        min-height: 200px !important;
    }
    #routes-map {
        min-height: 350px !important;  /* allow map to shrink for elevation chart */
    }
    #routes-right-panel {
        max-height: 100%;
        overflow-y: auto;
    }
}

/* Mobile — stack vertically with fixed heights */
@media (max-width: 1023px) {
    #routes-map {
        min-height: 300px !important;
        max-height: 400px;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

/* Drag-and-Drop Route Reordering */
.route-row.dragging {
    opacity: 0.4;
    background: #fff7ed;
}

.route-row.drag-over {
    border-top: 2px solid var(--brand-orange);
}

.drag-handle {
    cursor: grab;
    color: #d1d5db;
    transition: color 0.15s;
}

.drag-handle:hover {
    color: #6b7280;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Breadcrumbs */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.breadcrumb-nav a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb-nav a:hover {
    color: var(--brand-orange);
}

.breadcrumb-nav .breadcrumb-current {
    color: #111827;
    font-weight: 500;
}

/* Trip Status — colored left border */
.trip-card-status {
    border-left: 4px solid #e5e7eb !important;
}
.trip-card-status-finished { border-left-color: #9ca3af !important; }
.trip-card-status-ongoing  { border-left-color: #16a34a !important; }
.trip-card-status-upcoming { border-left-color: #2563eb !important; }
.trip-card-status-draft    { border-left-color: #ea580c !important; }
