/* ============================================================
   VIAGO CUSTOMER WEBAPP
   Mobile-first app-like CSS
   ============================================================ */

/* ============ APP SHELL ============ */
.app-body {
    background: #f7f8fa;
    color: var(--brand-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    margin: 0;
    overscroll-behavior: none;
    min-height: 100vh;
    min-height: 100dvh; /* dynamic viewport - rieši iOS bottom bar */
}
.app-body * { box-sizing: border-box; }

/* Mobilný layout: flex column s tabbar-om vždy na spodku */
.app-shell {
    max-width: 440px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    box-shadow: 0 0 50px -10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}
.app-shell > main {
    flex: 1 0 auto; /* expand to push tabbar to bottom */
}
/* Padding-bottom na main aby fixed tabbar neprekryl posledný obsah */
.app-shell:has(> .app-tabbar) > main {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
    .app-shell {
        margin: 20px auto;
        min-height: calc(100vh - 40px);
        border-radius: 28px;
        overflow: hidden;
    }
}

/* ============ HEADER ============ */
.app-header {
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    min-height: 56px;
}
.app-header-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}
.app-header-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--brand-text);
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.app-header-back:hover { background: #e5e7eb; }
.app-header-back svg { width: 18px; height: 18px; }

.app-header-action {
    color: var(--brand-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
}
.app-header-action:hover { background: #f3f4f6; }

/* ============ CONTENT ============ */
.app-content {
    padding: 18px;
}
.app-content-tight { padding: 0; }

/* ============ BOTTOM NAV (Tab bar) ============ */
.app-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 50;
    /* Constrain to shell width on desktop preview */
    max-width: 440px;
    margin: 0 auto;
}
/* Subtle backdrop blur pre native feel (iOS-like) */
@supports (backdrop-filter: blur(20px)) {
    .app-tabbar {
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
}
.app-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--brand-text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 8px;
}
.app-tabbar a.active {
    color: var(--brand-primary);
}
.app-tabbar a svg {
    width: 22px;
    height: 22px;
}
/* Desktop: tabbar sa drží shell-u (440px max) */
@media (min-width: 700px) {
    .app-tabbar {
        position: sticky;
        bottom: 0;
        max-width: none;
        border-radius: 0 0 28px 28px;
    }
    .app-shell:has(> .app-tabbar) > main {
        padding-bottom: 18px; /* desktop nepotrebuje space pre fixed tabbar */
    }
}

/* ============ WELCOME / AUTH SCREENS ============ */
.welcome-hero {
    background: linear-gradient(135deg, var(--brand-primary-soft), #fff);
    padding: 50px 24px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.welcome-logo {
    width: 84px;
    height: 84px;
    background: var(--brand-secondary);
    color: var(--brand-primary);
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 800;
    margin-bottom: 22px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15);
}
.welcome-hero h1 {
    font-size: 30px;
    font-weight: 800;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
    color: var(--brand-text);
}
.welcome-hero p {
    color: var(--brand-text-muted);
    margin: 0 0 24px;
    font-size: 15px;
}

.auth-form {
    padding: 24px 18px;
}
.auth-form h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
}
.auth-form .form-sub {
    color: var(--brand-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}
.auth-link {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--brand-text-muted);
}
.auth-link a {
    color: var(--brand-text);
    font-weight: 600;
    text-decoration: none;
}

/* ============ FORM ELEMENTS (app-style) ============ */
.app-form-group {
    margin-bottom: 16px;
}
.app-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.app-form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    background: #fff;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}
.app-form-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-primary-soft);
}

/* OTP input boxes */
.otp-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}
.otp-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}
.otp-input:focus {
    outline: none;
    border-color: var(--brand-primary);
}
.otp-input.filled { border-color: var(--brand-primary); background: var(--brand-primary-soft); }

/* ============ APP BUTTON ============ */
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 20px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    line-height: 1;
}
.app-btn:active { transform: scale(0.98); }
.app-btn-primary {
    background: var(--brand-primary);
    color: var(--brand-secondary);
    box-shadow: 0 8px 20px -8px var(--brand-primary);
}
.app-btn-dark {
    background: var(--brand-secondary);
    color: #fff;
}
.app-btn-ghost {
    background: #f3f4f6;
    color: var(--brand-text);
}
.app-btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}
.app-btn-block { display: flex; }
.app-btn-sm { padding: 10px 16px; font-size: 14px; }
.app-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============ MAP CONTAINER ============ */
.app-map-wrap {
    position: relative;
    width: 100%;
    height: 38vh;
    min-height: 240px;
    background: #e5e7eb;
}
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}
.app-map-overlay {
    position: relative;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 20px;
    margin-top: -24px;
    box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, 0.1);
    z-index: 20;
}
.app-map-overlay::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
}

/* Location row in overlay */
.location-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: #f7f8fa;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
    text-decoration: none;
    color: var(--brand-text);
}
.location-row:hover { border-color: var(--brand-primary); }
.location-row-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.location-row-dot-pickup { background: #ef4444; }
.location-row-dot-dropoff { background: var(--brand-primary); }
.location-row-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}
.location-row-label .placeholder {
    color: var(--brand-text-muted);
    font-weight: 400;
}

/* ============ VEHICLE PICKER (carousel-like) ============ */
.vehicle-picker {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 14px 18px 18px;
    margin: 0 -18px 14px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* Pridať right padding aby posledná card mala miesto + scale neprerasla okraj */
    scroll-padding: 18px;
}
.vehicle-picker::-webkit-scrollbar { display: none; }
.vehicle-picker::after {
    /* Spacer na konci aby posledná card neulpela na okraji */
    content: '';
    flex: 0 0 8px;
}
.vehicle-card-app {
    flex: 0 0 128px;
    background: #fff;
    border: 2px solid #f1f5f9;
    border-radius: 18px;
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    scroll-snap-align: start;
    /* Zabrániť overflow vnútri */
    min-width: 0;
    box-sizing: border-box;
}
.vehicle-card-app.selected {
    border-color: var(--brand-primary);
    background: var(--brand-primary-soft);
    /* Namiesto scale použiť box-shadow pre depth — scale prerastal okraje */
    box-shadow: 0 4px 14px rgba(147, 51, 234, 0.18);
}
.vehicle-card-app-icon {
    font-size: 34px;
    margin-bottom: 8px;
    line-height: 1;
}
.vehicle-card-app-name {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vehicle-card-app-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--brand-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vehicle-card-app-cap {
    font-size: 10px;
    color: var(--brand-text-muted);
    margin-top: 4px;
    white-space: nowrap;
}

/* ============ TRIP STATUS SCREENS ============ */
.status-screen {
    padding: 24px 18px;
    text-align: center;
}
.status-illustration {
    width: 120px;
    height: 120px;
    background: var(--brand-primary-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    margin: 30px auto 22px;
    position: relative;
    overflow: hidden;
}
.status-illustration::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 3px solid var(--brand-primary);
    border-top-color: transparent;
    animation: rotate 1.5s linear infinite;
}
@keyframes rotate {
    to { transform: rotate(360deg); }
}
.status-illustration.success::before,
.status-illustration.error::before {
    animation: none;
    border-color: transparent;
}
.status-illustration.success { background: #ecfdf5; }
.status-illustration.error { background: #fee2e2; }

.status-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
}
.status-subtitle {
    color: var(--brand-text-muted);
    margin: 0 0 30px;
    font-size: 15px;
}

/* Driver card during pickup/in_progress */
.driver-card {
    background: #fff;
    border-radius: 18px;
    padding: 16px;
    border: 1px solid #f1f5f9;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.driver-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--brand-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    flex-shrink: 0;
}
.driver-info {
    flex: 1;
    text-align: left;
}
.driver-name {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}
.driver-meta {
    font-size: 13px;
    color: var(--brand-text-muted);
}
.driver-actions {
    display: flex;
    gap: 6px;
}
.driver-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-primary-soft);
    color: var(--brand-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.driver-action-btn svg { width: 18px; height: 18px; }

.car-plate {
    background: var(--brand-secondary);
    color: var(--brand-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1.5px;
}

/* Trip info card */
.trip-card {
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    border: 1px solid #f1f5f9;
    margin-bottom: 14px;
    text-align: left;
}
.trip-route {
    display: flex;
    gap: 12px;
    align-items: stretch;
}
.trip-route-icons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 14px;
    padding: 4px 0;
}
.trip-route-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.trip-route-dot-pickup { background: #ef4444; }
.trip-route-dot-dropoff { background: var(--brand-primary); }
.trip-route-line {
    flex: 1;
    width: 2px;
    background: #e5e7eb;
    margin: 4px 0;
}
.trip-route-stops {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.trip-route-stop {
    font-size: 14px;
}
.trip-route-stop-label {
    font-size: 11px;
    color: var(--brand-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

/* Price breakdown */
.price-summary {
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    border: 1px solid #f1f5f9;
    margin-bottom: 14px;
}
.price-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}
.price-row strong { font-weight: 700; }
.price-row.total {
    border-top: 1px solid #f1f5f9;
    margin-top: 8px;
    padding-top: 12px;
    font-size: 16px;
    font-weight: 700;
}

/* ============ RATING ============ */
.rating-screen {
    padding: 30px 18px;
    text-align: center;
}
.rating-stars {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 28px 0 24px;
}
.rating-star {
    font-size: 44px;
    cursor: pointer;
    color: #d1d5db;
    transition: transform 0.1s, color 0.15s;
    user-select: none;
    background: none;
    border: none;
    padding: 0;
}
.rating-star:hover { transform: scale(1.1); }
.rating-star.active { color: #f59e0b; }
.rating-feedback {
    margin: 16px 0;
}

/* ============ HISTORY ROWS ============ */
.history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--brand-text);
}
.history-row-left {
    flex: 1;
    overflow: hidden;
}
.history-row-route {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-row-meta {
    font-size: 12px;
    color: var(--brand-text-muted);
}
.history-row-right {
    text-align: right;
}
.history-row-price {
    font-size: 16px;
    font-weight: 700;
}

/* ============ PROFILE ============ */
.profile-header {
    text-align: center;
    padding: 30px 18px 24px;
    border-bottom: 1px solid #f1f5f9;
}
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--brand-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 800;
    margin-bottom: 14px;
}
.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px;
}
.profile-email {
    color: var(--brand-text-muted);
    font-size: 14px;
}
.profile-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.profile-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: var(--brand-text);
    cursor: pointer;
}
.profile-list-item:hover { background: #f7f8fa; }
.profile-list-item-icon {
    width: 36px;
    height: 36px;
    background: var(--brand-primary-soft);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 16px;
}
.profile-list-item-label {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}
.profile-list-item-arrow {
    color: var(--brand-text-muted);
    font-size: 18px;
}

/* ============ STATUS BADGES ============ */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-badge-completed { background: #ecfdf5; color: #047857; }
.status-badge-cancelled { background: #fee2e2; color: #b91c1c; }
.status-badge-pending   { background: #fef3c7; color: #92400e; }

/* ============ ALERT ============ */
.app-alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 14px;
}
.app-alert-success { background: #ecfdf5; color: #047857; }
.app-alert-error   { background: #fee2e2; color: #b91c1c; }
.app-alert-info    { background: var(--brand-primary-soft); color: var(--brand-secondary); }

/* ============ ANIMATIONS ============ */
@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}
.pulse-dot {
    animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ============ MAP MARKER (custom DivIcon) ============ */
.map-marker {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.map-marker-pickup { background: #ef4444; }
.map-marker-dropoff { background: var(--brand-primary); }
.map-marker-driver {
    background: var(--brand-secondary);
    width: 30px;
    height: 30px;
}
.map-marker-inner {
    transform: rotate(45deg);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
    display: inline-block;
}

/* Skeleton loader */
.skel {
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: skel-shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes skel-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
