/* ==========================================================================
   Tripaure — inner pages (auth, booking, account)
   Loaded on top of tripaure-web.css by the pages that need it.
   Reuses the --tp-* tokens defined there; adds nothing to :root.
   ========================================================================== */

/* §  SOLID NAV
   The base .tp-nav floats transparently over the home hero. Inner pages have
   no hero, so they get a solid bar with the dark logo instead. */

.tp-nav-solid {
    position: sticky;
    background: #fff;
    box-shadow: 0 2px 14px rgba(var(--tp-text-dark-rgb), .08);
    padding: .9rem 0;
}

.tp-nav-solid .tp-nav-logo-desktop {
    display: none;
}

.tp-nav-solid .tp-nav-logo-mobile {
    display: block;
}

.tp-nav-solid .tp-lang-option {
    color: rgba(var(--tp-primary-rgb), .55);
}

.tp-nav-solid .tp-lang-option:hover,
.tp-nav-solid .tp-lang-option.active {
    color: var(--tp-primary);
}

.tp-nav-solid .tp-lang-sep {
    color: var(--tp-primary);
}

.tp-nav-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    transition: color .2s ease;
}

.tp-nav-link i {
    font-size: 1.15rem;
}

.tp-nav-link:hover {
    color: #fff;
}

.tp-nav-solid .tp-nav-link {
    color: rgba(var(--tp-text-dark-rgb), .7);
}

.tp-nav-solid .tp-nav-link:hover {
    color: var(--tp-primary);
}

.tp-nav-link-btn {
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
}

.tp-nav-logout {
    display: inline-flex;
    margin: 0;
}

/* §  PAGE SHELL */

.tp-page {
    padding: 3rem 0 4.5rem;
    background: var(--tp-bg-soft);
    min-height: 60vh;
}

.tp-page-head {
    margin-bottom: 2rem;
}

.tp-page-title {
    font-family: var(--tp-font-heading);
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    font-weight: 700;
    color: var(--tp-text-dark);
    margin: 0 0 .4rem;
}

.tp-page-sub {
    color: var(--tp-text-muted);
    font-size: 1rem;
    margin: 0;
}

.tp-card {
    background: #fff;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-lg);
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(var(--tp-text-dark-rgb), .05);
}

.tp-card + .tp-card {
    margin-top: 1.25rem;
}

.tp-card-narrow {
    max-width: 480px;
    margin: 0 auto;
}

.tp-card-title {
    font-family: var(--tp-font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tp-text-dark);
    margin: 0 0 1.25rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--tp-border);
}

.tp-section-title {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--tp-accent-deep);
    margin: 0 0 1rem;
}

/* §  FORMS */

.tp-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
}

.tp-field-full {
    grid-column: 1 / -1;
}

.tp-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--tp-text-dark);
    margin-bottom: .4rem;
}

.tp-label .req {
    color: #d64545;
}

.tp-input,
.tp-select,
.tp-textarea {
    width: 100%;
    padding: .7rem .9rem;
    font-family: inherit;
    font-size: .95rem;
    color: var(--tp-text-dark);
    background: #fff;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-btn);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.tp-input:focus,
.tp-select:focus,
.tp-textarea:focus {
    outline: 0;
    border-color: var(--tp-accent);
    box-shadow: 0 0 0 3px rgba(var(--tp-accent-rgb), .15);
}

.tp-textarea {
    resize: vertical;
    min-height: 90px;
}

.tp-hint {
    display: block;
    font-size: .8rem;
    color: var(--tp-text-muted);
    margin-top: .35rem;
}

/* Matches the class public/js/tripaure-web.js injects for 422 field errors,
   so server-side and ajax validation look identical. */
.tp-field-error {
    display: block;
    font-size: .82rem;
    color: #d64545;
    margin-top: .35rem;
}

.tp-input.is-invalid,
.tp-select.is-invalid,
.tp-textarea.is-invalid {
    border-color: #d64545;
}

/* §  BOOKING WIZARD (multi-step form) */

.tp-stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.tp-stepper-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--tp-text-muted);
    cursor: not-allowed;
}

.tp-stepper-item.is-unlocked {
    cursor: pointer;
}

/* Connector line, drawn between this item's circle and the next one's —
   inset-inline-* (not left/right) so it flips automatically in Arabic/RTL. */
.tp-stepper-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 17px;
    inset-inline-start: calc(50% + 21px);
    width: calc(100% - 42px);
    height: 2px;
    background: var(--tp-border);
    z-index: 0;
}

.tp-stepper-item.is-done::after,
.tp-stepper-item.is-active::after {
    background: var(--tp-accent);
}

.tp-stepper-num {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--tp-border);
    font-weight: 700;
    font-size: .95rem;
    color: var(--tp-text-muted);
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.tp-stepper-item.is-active .tp-stepper-num {
    background: var(--tp-accent);
    border-color: var(--tp-accent);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(var(--tp-accent-rgb), .18);
}

.tp-stepper-item.is-done .tp-stepper-num {
    background: var(--tp-accent-light);
    border-color: var(--tp-accent);
    color: var(--tp-accent-deep);
}

.tp-stepper-label {
    font-size: .82rem;
    font-weight: 600;
    text-align: center;
    transition: color .2s ease;
}

.tp-stepper-item.is-active .tp-stepper-label,
.tp-stepper-item.is-done .tp-stepper-label {
    color: var(--tp-text-dark);
}

/* Visibility is JS-driven (tripaure-book.js sets `hidden`) — this only adds
   the entrance animation. */
.tp-step.is-active {
    animation: tpStepIn .25s ease;
}

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

@media (max-width: 575.98px) {
    .tp-stepper-label {
        display: none;
    }
}

/* §  RADIO CARDS (trip type) */

.tp-choice-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.tp-choice {
    position: relative;
}

.tp-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tp-choice-label {
    display: block;
    padding: .9rem 1rem;
    border: 1.5px solid var(--tp-border);
    border-radius: var(--tp-radius-btn);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.tp-choice-label strong {
    display: block;
    font-size: .95rem;
    color: var(--tp-text-dark);
}

.tp-choice-label span {
    font-size: .82rem;
    color: var(--tp-text-muted);
}

.tp-choice input:checked + .tp-choice-label {
    border-color: var(--tp-accent);
    background: var(--tp-accent-light);
}

.tp-choice input:focus-visible + .tp-choice-label {
    box-shadow: 0 0 0 3px rgba(var(--tp-accent-rgb), .2);
}

/* §  MAP PICKER */

.tp-map {
    height: 260px;
    border-radius: var(--tp-radius-btn);
    border: 1px solid var(--tp-border);
    margin-top: .6rem;
    z-index: 0;
}

.tp-map-hint {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    color: var(--tp-text-muted);
    margin-top: .4rem;
}

/* §  ALERTS — moved to tripaure-web.css (loaded globally; the shared flash
   partial can render on any page, not just the ones that push this file). */

/* §  TRIP CARDS (account) — collapsed by default, .tp-trip-toggle expands
   the .tp-trip-details panel via aria-expanded (see tripaure-web.js). */

.tp-trip {
    /* Hard clip: a nowrap address deep inside a column-direction flex item
       (mobile) can otherwise force the whole page into horizontal scroll
       instead of just truncating within the card. */
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.tp-trip:hover {
    border-color: rgba(var(--tp-accent-rgb), .5);
    box-shadow: 0 8px 26px rgba(var(--tp-text-dark-rgb), .06);
}

.tp-trip + .tp-trip {
    margin-top: .85rem;
}

.tp-trip-toggle {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    width: 100%;
    min-width: 0;
    padding: .5rem 1.25rem 1.25rem;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
}

.tp-trip-body {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.tp-trip-ref {
    display: block;
    padding: 1.25rem 1.25rem 0;
    font-family: var(--tp-font-heading);
    font-weight: 700;
    color: var(--tp-text-dark);
    font-size: 1rem;
    text-decoration: none;
}

.tp-trip-ref:hover {
    color: var(--tp-accent-deep);
}

.tp-trip-route {
    font-size: .9rem;
    color: var(--tp-text-muted);
    margin: .35rem 0 0;
    display: flex;
    align-items: center;
    gap: .4rem;
    width: 100%;
    min-width: 0;
}

/* One line each, truncated — full addresses move to the expanded panel
   so a long real-world address can't blow up the collapsed card's height. */
.tp-trip-route span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 0;
}

.tp-trip-route i {
    flex-shrink: 0;
}

.tp-trip-when {
    font-size: .85rem;
    color: var(--tp-text-dark);
    margin-top: .5rem;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.tp-trip-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .6rem;
    flex-shrink: 0;
}

.tp-trip-chevron {
    font-size: 1.3rem;
    color: var(--tp-text-muted);
    transition: transform .25s ease;
}

.tp-trip-toggle[aria-expanded="true"] .tp-trip-chevron {
    transform: rotate(180deg);
    color: var(--tp-accent-deep);
}

.tp-trip-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.tp-trip-details-inner {
    margin: 0 1.25rem;
    padding: 1.1rem 0 1.25rem;
    border-top: 1px solid var(--tp-border);
}

/* A narrower label column for .tp-dl where the value needs more room, e.g.
   a full street address. */
.tp-dl.tp-dl-compact {
    grid-template-columns: minmax(90px, 140px) 1fr;
}

/* Label above value, for narrow cards (same as the mobile layout). */
.tp-dl.tp-dl-stacked {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}
.tp-dl.tp-dl-stacked dt {
    padding-bottom: 0;
    border-bottom: 0;
}
.tp-dl.tp-dl-stacked dd {
    padding-top: .2rem;
}

.tp-trip-details-actions {
    margin-top: 1rem;
}

/* §  BADGES */

.tp-badge {
    display: inline-block;
    padding: .28rem .7rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}

.tp-badge-warning { background: #fff3d6; color: #8a5a00; }
.tp-badge-info    { background: #dff1fb; color: #10627f; }
.tp-badge-primary { background: #e2ecff; color: #1a4ba8; }
.tp-badge-success { background: #e2f7ec; color: #1c6b45; }
.tp-badge-danger  { background: #fde5e5; color: #972828; }
.tp-badge-secondary { background: #eceff3; color: #4d5c6e; }

/* §  DEFINITION ROWS (trip detail) */

.tp-dl {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: .1rem 1.25rem;
}

.tp-dl dt {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tp-text-muted);
    padding: .6rem 0;
}

.tp-dl dd {
    margin: 0;
    padding: .6rem 0;
    font-size: .95rem;
    color: var(--tp-text-dark);
    word-break: break-word;
}

.tp-dl dt + dd {
    border-bottom: 1px solid rgba(var(--tp-text-dark-rgb), .06);
}

.tp-dl dt {
    border-bottom: 1px solid rgba(var(--tp-text-dark-rgb), .06);
}

/* No rule under the last row — it doubled up with a following divider/card edge. */
.tp-dl dt:last-of-type,
.tp-dl dd:last-of-type {
    border-bottom: 0;
}

/* §  TRIP ROUTE + FACTS (account trip details) */

/* Pickup → drop-off as a vertical route line. */
.tp-route {
    position: relative;
    display: grid;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--tp-border);
}
.tp-route-stop {
    position: relative;
    padding-inline-start: 2.25rem;
    color: var(--tp-text-dark);
    line-height: 1.6;
}
/* Dashed segment from this stop's dot down to the next one. */
.tp-route-stop:not(.is-end)::after {
    content: "";
    position: absolute;
    inset-inline-start: 7px;
    top: 18px;
    bottom: calc(-1.25rem - 2px);
    border-inline-start: 2px dashed rgba(var(--tp-primary-rgb), .35);
}
.tp-route-stop small,
.tp-fact small {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tp-text-muted);
}
.tp-route-dot {
    position: absolute;
    inset-inline-start: 0;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--tp-primary);
}
.tp-route-stop.is-end .tp-route-dot {
    background: var(--tp-primary-deep);
    border-color: var(--tp-primary-deep);
}

.tp-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
}
.tp-fact {
    padding: .9rem 1rem;
    border-radius: var(--tp-radius);
    background: var(--tp-bg-soft);
    border: 1px solid rgba(var(--tp-primary-rgb), .08);
    color: var(--tp-text-dark);
    font-weight: 500;
}
.tp-fact i {
    font-size: 1.35rem;
    color: var(--tp-primary);
    margin-bottom: .35rem;
}

/* §  EMPTY STATE */

.tp-empty {
    text-align: center;
    padding: 3rem 1.5rem;
}

.tp-empty i {
    font-size: 3rem;
    color: rgba(var(--tp-accent-rgb), .45);
    display: block;
    margin-bottom: .75rem;
}

.tp-empty p {
    color: var(--tp-text-muted);
    margin: 0 0 1.25rem;
}

/* §  ACCOUNT SHELL (profile / trips / security sub-nav) */

.tp-account-nav {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    background: #fff;
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius-lg);
    padding: .75rem;
}

.tp-account-nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .85rem;
    border-radius: var(--tp-radius-btn);
    font-size: .92rem;
    font-weight: 600;
    color: var(--tp-text-dark);
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}

.tp-account-nav-link i {
    font-size: 1.2rem;
    color: var(--tp-text-muted);
}

.tp-account-nav-link:hover {
    background: var(--tp-bg-soft);
}

.tp-account-nav-link.is-active {
    background: var(--tp-accent-light);
    color: var(--tp-accent-deep);
}

.tp-account-nav-link.is-active i {
    color: var(--tp-accent-deep);
}

@media (max-width: 991.98px) {
    .tp-account-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .tp-account-nav-link {
        white-space: nowrap;
    }
}

/* §  AVATAR */

.tp-avatar-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.tp-avatar-img,
.tp-avatar-fallback {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tp-avatar-img {
    object-fit: cover;
    border: 1px solid var(--tp-border);
}

.tp-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tp-accent-light);
    color: var(--tp-accent-deep);
    font-weight: 700;
    font-size: 1.4rem;
}

.tp-avatar-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}

/* §  FLOATING ACTION BUTTON (account / trips) */

.tp-fab {
    /* Stacked above .scroll-to-top (style.css: right/bottom 20px, 40px tall)
       rather than sharing its corner, so the two never overlap once both
       are visible past the scroll threshold. */
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tp-accent);
    color: #fff;
    box-shadow: 0 10px 30px rgba(var(--tp-accent-rgb), .45);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
    z-index: 999;
}

.tp-fab i {
    font-size: 1.6rem;
}

.tp-fab:hover {
    background: var(--tp-accent-deep);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(var(--tp-accent-rgb), .55);
}

[dir="rtl"] .tp-fab {
    right: auto;
    left: 20px;
}

@media (max-width: 767.98px) {
    .tp-fab {
        bottom: 80px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    [dir="rtl"] .tp-fab {
        left: 16px;
    }
}

/* §  MISC */

.tp-auth-links {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .9rem;
    color: var(--tp-text-muted);
}

.tp-auth-links a {
    color: var(--tp-accent-deep);
    font-weight: 600;
    text-decoration: none;
}

.tp-auth-links a:hover {
    text-decoration: underline;
}

.tp-form-actions {
    margin-top: 1.75rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.tp-divider {
    height: 1px;
    background: var(--tp-border);
    margin: 1.5rem 0;
}

.tp-btn-block {
    width: 100%;
    justify-content: center;
}

.tp-btn-ghost {
    background: transparent;
    border: 1.5px solid var(--tp-border);
    color: var(--tp-text-dark);
}

.tp-btn-ghost:hover {
    border-color: var(--tp-accent);
    color: var(--tp-accent-deep);
}

.tp-btn-danger {
    background: #d64545;
    color: #fff;
}

.tp-btn-danger:hover {
    background: #b83a3a;
    color: #fff;
}

@media (max-width: 767.98px) {

    .tp-form-grid,
    .tp-choice-group {
        grid-template-columns: minmax(0, 1fr);
    }

    .tp-card {
        padding: 1.35rem;
    }

    .tp-page {
        padding: 1.75rem 0 3rem;
    }

    .tp-dl,
    .tp-dl.tp-dl-compact {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .tp-dl dt {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .tp-trip-toggle {
        flex-direction: column;
        gap: .75rem;
    }

    .tp-trip-meta {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
    }
}
