/* ============================================
   CLC Selector — Base Layout v2.0
   Shared structure · Animations · Feedback · Mobile
   ============================================ */

/* --- Reset & Structure --- */
.clc-trigger-wrap {
    display: inline-flex;
    align-items: center;
}

.clc-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.clc-sidebar-header { flex-shrink: 0; }
.clc-search-wrap { flex-shrink: 0; }
.clc-search { box-sizing: border-box; }

.clc-sections {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.clc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.clc-item { margin: 0; }
.clc-item.clc-hidden { display: none; }

.clc-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clc-item .clc-flag {
    object-fit: cover;
    flex-shrink: 0;
}

.clc-currency-sign { flex-shrink: 0; }
.clc-check { flex-shrink: 0; margin-left: auto; }

/* --- Language Code Badge --- */
.clc-lang-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background 0.25s ease, color 0.25s ease;
}

/* ============================================
   Click Feedback — Ripple + Press
   ============================================ */
.clc-item-link {
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Ripple effect container */
.clc-item-link::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: radial-gradient(circle at var(--clc-ripple-x, 50%) var(--clc-ripple-y, 50%),
        rgba(4, 105, 126, 0.12) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.4s ease, transform 0.5s ease;
    pointer-events: none;
}

.clc-item-link.clc-ripple::after {
    opacity: 1;
    transform: scale(2.5);
}

/* Pressed / clicked */
.clc-item-link.clc-pressed {
    transform: scale(0.975);
}

/* Disable pointer events during loading */
.clc-item-link.clc-loading {
    pointer-events: none;
    opacity: 0.5;
}

/* Loading overlay removed — clean page transitions */

/* ============================================
   Stagger animation for items
   ============================================ */
.clc-sidebar.clc-open .clc-item {
    animation: clc-item-in 0.35s ease both;
}

.clc-sidebar.clc-open .clc-item:nth-child(1) { animation-delay: 0.05s; }
.clc-sidebar.clc-open .clc-item:nth-child(2) { animation-delay: 0.08s; }
.clc-sidebar.clc-open .clc-item:nth-child(3) { animation-delay: 0.11s; }
.clc-sidebar.clc-open .clc-item:nth-child(4) { animation-delay: 0.14s; }
.clc-sidebar.clc-open .clc-item:nth-child(5) { animation-delay: 0.17s; }
.clc-sidebar.clc-open .clc-item:nth-child(6) { animation-delay: 0.20s; }
.clc-sidebar.clc-open .clc-item:nth-child(7) { animation-delay: 0.23s; }
.clc-sidebar.clc-open .clc-item:nth-child(8) { animation-delay: 0.26s; }
.clc-sidebar.clc-open .clc-item:nth-child(n+9) { animation-delay: 0.28s; }

@keyframes clc-item-in {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   Section collapse animation
   ============================================ */
.clc-section {
    transition: opacity 0.2s ease;
}

/* ============================================
   Checkmark animation
   ============================================ */
.clc-check path {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: clc-check-draw 0.4s ease forwards;
}

.clc-active .clc-check path {
    stroke-dashoffset: 0;
}

@keyframes clc-check-draw {
    to { stroke-dashoffset: 0; }
}

/* ============================================
   Mobile Optimizations
   ============================================ */

/* Body lock when sidebar open — prevent background scroll */
body.clc-body-locked {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    touch-action: none;
}

/* Tablet — touch-friendly targets */
@media (max-width: 768px) {
    .clc-item-link {
        min-height: 48px;
    }

    .clc-close-btn {
        width: 44px !important;
        height: 44px !important;
    }

    /* Clean, compact trigger on mobile */
    .clc-trigger-btn {
        min-height: 40px;
        padding: 8px 12px !important;
        gap: 6px !important;
        font-size: 13px;
    }

    .clc-trigger-flag {
        width: 18px !important;
        height: 12px !important;
    }

    .clc-trigger-label {
        font-size: 12px;
    }

    .clc-chevron {
        width: 8px;
        height: 5px;
    }
}

/* Phone — full-width sidebar, larger targets */
@media (max-width: 480px) {
    .clc-sidebar {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    .clc-sidebar-header {
        padding: 16px 20px 12px !important;
    }

    .clc-search-wrap {
        padding: 8px 20px 12px !important;
    }

    /* iOS Auto-Zoom Prevention: font-size must be >= 16px */
    .clc-search {
        font-size: 16px !important;
    }

    .clc-section {
        padding: 8px 16px !important;
    }

    .clc-section-title {
        font-size: 11px !important;
    }

    .clc-item-link {
        padding: 13px 16px !important;
        min-height: 48px;
        font-size: 15px !important;
    }

    .clc-loading-text {
        font-size: 15px;
    }
}

/* Very small phones (iPhone SE, Galaxy S) */
@media (max-width: 360px) {
    .clc-item-link {
        padding: 12px 12px !important;
        gap: 10px !important;
    }

    .clc-sidebar-header {
        padding: 14px 16px 10px !important;
    }
}

/* Landscape mode on mobile — constrain sidebar height */
@media (max-height: 500px) and (orientation: landscape) {
    .clc-sidebar-header {
        padding: 10px 20px 8px !important;
    }

    .clc-search-wrap {
        padding: 4px 20px 8px !important;
    }

    .clc-item-link {
        min-height: 40px !important;
        padding: 8px 16px !important;
    }

    .clc-section {
        padding: 4px 16px !important;
    }

    .clc-section-title {
        padding-top: 4px !important;
        padding-bottom: 2px !important;
    }
}

/* Swipe-to-close: sidebar transition while dragging */
.clc-sidebar.clc-dragging {
    transition: none !important;
}

/* Safe area insets for notched phones (iPhone X+) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .clc-sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }

    @media (max-width: 480px) {
        .clc-sidebar-header {
            padding-top: max(16px, env(safe-area-inset-top)) !important;
        }
    }
}

/* Reduced motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
    .clc-spinner { animation-duration: 2s; }
    .clc-item-link.clc-pressed { transform: none; }
    .clc-item-link::after { display: none; }
    .clc-sidebar.clc-open .clc-item { animation: none; }
    .clc-sidebar, .clc-overlay { transition-duration: 0.01ms !important; }
    .clc-progress-fill { animation: none; width: 50%; }
}

/* ============================================
   Hide iubenda + chat when sidebar open
   Desktop: only floating buttons (not full banners)
   Mobile: everything
   ============================================ */
body.clc-body-locked .iubenda-tp-btn,
body.clc-body-locked .iubenda-cs-preferences-link,
body.clc-body-locked [class*="iubenda-tp-btn"],
body.clc-body-locked #brevo-conversations,
body.clc-body-locked [id^="brevo"],
body.clc-body-locked #sendinblue-conversations-widget {
    display: none !important;
}

@media (max-width: 768px) {
    body.clc-body-locked [class*="iubenda"],
    body.clc-body-locked [id^="iubenda"] {
        display: none !important;
    }
}

/* ============================================
   Checkout: EUR conversion notice
   ============================================ */
.clc-checkout-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    margin: 15px 0;
    background: #eaf6f8;
    border: 1px solid #b3dce3;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #04697e;
    animation: clc-item-in 0.35s ease both;
}

.clc-checkout-notice svg {
    stroke: #04697e;
    margin-top: 1px;
}

@media (max-width: 480px) {
    .clc-checkout-notice {
        font-size: 12px;
        padding: 12px 14px;
    }
}

/* Print — hide everything */
@media print {
    .clc-trigger-wrap, .clc-sidebar, .clc-overlay, .clc-loading-overlay {
        display: none !important;
    }
}
