/* ============================================
   Chic & Chill – Verfügbarkeits-Popup
   Premium Glassmorphism Design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---- Overlay ---- */
.ccap-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    /* Flexbox for robust modal centering on mobile */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ccap-overlay.ccap-visible {
    opacity: 1;
    pointer-events: all;
}

/* ---- Popup Container ---- */
.ccap-popup {
    position: relative;
    transform: scale(0.92);
    z-index: 999999;
    width: 100%;
    max-width: 520px;
    max-height: 90dvh; /* Dynamic viewport height to prevent iOS nav bar overlap */
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.12),
        0 8px 24px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.ccap-popup.ccap-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

/* Scrollbar */
.ccap-popup::-webkit-scrollbar { width: 4px; }
.ccap-popup::-webkit-scrollbar-track { background: transparent; }
.ccap-popup::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* ---- Header ---- */
.ccap-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 24px 24px 16px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 14px;
}
.ccap-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #f5f5f7;
    object-fit: contain;
    padding: 4px;
    flex-shrink: 0;
}
.ccap-header-text {
    flex: 1;
}
.ccap-header-title {
    font-size: 18px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.3px;
    line-height: 1.2;
    margin: 0;
}
.ccap-header-sub {
    font-size: 13px;
    font-weight: 500;
    color: #888;
    margin-top: 2px;
}
.ccap-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}
.ccap-close:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #333;
    transform: scale(1.05);
}

/* ---- Body ---- */
.ccap-body {
    padding: 8px 20px 24px;
}

/* ---- Salon Card ---- */
.ccap-salon {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    animation: ccap-cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ccap-salon:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.ccap-salon-header {
    padding: 16px 18px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ccap-salon-name {
    font-size: 16px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.2px;
}
.ccap-salon-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.ccap-badge-today {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    color: #2E7D32;
}
.ccap-badge-future {
    background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
    color: #E65100;
}
.ccap-badge-full {
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: #C62828;
}
.ccap-badge-closed {
    background: linear-gradient(135deg, #F5F5F5, #EEEEEE);
    color: #757575;
}

/* ---- Slots ---- */
.ccap-slots {
    padding: 0 18px 6px;
}
.ccap-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}
.ccap-slot:first-child {
    border-top: none;
}

.ccap-slot-time {
    font-size: 22px;
    font-weight: 900;
    color: #1a1a1a;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    min-width: 70px;
}

.ccap-slot-info {
    flex: 1;
    min-width: 0;
}
.ccap-slot-stylists {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ccap-slot-duration {
    font-size: 11px;
    color: #aaa;
    font-weight: 500;
    margin-top: 1px;
}

.ccap-slot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: ccap-pulse 2s ease-in-out infinite;
}
.ccap-dot-green { background: #34C759; } /* Apple Green */
.ccap-dot-orange { background: #FF9500; } /* Apple Orange */
.ccap-dot-gray { background: #8E8E93; animation: none; }

/* ---- Empty / Closed State ---- */
.ccap-empty {
    padding: 20px 18px;
    text-align: center;
}
.ccap-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}
.ccap-empty-text {
    font-size: 14px;
    font-weight: 600;
    color: #555;
}
.ccap-empty-sub {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* ---- Booking CTA ---- */
.ccap-booking-cta {
    display: block;
    margin: 0 18px 14px;
    padding: 14px;
    border-radius: 999px; /* Pill */
    text-align: center;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    transition: all 0.3s ease;
    letter-spacing: -0.2px;
}
.ccap-booking-cta:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

/* ---- Loading State ---- */
.ccap-loading {
    padding: 40px 20px;
    text-align: center;
}
.ccap-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0,0,0,0.08);
    border-top-color: var(--ccap-brand, #FF622B);
    border-radius: 50%;
    animation: ccap-spin 0.8s linear infinite;
    margin: 0 auto 14px;
}
.ccap-loading-text {
    font-size: 14px;
    color: #888;
    font-weight: 500;
}

/* ---- Footer ---- */
.ccap-footer {
    padding: 12px 20px 18px;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}
.ccap-footer-text {
    font-size: 11px;
    color: #bbb;
    font-weight: 500;
}
.ccap-footer-text span {
    font-weight: 700;
}

/* ---- Animations ---- */
@keyframes ccap-spin {
    to { transform: rotate(360deg); }
}
@keyframes ccap-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
@keyframes ccap-cardIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .ccap-popup {
        border-radius: 20px;
    }
    .ccap-header {
        padding: 16px 16px 12px;
    }
    .ccap-header-title {
        font-size: 15px;
    }
    .ccap-header-sub {
        font-size: 12px;
    }
    .ccap-logo {
        width: 40px;
        height: 40px;
    }
    .ccap-body {
        padding: 8px 16px 20px;
    }
    .ccap-salon-header {
        padding: 14px 16px 10px;
    }
    .ccap-salon-name {
        font-size: 15px;
    }
    .ccap-slots {
        padding: 0 16px 4px;
    }
    .ccap-slot-time {
        font-size: 18px;
        min-width: 60px;
    }
    .ccap-booking-cta {
        margin: 0 16px 12px;
        padding: 12px;
        font-size: 14px;
    }
}

/* ---- Dark mode support ---- */
@media (prefers-color-scheme: dark) {
    .ccap-popup {
        background: rgba(30, 30, 32, 0.85);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow:
            0 30px 60px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    .ccap-header {
        background: rgba(30, 30, 32, 0.7);
        border-bottom-color: rgba(255, 255, 255, 0.06);
    }
    .ccap-header-title { color: #f5f5f7; }
    .ccap-header-sub { color: #8e8e93; }
    .ccap-close { background: rgba(255,255,255,0.1); color: #aaa; }
    .ccap-close:hover { background: rgba(255,255,255,0.18); color: #ddd; }
    .ccap-salon {
        background: rgba(44, 44, 46, 0.9);
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    .ccap-salon-name { color: #f5f5f7; }
    .ccap-slot-time { color: #f5f5f7; }
    .ccap-slot-stylists { color: #8e8e93; }
    .ccap-slot-duration { color: #636366; }
    .ccap-slot { border-top-color: rgba(255,255,255,0.04); }
    .ccap-empty-text { color: #ccc; }
    .ccap-footer { border-top-color: rgba(255,255,255,0.04); }
    .ccap-logo { background: #2c2c2e; }
}

/* ---- Shortcode Trigger ---- */
.ccap-trigger-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    outline: none;
    transition: transform 0.2s ease;
}
.ccap-trigger-btn:hover {
    transform: scale(1.03);
}
.ccap-trigger-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', -apple-system, sans-serif;
    letter-spacing: 0.1px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}
.ccap-trigger-badge.ccap-badge-green {
    background: linear-gradient(135deg, #34C759, #28A745);
}
.ccap-trigger-badge.ccap-badge-yellow {
    background: linear-gradient(135deg, #FFCC00, #F39C12);
    color: #1a1a1a;
}
.ccap-trigger-badge.ccap-badge-red {
    background: linear-gradient(135deg, #FF3B30, #C0392B);
}
.ccap-trigger-badge.ccap-badge-gray {
    background: linear-gradient(135deg, #8E8E93, #636366);
}
