/* Card Switcher — vertical sidebar on the right side of modal */

/* Override modal layout to row when switcher is active */
.cc-modal-content.has-card-switcher {
    flex-direction: row !important;
}

/* Wrapper for original modal content */
.cc-modal-inner {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Vertical sidebar strip */
.cc-card-switcher-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    overflow-y: auto;
    overflow-x: hidden;
    direction: rtl;
    width: 120px;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.cc-card-switcher-strip::-webkit-scrollbar {
    width: 4px;
}

.cc-card-switcher-strip::-webkit-scrollbar-track {
    background: transparent;
}

.cc-card-switcher-strip::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.cc-card-switcher-label {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.cc-card-switcher-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.cc-card-type-thumb {
    position: relative;
    width: 90px;
    height: 127px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    background: #f1f5f9;
}

.cc-card-type-thumb:hover {
    border-color: #94a3b8;
    transform: scale(1.05);
}

.cc-card-type-thumb.active {
    border-color: #0b818a;
    box-shadow: 0 0 0 2px rgba(11, 129, 138, 0.25);
}

.cc-card-type-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cc-card-type-thumb .cc-card-type-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 8px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    text-align: center;
    padding: 2px 3px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading state */
.cc-card-switcher-strip.is-loading {
    justify-content: center;
}

.cc-card-switcher-strip.is-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #0b818a;
    border-radius: 50%;
    animation: cc-cs-spin 0.6s linear infinite;
}

@keyframes cc-cs-spin {
    to { transform: rotate(360deg); }
}

/* Disabled during switch */
.cc-card-type-thumb.is-switching {
    opacity: 0.5;
    pointer-events: none;
}

/* Mobile — bottom sheet instead of sidebar */
@media (max-width: 768px) {
    /* Hide desktop sidebar on mobile */
    .cc-card-switcher-strip { display: none !important; }
    .cc-modal-content.has-card-switcher { flex-direction: column !important; }

    /* Trigger button — replaces preview badge */
    .cc-card-switcher-mobile-btn {
        display: flex; align-items: center; justify-content: center; gap: 6px;
        margin: 0 auto 6px;
        background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 22px;
        padding: 8px 18px; font-size: 14px; font-weight: 600;
        color: #0b818a; cursor: pointer; direction: rtl;
    }
    .cc-card-switcher-mobile-btn svg { flex-shrink: 0; }

    /* Push the card preview down slightly */
    .cc-card-preview { margin-top: 4px; }

    /* Overlay */
    .cc-card-switcher-overlay {
        display: none; position: fixed; inset: 0;
        background: rgba(0,0,0,0.4); z-index: 10000;
    }
    .cc-card-switcher-overlay.visible { display: block; }

    /* Bottom sheet */
    .cc-card-switcher-sheet {
        position: fixed; bottom: 0; left: 0; right: 0;
        background: #fff; border-radius: 16px 16px 0 0;
        z-index: 10001; max-height: 65vh;
        transform: translateY(100%); transition: transform 0.3s ease;
        display: flex; flex-direction: column;
        direction: rtl;
    }
    .cc-card-switcher-sheet.visible { transform: translateY(0); }

    /* Sheet header */
    .cc-sheet-header {
        display: flex; justify-content: space-between; align-items: center;
        padding: 16px 20px; border-bottom: 1px solid #e2e8f0;
    }
    .cc-sheet-title { font-size: 16px; font-weight: 700; color: #1e293b; }
    .cc-sheet-close {
        background: none; border: none; font-size: 24px;
        color: #64748b; cursor: pointer; padding: 0 4px;
    }

    /* Card grid */
    .cc-sheet-grid {
        display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
        padding: 16px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch;
    }
    .cc-sheet-card {
        display: flex; flex-direction: column; align-items: center; gap: 6px;
        padding: 8px; border: 2px solid #e2e8f0; border-radius: 10px;
        cursor: pointer; transition: all 0.2s;
    }
    .cc-sheet-card.active {
        border-color: #0b818a;
        background: rgba(11,129,138,0.06);
        box-shadow: 0 0 0 2px rgba(11,129,138,0.2);
    }
    .cc-sheet-card img {
        width: 100%; aspect-ratio: 5/7; object-fit: cover; border-radius: 6px;
    }
    .cc-sheet-card-name {
        font-size: 11px; font-weight: 600; color: #334155;
        text-align: center; line-height: 1.2;
        display: -webkit-box; -webkit-line-clamp: 2;
        -webkit-box-orient: vertical; overflow: hidden;
    }
}
