/* Peak Visits – Frontend Styles */
.pv-wrap {
    font-family: inherit;
    max-width: 680px;
    margin: 1.5rem 0;
}
.pv-peak-header {
    margin-bottom: 1.25rem;
}
.pv-peak-name {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0 0 4px;
}
.pv-peak-elevation,
.pv-peak-location {
    display: inline-block;
    font-size: 0.85em;
    color: #666;
    margin-right: 12px;
}
.pv-peak-elevation::before { content: "▲ "; }
.pv-peak-location::before  { content: "📍 "; }
.pv-peak-desc {
    margin: 8px 0 4px;
    color: #555;
    font-size: 0.95em;
}
.pv-visit-count {
    font-size: 0.85em;
    color: #888;
    margin: 6px 0 0;
}

/* Toggle button */
.pv-toggle-form {
    display: inline-block;
    padding: 8px 18px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: background 0.15s;
}
.pv-toggle-form:hover { background: #135e96; }

/* Form */
.pv-form {
    background: #f8f9fa;
    border: 1px solid #dde1e4;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.pv-field {
    margin-bottom: 1rem;
}
.pv-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.9em;
}
.pv-field input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}
.pv-field input[type="text"]:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
}

/* Photo options */
.pv-photo-tabs {
    display: flex;
    gap: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    width: fit-content;
    margin-bottom: 10px;
}
.pv-photo-tab {
    padding: 6px 16px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 0.875em;
    color: #555;
    transition: all 0.15s;
}
.pv-photo-tab + .pv-photo-tab { border-left: 1px solid #ccc; }
.pv-photo-tab.active { background: #2271b1; color: #fff; }

/* File upload */
.pv-file-input { display: none; }
.pv-file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px dashed #aaa;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    font-size: 0.9em;
    transition: border-color 0.15s, background 0.15s;
}
.pv-file-label:hover { border-color: #2271b1; background: #f0f5fb; color: #2271b1; }
.pv-file-icon { font-size: 1.2em; }

/* Preview */
.pv-preview-wrap { position: relative; display: inline-block; margin-top: 8px; }
.pv-preview-img { max-width: 180px; max-height: 160px; border-radius: 4px; object-fit: cover; display: block; }
.pv-remove-photo {
    position: absolute;
    top: 4px; right: 4px;
    background: rgba(0,0,0,.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px; height: 22px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
}

/* Camera */
.pv-camera-video {
    width: 100%;
    max-width: 320px;
    border-radius: 4px;
    display: block;
    background: #000;
}
.pv-camera-controls { margin: 8px 0; display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.pv-btn-primary, .pv-btn-secondary, .pv-btn-cancel {
    padding: 8px 18px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.15s;
}
.pv-btn-primary { background: #2271b1; color: #fff; border-color: #2271b1; }
.pv-btn-primary:hover { background: #135e96; }
.pv-btn-primary:disabled { background: #a0c0df; cursor: default; }
.pv-btn-secondary { background: #fff; color: #333; border-color: #ccc; }
.pv-btn-secondary:hover { border-color: #2271b1; color: #2271b1; }
.pv-btn-cancel { background: transparent; color: #777; border-color: transparent; }
.pv-btn-cancel:hover { color: #333; }

.pv-form-actions { display: flex; gap: 8px; align-items: center; margin-top: 1.25rem; }
.pv-field-check { display: flex; align-items: center; }
.pv-checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9em; }
.pv-checkbox-label input[type="checkbox"] { width: 16px; height: 16px; }
.pv-field-note { font-size: 0.8em; color: #888; margin: -0.5rem 0 0.5rem; }

/* Messages */
.pv-messages { margin-top: 0.75rem; font-size: 0.9em; }
.pv-messages.pv-success { color: #155724; background: #d4edda; border: 1px solid #c3e6cb; border-radius: 4px; padding: 8px 12px; }
.pv-messages.pv-error   { color: #721c24; background: #f8d7da; border: 1px solid #f5c6cb; border-radius: 4px; padding: 8px 12px; }

/* Visits list */
.pv-visits-list { margin-top: 1rem; }
.pv-no-visits { color: #888; font-style: italic; }
.pv-visit-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.pv-visit-card:last-child { border-bottom: none; }
.pv-visit-photo {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
}
.pv-visit-photo img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* No-photo icon placeholder */
.pv-no-photo-icon {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    background: #f0f0ec;
    border: 1px solid #e0e0da;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    box-sizing: border-box;
}
.pv-no-photo-icon svg {
    display: block;
    width: 44px;
    height: 44px;
}

/* Clickable photo trigger */
.pv-lightbox-trigger {
    position: relative;
    display: block;
    border: none;
    padding: 0;
    background: none;
    cursor: zoom-in;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.pv-lightbox-trigger img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    transition: filter 0.2s;
}
.pv-lightbox-trigger:hover img { filter: brightness(0.75); }
.pv-photo-zoom {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}
.pv-lightbox-trigger:hover .pv-photo-zoom { opacity: 1; }

/* ── Lightbox ───────────────────────────────────────────────────── */
.pv-noscroll,
.pv-noscroll body { overflow: hidden !important; }

.pv-lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    /* display toggled by JS between none and flex */
    align-items: center;
    justify-content: center;
    /* iOS safe areas */
    padding: env(safe-area-inset-top, 12px) env(safe-area-inset-right, 12px) env(safe-area-inset-bottom, 12px) env(safe-area-inset-left, 12px);
    box-sizing: border-box;
    /* Ensure it sits above everything including fixed WP admin bar */
    -webkit-overflow-scrolling: touch;
}
.pv-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.92);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.pv-lightbox-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: min(95vw, 900px);
    padding: 0 12px;
    animation: pvLbIn 0.18s ease;
}
@keyframes pvLbIn {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}
.pv-lightbox-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 60px;
}
.pv-lightbox-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 78vh;
    max-height: 78dvh;
    border-radius: 6px;
    object-fit: contain;
    box-shadow: 0 4px 32px rgba(0,0,0,.5);
    -webkit-user-drag: none;
}
.pv-lightbox-spinner {
    position: absolute;
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pvSpin 0.7s linear infinite;
    display: none;
}
.pv-lightbox-spinner.active { display: block; }
@keyframes pvSpin { to { transform: rotate(360deg); } }

.pv-lightbox-caption {
    margin-top: 12px;
    color: rgba(255,255,255,.7);
    font-size: 0.85em;
    text-align: center;
    max-width: 100%;
    padding: 0 8px;
    word-break: break-word;
}
.pv-lightbox-close {
    position: absolute;
    top: -14px;
    right: 0;
    width: 40px; height: 40px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.pv-lightbox-close:hover,
.pv-lightbox-close:active { background: rgba(255,255,255,.3); }
@media (max-width: 480px) {
    .pv-lightbox-inner { padding: 0 6px; }
    .pv-lightbox-close { top: -46px; right: 6px; width: 44px; height: 44px; }
    .pv-lightbox-img { max-height: 72vh; max-height: 72dvh; border-radius: 4px; }
}
.pv-visit-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pv-visit-name { font-size: 1em; }
.pv-visit-date { font-size: 0.82em; color: #888; }
.pv-error { color: #a00; font-style: italic; }

/* New visit card animation */
.pv-visit-card.pv-new {
    animation: pvSlideIn 0.4s ease;
}
@keyframes pvSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Load more button */
.pv-load-more-wrap {
    text-align: center;
    padding: 1rem 0 0.5rem;
}
.pv-load-more {
    padding: 9px 28px;
    font-size: 0.9em;
    font-weight: 500;
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.pv-load-more:hover {
    border-color: #2271b1;
    color: #2271b1;
}
.pv-load-more:disabled {
    color: #999;
    border-color: #ddd;
    cursor: default;
}

/* Geo check status */
.pv-geo-status {
    margin-bottom: 0.75rem;
    font-size: 0.9em;
}
.pv-geo-checking {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    color: #666;
}
.pv-geo-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: pv-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes pv-spin {
    to { transform: rotate(360deg); }
}
.pv-geo-too-far {
    display: block;
    padding: 0.6em 0.9em;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #6d4c00;
    font-weight: 500;
}
.pv-geo-error {
    display: block;
    padding: 0.6em 0.9em;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    color: #991b1b;
}
