﻿/* ============================================================
   Wander Freely® — Component Styles
   ============================================================ */

:root {
    --wf-overlay-bg: rgba(0, 0, 0, 0.45);
    --wf-modal-bg: rgba(255, 255, 255, 0.98);
    --wf-modal-border: rgba(0, 0, 0, 0.12);
    --wf-text: #111827;
    --wf-text-muted: #6b7280;
    --wf-text-dim: #9ca3af;
    --wf-input-bg: rgba(0, 0, 0, 0.05);
    --wf-input-border: rgba(0, 0, 0, 0.1);
    --wf-tab-bg: rgba(0, 0, 0, 0.04);
    --wf-tab-hover: rgba(0, 0, 0, 0.07);
    --wf-close-bg: rgba(0, 0, 0, 0.06);
    --wf-close-hover: rgba(0, 0, 0, 0.1);
    --wf-glass-fx: blur(40px) saturate(1.8);
}

html.dark {
    --wf-overlay-bg: rgba(0, 0, 0, 0.75);
    --wf-modal-bg: rgba(13, 17, 23, 0.92);
    --wf-modal-border: rgba(255, 255, 255, 0.1);
    --wf-text: #ffffff;
    --wf-text-muted: rgba(255, 255, 255, 0.7);
    --wf-text-dim: rgba(255, 255, 255, 0.45);
    --wf-input-bg: rgba(255, 255, 255, 0.07);
    --wf-input-border: rgba(255, 255, 255, 0.15);
    --wf-tab-bg: rgba(255, 255, 255, 0.06);
    --wf-tab-hover: rgba(255, 255, 255, 0.1);
    --wf-close-bg: rgba(255, 255, 255, 0.08);
    --wf-close-hover: rgba(255, 255, 255, 0.16);
    --wf-glass-fx: blur(40px) saturate(1.6);
}

/* ── FAB Button ─────────────────────────────────────────────── */
.wf-fab {
    position: fixed;
    bottom: 88px; /* above mobile bottom nav (64 + 24) */
    right: 24px;
    z-index: 45;
    /* collapsed = perfect circle */
    width: 56px;
    height: 56px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #E05A2B, #c44d22);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 4px 24px rgba(224, 90, 43, 0.45);
    /* width transitions for the pill expand/collapse */
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                padding 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                gap 0.5s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
}

.wf-fab__icon {
    flex-shrink: 0;
}

/* Label text — hidden by default, slides in when expanded */
.wf-fab__label {
    display: inline-block;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: max-width 0.45s ease,
                opacity 0.35s ease;
}

/* Expanded state — pill with text */
.wf-fab--expanded {
    width: auto;
    padding: 0 18px 0 14px;
    gap: 9px;
}

.wf-fab--expanded .wf-fab__label {
    max-width: 220px;
    opacity: 1;
}

/* Collapsing back — faster fade-out for the label */
.wf-fab--collapsing .wf-fab__label {
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s ease,
                opacity 0.2s ease;
}

.wf-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 32px rgba(224, 90, 43, 0.6);
}

.wf-fab:active {
    transform: scale(0.97);
}

@media (min-width: 768px) {
    .wf-fab {
        bottom: 32px;
    }
}

/* ── Explore page: FAB hidden (map controls occupy same space) ── */
body:has(#explorePage) .wf-fab {
    display: none;
}
.wf-fab.wf-hidden { display: none; }


/* ── Modal Overlay ──────────────────────────────────────────── */
.wf-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--wf-overlay-bg);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.wf-overlay.wf-hidden {
    display: none;
}

/* ── Modal Card ─────────────────────────────────────────────── */
.wf-modal {
    background: var(--wf-modal-bg);
    backdrop-filter: var(--wf-glass-fx);
    border: 1px solid var(--wf-modal-border);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: wfModalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--wf-text);
}

@keyframes wfModalIn {
    from { opacity: 0; transform: scale(0.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.wf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.wf-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--wf-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wf-modal-close {
    background: var(--wf-close-bg);
    border: none;
    border-radius: 10px;
    color: var(--wf-text-muted);
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.wf-modal-close:hover {
    background: var(--wf-close-hover);
    color: var(--wf-text);
}

/* ── 2×2 Tab Grid ───────────────────────────────────────────── */
.wf-tab-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.wf-tab-btn {
    background: var(--wf-tab-bg);
    border: 1px solid var(--wf-modal-border);
    border-radius: 14px;
    color: var(--wf-text-muted);
    padding: 14px 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.18s ease;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wf-tab-btn:hover {
    background: var(--wf-tab-hover);
    color: var(--wf-text);
}

.wf-tab-btn.wf-active {
    background: rgba(224, 90, 43, 0.1);
    border-color: #E05A2B;
    color: #E05A2B;
}

.wf-tab-icon {
    font-size: 1.4rem;
    line-height: 1;
}

/* ── Input Sections ─────────────────────────────────────────── */
.wf-input-section {
    display: none;
}

.wf-input-section.wf-visible {
    display: block;
}

/* URL input */
.wf-url-wrapper {
    position: relative;
}

.wf-url-input {
    width: 100%;
    background: var(--wf-input-bg);
    border: 1px solid var(--wf-input-border);
    border-radius: 12px;
    color: var(--wf-text);
    padding: 12px 16px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.18s;
    box-sizing: border-box;
}

.wf-url-input:focus {
    border-color: #E05A2B;
}

.wf-url-input.wf-error {
    border-color: #f59e0b;
}

.wf-url-error {
    color: #f59e0b;
    font-size: 0.78rem;
    margin-top: 6px;
    display: none;
}

.wf-url-error.wf-visible {
    display: block;
}

/* Image upload */
.wf-image-drop {
    border: 2px dashed var(--wf-input-border);
    border-radius: 14px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
    position: relative;
}

.wf-image-drop:hover,
.wf-image-drop.wf-drag-over {
    border-color: #E05A2B;
    background: rgba(224, 90, 43, 0.06);
}

.wf-image-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.wf-image-drop-text {
    color: var(--wf-text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.wf-image-preview {
    display: none;
    margin-top: 12px;
    position: relative;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.wf-image-preview.wf-visible {
    display: block;
}

.wf-image-preview img {
    max-height: 140px;
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--wf-input-border);
}

.wf-image-clear {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #E05A2B;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Text / Screenshot textarea */
.wf-textarea {
    width: 100%;
    background: var(--wf-input-bg);
    border: 1px solid var(--wf-input-border);
    border-radius: 12px;
    color: var(--wf-text);
    padding: 12px 16px;
    font-size: 0.85rem;
    outline: none;
    resize: vertical;
    min-height: 110px;
    transition: border-color 0.18s;
    box-sizing: border-box;
    font-family: inherit;
}

.wf-textarea:focus {
    border-color: #E05A2B;
}

.wf-textarea::placeholder {
    color: var(--wf-text-dim);
}

/* ── Submit Button ──────────────────────────────────────────── */
.wf-submit-btn {
    width: 100%;
    background: #E05A2B;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 13px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wf-submit-btn:hover {
    background: #c44d22;
    box-shadow: 0 4px 20px rgba(224, 90, 43, 0.4);
}

.wf-submit-btn:active {
    transform: scale(0.98);
}

.wf-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Progress View ──────────────────────────────────────────── */
.wf-progress-view {
    display: none;
    text-align: center;
    padding: 24px 0;
}

.wf-progress-view.wf-visible {
    display: block;
}

.wf-progress-label {
    color: var(--wf-text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.wf-progress-track {
    height: 4px;
    background: var(--wf-close-bg);
    border-radius: 2px;
    overflow: hidden;
}

.wf-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #E05A2B, #f97316, #E05A2B);
    background-size: 200% 100%;
    border-radius: 2px;
    animation: wfProgressSlide 1.4s linear infinite;
    width: 40%;
}

@keyframes wfProgressSlide {
    0%   { transform: translateX(-150%); }
    100% { transform: translateX(350%); }
}

/* ── Preview Card ───────────────────────────────────────────── */
.wf-preview {
    display: none;
}

.wf-preview.wf-visible {
    display: block;
}

.wf-preview-back {
    background: none;
    border: none;
    color: var(--wf-text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.wf-preview-back:hover {
    color: var(--wf-text-muted);
}

/* Meta row */
.wf-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.wf-chip {
    background: var(--wf-tab-bg);
    border: 1px solid var(--wf-modal-border);
    border-radius: 99px;
    color: var(--wf-text-muted);
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.wf-duration-badge {
    background: rgba(224, 90, 43, 0.15);
    border: 1px solid rgba(224, 90, 43, 0.4);
    border-radius: 99px;
    color: #E05A2B;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Location list */
.wf-location-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.wf-location-item {
    background: var(--wf-tab-bg);
    border: 1px solid var(--wf-modal-border);
    border-radius: 14px;
    padding: 14px 16px;
}

.wf-location-item.wf-low-confidence {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.05);
}

.wf-location-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.wf-location-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wf-text);
    outline: none;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.15s;
    cursor: text;
    flex: 1;
}

.wf-location-name:hover,
.wf-location-name:focus {
    border-color: rgba(224, 90, 43, 0.5);
}

.wf-check-badge {
    display: none;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #f59e0b;
    border-radius: 99px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.wf-low-confidence .wf-check-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.wf-location-sub {
    color: var(--wf-text-dim);
    font-size: 0.78rem;
    margin-bottom: 6px;
}

.wf-location-desc {
    color: var(--wf-text-muted);
    font-size: 0.82rem;
}

.wf-category-select {
    background: var(--wf-input-bg);
    border: 1px solid var(--wf-input-border);
    border-radius: 8px;
    color: var(--wf-text-muted);
    font-size: 0.75rem;
    padding: 3px 8px;
    cursor: pointer;
    outline: none;
    margin-top: 8px;
}

.wf-category-select:focus {
    border-color: #E05A2B;
}

/* Low confidence global warning */
.wf-low-conf-banner {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: #f59e0b;
    margin-bottom: 14px;
    display: none;
}

.wf-low-conf-banner.wf-visible {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Duration editable */
.wf-duration-edit {
    background: var(--wf-input-bg);
    border: 1px dashed var(--wf-input-border);
    border-radius: 8px;
    color: var(--wf-text);
    font-size: 0.8rem;
    padding: 4px 10px;
    outline: none;
    width: auto;
    min-width: 80px;
    transition: border-color 0.15s;
}

.wf-duration-edit:focus {
    border-color: #E05A2B;
}

/* ── Action Buttons ─────────────────────────────────────────── */
.wf-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wf-action-btn {
    width: 100%;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wf-action-primary {
    background: #E05A2B;
    color: #fff;
}

.wf-action-primary:hover {
    background: #c44d22;
    box-shadow: 0 4px 20px rgba(224, 90, 43, 0.4);
}

.wf-action-secondary {
    background: var(--wf-close-bg);
    color: var(--wf-text-muted);
    border: 1px solid var(--wf-modal-border);
}

.wf-action-secondary:hover {
    background: var(--wf-close-hover);
    color: var(--wf-text);
}

/* ── Error View ─────────────────────────────────────────────── */
.wf-error-view {
    display: none;
    text-align: center;
    padding: 16px 0;
}

.wf-error-view.wf-visible {
    display: block;
}

.wf-error-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.wf-error-msg {
    color: var(--wf-text);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.wf-error-suggestion {
    color: var(--wf-text-muted);
    font-size: 0.8rem;
    margin-bottom: 16px;
}

.wf-error-retry {
    background: var(--wf-close-bg);
    border: 1px solid var(--wf-modal-border);
    border-radius: 10px;
    color: var(--wf-text-muted);
    padding: 8px 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.wf-error-retry:hover {
    background: var(--wf-close-hover);
}

/* ── Place thumbnail (injected by resolve enrichment) ───────────── */
.wf-place-thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
    margin: -14px -16px 10px -16px;
    width: calc(100% + 32px);
    display: block;
}

.wf-place-rating {
    margin-left: 8px;
    font-size: 0.75rem;
    color: var(--wf-text-muted);
    font-weight: 500;
}

/* ── Collection picker dialog ───────────────────────────────────── */
.wf-col-dialog {
    margin-bottom: 12px;
}

.wf-col-dialog.wf-hidden {
    display: none;
}

.wf-col-dialog-inner {
    background: var(--wf-input-bg);
    border: 1px solid var(--wf-input-border);
    border-radius: 14px;
    padding: 16px;
    animation: wfColFadeIn 0.18s ease;
}

@keyframes wfColFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wf-col-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.wf-col-dialog-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--wf-text);
    margin: 0;
}

.wf-col-x-btn {
    background: none;
    border: none;
    color: var(--wf-text-dim);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.wf-col-x-btn:hover { color: var(--wf-text); }

/* Existing collections list */
.wf-col-list {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 2px;
}

.wf-col-loading,
.wf-col-empty {
    color: var(--wf-text-dim);
    font-size: 0.8rem;
    text-align: center;
    padding: 10px 0;
    margin: 0;
}

.wf-col-row {
    width: 100%;
    background: none;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
    color: var(--wf-text);
}

.wf-col-row:hover {
    background: var(--wf-tab-hover);
    border-color: var(--wf-input-border);
}

.wf-col-row-emoji {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.wf-col-row-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.wf-col-row-count {
    font-size: 0.72rem;
    color: var(--wf-text-dim);
    flex-shrink: 0;
}

/* Divider */
.wf-col-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 10px;
    color: var(--wf-text-dim);
    font-size: 0.75rem;
}

.wf-col-divider::before,
.wf-col-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--wf-input-border);
}

/* Create new row */
.wf-col-new-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wf-col-name-input {
    flex: 1;
    background: var(--wf-modal-bg);
    border: 1px solid var(--wf-input-border);
    border-radius: 10px;
    color: var(--wf-text);
    padding: 9px 12px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    min-width: 0;
}

.wf-col-name-input:focus {
    border-color: #E05A2B;
}

.wf-col-name-input::placeholder {
    color: var(--wf-text-dim);
}

/* Buttons */
.wf-col-btn {
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.wf-col-btn-save {
    background: #E05A2B;
    color: #fff;
}

.wf-col-btn-save:hover {
    background: #c44d22;
}

.wf-col-btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
