/* ── Watchlist ───────────────────────────────────────────── */

/* Mode isolation: watchlist shows only its own view */
.mode-watchlist .search-section,
.mode-watchlist .hero-spacer:not(.bottom),
.mode-watchlist .results,
.mode-watchlist .loading,
.mode-watchlist .whatsapp-banner-wrap,
#main-container.mode-watchlist .info-below-search {
    display: none;
}

.watchlist-view {
    display: none;
    width: 100%;
    max-width: 560px;
    margin: 35px auto 0;
}

.mode-watchlist .watchlist-view {
    display: block;
}

.watch-header {
    display: flex;
    align-items: center;
    padding: 0 4px 8px;
}

.watch-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-2);
}

.watch-count {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--fg-3);
    font-variant-numeric: tabular-nums;
}

.watch-list {
    position: relative; /* offsetParent for drag hit-testing */
    border: 1px solid var(--border-3);
    border-radius: 8px;
    background: var(--bg-surface);
    overflow: hidden;
}

.watch-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 56px;
    padding: 0 12px 0 6px;
    cursor: pointer;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.watch-row + .watch-row {
    border-top: 1px solid var(--border-4);
}

.watch-row:hover {
    background: var(--hover-bg);
}

.watch-row:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: -2px;
}

.watch-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 10px 0;
}

.watch-codes {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.watch-icao {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--fg);
}

.watch-iata {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: var(--fg-3);
}

.watch-metar {
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--fg-2);
    overflow-wrap: anywhere;
}

.watch-metar:empty {
    display: none;
}

/* Star above the drag handle, in one narrow centered column */
.watch-tools {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
}

.watch-tools .watch-star {
    width: 32px;
    height: 32px;
}

.watch-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 20px;
    color: var(--fg-3);
    cursor: grab;
    touch-action: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.watch-row:hover .watch-handle {
    opacity: 1;
}

/* Landing slot: the real row, emptied and dashed */
.watch-row.placeholder {
    background: var(--bg-subtle);
    box-shadow: inset 0 0 0 1.5px var(--border-2);
    border-radius: 6px;
}

.watch-row.placeholder > * {
    visibility: hidden;
}

/* Floating copy that follows the pointer */
.watch-ghost {
    position: fixed;
    z-index: 1000;
    box-sizing: border-box;
    margin: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    transform: scale(1.02);
    opacity: 0.96;
}

.watch-ghost .watch-handle {
    opacity: 1;
    color: var(--fg);
}

body.watch-dragging .watch-row:hover:not(.placeholder) {
    background: none;
}

body.watch-dragging,
body.watch-dragging * {
    user-select: none;
    -webkit-user-select: none;
    cursor: grabbing !important;
}

/* ── Add field ── */
.watch-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-left: 10px;
    padding: 0;
    border: 1px solid var(--border-2);
    border-radius: 50%;
    background: transparent;
    color: var(--fg-2);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.watch-add-btn svg {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.watch-add-btn:hover:not(:disabled) {
    background: var(--fg);
    color: var(--bg);
    border-color: transparent;
}

.watchlist-view.adding .watch-add-btn svg {
    transform: rotate(45deg);
}

.watch-add-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.watch-add {
    display: none;
    position: relative;
    margin-bottom: 12px;
}

.watchlist-view.adding .watch-add {
    display: block;
    animation: watch-add-in 0.18s ease-out;
}

@keyframes watch-add-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

.watch-add-input {
    width: 100%;
    box-sizing: border-box;
    height: 46px;
    padding: 0 14px;
    font-family: var(--font-data);
    font-size: 1rem; /* ≥16px: no iOS focus zoom */
    font-weight: 500;
    color: var(--fg);
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
}

.watch-add-input::placeholder {
    color: var(--fg-3);
    font-weight: 300;
}

.watch-add-dropdown {
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Home "Novità" banner is a button that opens the watchlist */
button.whatsapp-banner {
    font-family: inherit;
    cursor: pointer;
}

.watch-arrow {
    display: flex;
    color: var(--fg-3);
    transition: transform 0.15s, color 0.15s;
}

.watch-row:hover .watch-arrow {
    color: var(--fg);
    transform: translateX(3px);
}

.watch-empty {
    padding: 28px 20px;
    border: 1px dashed var(--border-2);
    border-radius: 8px;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--fg-3);
}

/* ── Star toggle (airport header + watchlist rows) ── */
.watch-star {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--fg-3);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.watch-star .star-icon {
    fill: none;
    transition: fill 0.15s, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.watch-star:hover {
    color: var(--fg);
    background: var(--hover-bg);
}

.watch-star.on,
.watch-star.on:hover {
    color: var(--amber);
}

.watch-star.on .star-icon {
    fill: currentColor;
}

.watch-star:active .star-icon {
    transform: scale(0.85);
}

.airport-title-row .watch-star {
    width: 28px;
    height: 28px;
    margin-left: -2px;
}

.airport-title-row .watch-star .star-icon {
    width: 18px;
    height: 18px;
}

.watch-star.shake {
    animation: watch-shake 0.35s;
}

@keyframes watch-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-3px); }
    75%      { transform: translateX(3px); }
}

@media (max-width: 767px) {
    .watchlist-view {
        margin-top: 20px;
    }
}

/* ── Favourites strip on the home screen ─────────────────── */
.quick-watch-wrap {
    width: 100%;
    max-width: none;
    margin: 14px 0 0;
}

.quick-watch-title {
    margin: 0 0 6px 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--fg-2);
}

.quick-watch {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
    padding: 0 2px;
}

.quick-watch-wrap[hidden],
.quick-watch [hidden],
.mode-area .quick-watch-wrap,
.mode-watchlist .quick-watch-wrap,
.has-route .quick-watch-wrap,
.is-searching .quick-watch-wrap {
    display: none;
}

.quick-watch-chip,
.quick-watch-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 8px 11px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    color: var(--fg);
    font-family: var(--font-data);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.quick-watch-chip .star-icon {
    width: 12px;
    height: 12px;
    fill: var(--amber);
    stroke: var(--amber);
}

.quick-watch-chip:hover,
.quick-watch-all:hover {
    border-color: var(--fg);
}

.quick-watch-all {
    background: transparent;
    color: var(--fg-2);
    font-family: inherit;
}

.quick-watch-all svg {
    width: 12px;
    height: 12px;
}

/* Favourites supersede the top-searches shortcuts in the search bar */
.has-favs .quick-airports {
    display: none;
}
