/**
 * Spread Preview / Custom Dropdown Styles
 * Enhances spread selection with visual previews and descriptions
 */

/* ===== SPREAD SELECTOR WRAPPER ===== */
.spread-selector-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.spread-selector-wrapper label {
    font-weight: 600;
    color: #e8e8e8;
    font-size: 0.95rem;
    display: block;
    text-align: left;
}

/* ===== CUSTOM DROPDOWN ===== */
.spread-dropdown {
    position: relative;
    width: 100%;
}

/* Toggle Button */
.spread-dropdown-toggle {
    width: 100%;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #1f1f3a 0%, #2a2a4a 100%);
    border: 2px solid #b0a3d7;
    border-radius: 8px;
    color: #e8e8e8;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    text-align: left;
}

.spread-dropdown-toggle:hover {
    background: linear-gradient(135deg, #2a2a4a 0%, #3a3a5a 100%);
    border-color: #d4c5e2;
    box-shadow: 0 0 20px rgba(176, 163, 215, 0.3);
}

.spread-dropdown-toggle:focus {
    outline: 2px solid #b0a3d7;
    outline-offset: 2px;
}

.spread-dropdown-toggle::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.spread-dropdown.open .spread-dropdown-toggle::after {
    transform: rotate(180deg);
}

/* Options List */
.spread-options-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    background: #0a0a14;
    border: 2px solid #b0a3d7;
    border-top: none;
    border-radius: 0 0 8px 8px;
    transition: max-height 0.3s ease;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.spread-dropdown.open .spread-options-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Individual Option Item */
.spread-option-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #2a2a4a;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #0a0a14;
}

.spread-option-item:last-child {
    border-bottom: none;
}

.spread-option-item:hover {
    background: #1a1a2e;
    padding-left: 1.5rem;
}

.spread-option-item[aria-selected="true"],
.spread-option-item.selected {
    background: linear-gradient(90deg, rgba(176, 163, 215, 0.2) 0%, transparent 100%);
    border-left: 4px solid #b0a3d7;
    padding-left: 1.25rem;
}

/* Spread Option Header */
.spread-option {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.spread-option-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.spread-emoji {
    font-size: 1.5rem;
    line-height: 1;
}

.spread-name {
    font-weight: 600;
    color: #e8e8e8;
    flex: 1;
}

.spread-card-count {
    font-size: 0.85rem;
    color: #b0a3d7;
    background: rgba(176, 163, 215, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    white-space: nowrap;
}

.spread-description {
    font-size: 0.9rem;
    color: #a8a8a8;
    line-height: 1.4;
}

/* ===== SPREAD PREVIEW TOOLTIP ===== */
.spread-preview-tooltip {
    position: fixed;
    background: #1a1a2e;
    border: 2px solid #b0a3d7;
    border-radius: 8px;
    padding: 1rem;
    max-width: 300px;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spread-preview-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.preview-emoji {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.preview-content {
    flex: 1;
}

.preview-content h4 {
    margin: 0 0 0.5rem 0;
    color: #e8e8e8;
    font-size: 1rem;
}

.preview-content p {
    margin: 0 0 0.75rem 0;
    color: #a8a8a8;
    font-size: 0.9rem;
    line-height: 1.4;
}

.preview-cards {
    display: inline-block;
    font-size: 0.85rem;
    color: #b0a3d7;
    background: rgba(176, 163, 215, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .spread-selector-wrapper {
        gap: 0.5rem;
    }

    .spread-dropdown-toggle {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

    .spread-option-item {
        padding: 0.875rem 1rem;
    }

    .spread-option-header {
        gap: 0.5rem;
    }

    .spread-emoji {
        font-size: 1.25rem;
    }

    .spread-card-count {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }

    .spread-preview-tooltip {
        max-width: 280px;
        left: 10px !important;
        right: 10px !important;
    }

    .preview-emoji {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .spread-dropdown-toggle {
        padding: 0.75rem 0.875rem;
        font-size: 0.9rem;
    }

    .spread-option-item {
        padding: 0.75rem 0.875rem;
    }

    .spread-option-header {
        flex-wrap: wrap;
    }

    .spread-name {
        width: 100%;
    }

    .spread-emoji {
        font-size: 1.1rem;
    }

    .spread-description {
        font-size: 0.85rem;
    }
}

/* ===== ACCESSIBILITY ===== */
.spread-dropdown-toggle:focus-visible {
    outline: 3px solid #b0a3d7;
    outline-offset: 2px;
}

.spread-option-item:focus-visible {
    outline: 2px solid #b0a3d7;
    outline-offset: -2px;
}

/* Keyboard navigation highlight */
.spread-option-item:focus {
    background: #1a1a2e;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    .spread-dropdown-toggle {
        border-width: 3px;
    }

    .spread-option-item[aria-selected="true"] {
        border-left-width: 6px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .spread-dropdown-toggle,
    .spread-options-list,
    .spread-option-item,
    .spread-preview-tooltip {
        transition: none;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.spread-options-list::-webkit-scrollbar {
    width: 8px;
}

.spread-options-list::-webkit-scrollbar-track {
    background: #1a1a2e;
    border-radius: 4px;
}

.spread-options-list::-webkit-scrollbar-thumb {
    background: #b0a3d7;
    border-radius: 4px;
}

.spread-options-list::-webkit-scrollbar-thumb:hover {
    background: #d4c5e2;
}
