/* ============================================
   Tour package itinerary picker
   File: assets/css/tour-itinerary.css

   Shared by the public booking form and the admin booking editor, which is
   why it is its own file rather than a block inside booking.css: the two
   pages load different stylesheets, and the picker has to look the same on
   both or the admin screen stops being a faithful view of what the customer
   filled in.

   Driven by assets/js/tour-picker.js. Every visibility change here is a
   class the script toggles - nothing is styled from JavaScript, so the
   whole appearance of the picker is readable in this one file.
   ============================================ */

/* Scoped rather than a bare .is-hidden: this file is loaded alongside page
   stylesheets that define their own, and a second global rule would be one
   more place to look when something will not hide. */
.tour-picker.is-hidden,
.tour-hidable.is-hidden,
.tour-state-block.is-hidden,
.tour-place-empty.is-hidden,
.tour-place-list.is-hidden {
    display: none;
}

/* The picker as a whole, matching the round-trip panel it sits beside. */
.tour-picker {
    padding: 16px 18px;
    margin-bottom: 20px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

.tour-picker-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.tour-picker-note {
    display: block;
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 14px;
}

/* ---------- choosing the states ---------- */

.tour-states {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 4px;
}

/* A tick box that reads as a button, because on a phone the label is the
   target and a bare checkbox is a 13px one. */
.tour-state-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2d3748;
    cursor: pointer;
    user-select: none;
}

.tour-state-toggle:hover {
    border-color: #667eea;
}

.tour-state-toggle input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #667eea;
    cursor: pointer;
}

/* :has is what lets a ticked box colour its own label without JavaScript
   adding a class. Browsers without it simply show the plain pill - the
   checkbox inside still shows the state, so nothing is lost. */
.tour-state-toggle:has(input:checked) {
    border-color: #667eea;
    background: #eef2ff;
    color: #4c51bf;
}

.tour-state-toggle:has(input:focus-visible) {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ---------- the places within one state ---------- */

.tour-state-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #d8dee9;
}

.tour-state-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4c51bf;
    margin-bottom: 10px;
}

.tour-place-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
}

/* One place the customer typed. The cross is part of the chip rather than a
   separate column so a long list still wraps sensibly on a narrow screen. */
.tour-place {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 12px;
    background: #ffffff;
    border: 1px solid #c3dafe;
    border-radius: 999px;
    font-size: 0.88rem;
    color: #2d3748;
    max-width: 100%;
}

.tour-place-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tour-place-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: #edf2f7;
    border: 0;
    border-radius: 50%;
    color: #718096;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.tour-place-remove:hover {
    background: #fed7d7;
    color: #c53030;
}

.tour-place-empty {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: #a0aec0;
}

/* ---------- typing the next one ---------- */

.tour-place-entry {
    display: flex;
    gap: 8px;
}

.tour-place-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: inherit;
    color: #2d3748;
    background: #ffffff;
}

.tour-place-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.tour-place-add {
    flex: 0 0 auto;
    padding: 10px 18px;
    background: #667eea;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.tour-place-add:hover {
    background: #5a67d8;
}

/* ---------- showing a finished itinerary ---------- */

/* Read-only rendering, used on the booking detail panel, the confirmation
   page and anywhere else an itinerary is shown rather than edited. */
.tour-itinerary {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tour-itinerary li + li {
    margin-top: 8px;
}

.tour-itinerary-state {
    font-weight: 600;
    color: #4c51bf;
}

.tour-itinerary-places {
    color: #2d3748;
}

@media (max-width: 600px) {
    .tour-picker {
        padding: 14px;
    }

    .tour-place-entry {
        flex-wrap: wrap;
    }

    .tour-place-add {
        width: 100%;
    }
}
