﻿/* ============================================================================
   Vehicly Opgeslagen Page — mobile-first, app-style list
   ============================================================================ */

/* HTML5 [hidden] attribute must always win over display: flex/grid we set below */
.opgeslagen-page [hidden] { display: none !important; }

.opgeslagen-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 18px 14px 32px;
    color: var(--vh-text, #1c1917);
    font-family: var(--vh-font-body, Inter, sans-serif);
}

/* Header */
.opgeslagen-header {
    padding: 4px 4px 14px;
}
.opgeslagen-title {
    margin: 0;
    font-family: var(--vh-font-display, Inter, sans-serif);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.01em;
}
.opgeslagen-count {
    margin: 4px 0 0;
    font-size: .85rem;
    color: var(--vh-text-secondary, #57534e);
}

/* Filter chips */
.opgeslagen-filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 4px 14px;
    margin: 0 -4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.opgeslagen-filters::-webkit-scrollbar { display: none; }
.opg-chip {
    flex-shrink: 0;
    appearance: none;
    border: 1px solid var(--vh-border, #e7e5e4);
    background: var(--vh-surface, #fff);
    color: var(--vh-text-secondary, #57534e);
    font-family: inherit;
    font-size: .85rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 100px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, transform .08s ease-out;
    -webkit-tap-highlight-color: transparent;
}
.opg-chip:active { transform: scale(0.97); }
.opg-chip.is-active {
    background: var(--vh-primary, #F2C94C);
    border-color: var(--vh-primary, #F2C94C);
    color: #1a1a1a;
    font-weight: 600;
}

/* Skeleton state */
.opgeslagen-skeletons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.opg-skel {
    height: 88px;
    border-radius: 14px;
    background: var(--vh-surface, #fff);
    border: 1px solid var(--vh-border, #e7e5e4);
    position: relative;
    overflow: hidden;
}
.opg-skel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.05) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: opg-shimmer 1.4s linear infinite;
}
@keyframes opg-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* List */
.opgeslagen-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Item */
.opg-item {
    position: relative;
    border-radius: 14px;
    background: var(--vh-surface, #fff);
    border: 1px solid var(--vh-border, #e7e5e4);
    overflow: hidden;
    transition:
        opacity .28s var(--ease, cubic-bezier(.4,0,.2,1)),
        transform .32s var(--ease-out-expo, cubic-bezier(.22,1,.36,1)),
        max-height .32s var(--ease, cubic-bezier(.4,0,.2,1)) .05s,
        margin .32s var(--ease, cubic-bezier(.4,0,.2,1)) .05s,
        padding .32s var(--ease, cubic-bezier(.4,0,.2,1)) .05s,
        border .25s ease .05s;
    will-change: transform, opacity, max-height;
}
/* Click-delete: slide-right + collapse (feels like 'throwing away').
   Was slide-LEFT which is the swipe-undo direction and felt wrong. */
.opg-item.is-removing {
    opacity: 0;
    transform: translateX(30%) scale(0.96);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    border-color: transparent;
    pointer-events: none;
}
/* Reveal-delete background visible only when swiping */
.opg-item::after {
    content: "Verwijderen";
    position: absolute;
    top: 0; bottom: 0; right: 0;
    width: 120px;
    background: #EF4444;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 600;
    z-index: 0;
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}
.opg-item.is-swiping::after { opacity: 1; }

.opg-item-link {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--vh-surface, #fff);
    text-decoration: none;
    color: inherit;
    transition: transform .22s cubic-bezier(.2,.7,.3,1), background .15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
}
.opg-item-link:active { background: var(--vh-bg, #faf9f7); }

.opg-item-ring {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
}
.opg-item-info {
    flex: 1;
    min-width: 0;
}
.opg-item-title {
    font-size: .98rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--vh-text, #1c1917);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.opg-item-sub {
    margin-top: 2px;
    font-size: .8rem;
    color: var(--vh-text-secondary, #57534e);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.opg-item-meta {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.opg-item-verdict {
    font-size: .72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(0,0,0,.04);
    color: var(--vh-text-secondary, #57534e);
    line-height: 1.5;
}
.opg-item-verdict--great { background: rgba(34,197,94,.12);  color: #16a34a; }
.opg-item-verdict--good  { background: rgba(132,204,22,.12); color: #65a30d; }
.opg-item-verdict--ok    { background: rgba(245,158,11,.13); color: #c2700a; }
.opg-item-verdict--bad   { background: rgba(239,68,68,.12);  color: #dc2626; }
.opg-item-date {
    font-size: .72rem;
    color: var(--vh-text-tertiary, #6e6963);
}
.opg-item-chevron {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--vh-text-tertiary, #6e6963);
}

/* Inline delete button (visible on desktop, hidden on mobile in favour of swipe) */
.opg-item-del {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--vh-text-tertiary, #6e6963);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.opg-item:hover .opg-item-del,
.opg-item:focus-within .opg-item-del { opacity: 1; }
.opg-item-del:hover,
.opg-item-del:focus-visible {
    background: rgba(239,68,68,.12);
    color: #dc2626;
}

/* Hide hover-only delete button on mobile (swipe-to-delete preferred) */
html[data-vehicly-mobile="1"] .opg-item-del { display: none; }

/* Empty state / login wall — designed first-time-experience moment.
   Icon sits in a soft honey-tinted circle to break the "lost in white"
   feeling. Title bigger and more confident, body has breathing room,
   CTA gets a subtle glow that pulses-once on reveal. */
.opgeslagen-empty,
.opgeslagen-loginwall {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 88px 24px 56px;
    color: var(--vh-text-secondary, #57534e);
    animation: opgEmptyFade .55s var(--ease-out-expo, cubic-bezier(.22,1,.36,1)) both;
}
@keyframes opgEmptyFade {
    from { opacity: 0; transform: translateY(8px) }
    to   { opacity: 1; transform: translateY(0) }
}
.opgeslagen-empty > svg,
.opgeslagen-loginwall > svg {
    width: 56px;
    height: 56px;
    opacity: 1;
    margin-bottom: 22px;
    color: var(--vh-primary-dark, #C49A22);
    padding: 16px;
    box-sizing: content-box;
    border-radius: 50%;
    background: var(--vh-primary-soft, rgba(242,201,76,.08));
    border: 1px solid rgba(242,201,76,.18);
    box-shadow:
        0 0 0 6px rgba(242,201,76,.04),
        var(--shadow-sm, 0 1px 3px rgba(178,150,90,.06));
}
/* Ensure inline SVGs inside the CTA keep their explicit size + don't
   inherit the icon-circle styling above */
.opgeslagen-empty-cta svg {
    width: 18px;
    height: 18px;
    opacity: 1;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: inherit;
}
.opgeslagen-empty-title {
    margin: 0 0 10px;
    font-family: var(--vh-font-display, Inter, sans-serif);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--vh-text, #1c1917);
    line-height: 1.2;
}
.opgeslagen-empty-body {
    margin: 0 0 28px;
    font-size: .95rem;
    line-height: 1.6;
    max-width: 380px;
    color: var(--vh-text-secondary, #57534e);
}
.opgeslagen-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 24px;
    background: var(--vh-primary, #F2C94C);
    color: var(--vh-on-primary, #1a1a1a);
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow:
        0 6px 18px -2px rgba(242,201,76,.45),
        0 0 0 1px rgba(0,0,0,.04) inset;
    transition:
        transform var(--duration-fast, .15s) var(--ease),
        box-shadow var(--duration-fast, .15s) var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.opgeslagen-empty-cta:hover {
    transform: translateY(-1px);
    box-shadow:
        0 10px 24px -4px rgba(242,201,76,.5),
        0 0 0 1px rgba(0,0,0,.04) inset;
}
.opgeslagen-empty-cta:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 6px rgba(242,201,76,.3);
}

/* Optional secondary link directly below the primary CTA */
.opgeslagen-empty-link {
    display: inline-block;
    margin-top: 14px;
    font-size: .8rem;
    color: var(--vh-text-tertiary, #6e6963);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
    transition: color var(--duration-fast, .15s) var(--ease), border-color var(--duration-fast, .15s) var(--ease);
}
.opgeslagen-empty-link:hover,
.opgeslagen-empty-link:focus-visible {
    color: var(--vh-text, #1c1917);
    border-color: rgba(0,0,0,.15);
}

/* No-match (filter empty) */
.opgeslagen-nomatch {
    text-align: center;
    padding: 32px 20px;
    color: var(--vh-text-secondary, #57534e);
}
.opgeslagen-nomatch p { margin: 0 0 12px; }
.opg-link-btn {
    background: transparent;
    border: none;
    color: var(--vh-primary-dark, #C49A22);
    font-family: inherit;
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}
.opg-link-btn:active { background: var(--vh-primary-soft, rgba(242,201,76,.1)); }

/* ============================================================================
   Mobile-specific tweaks (mobile-shell mode)
   ============================================================================ */
html[data-vehicly-mobile="1"] .opgeslagen-page {
    padding: 8px 12px 28px;
}
html[data-vehicly-mobile="1"] .opgeslagen-title {
    font-size: 1.35rem;
}
html[data-vehicly-mobile="1"] .opgeslagen-filters {
    /* Hide native scrollbar; rely on flex+scroll-snap feel */
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
}
html[data-vehicly-mobile="1"] .opg-item {
    border-radius: 16px;
}
html[data-vehicly-mobile="1"] .opg-item-link {
    padding: 14px 14px;
    gap: 14px;
}
html[data-vehicly-mobile="1"] .opg-item-title {
    font-size: 1rem;
}

/* Desktop: hide the chevron (no native page-transition feel) */
html:not([data-vehicly-mobile="1"]) .opg-item-chevron { display: none; }

/* Print: only show titles, no chevrons / buttons */
@media print {
    .opg-chip, .opg-item-del, .opg-item-chevron, .opgeslagen-empty-cta { display: none !important; }
    .opg-item::after { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .opg-item, .opg-item-link, .opg-skel::after, .opgeslagen-empty-cta {
        transition: none !important;
        animation: none !important;
    }
}
