/* ==========================================================================
   Style Selection - Style Modal, Grid, Expanded View
   ========================================================================== */

.style-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.style-selection-overlay.hidden {
    display: none;
}

.style-selection-modal {
    background: #1a1a2e;
    border-radius: 16px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #0f3460;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.style-selection-header {
    padding: 24px 32px 16px;
    border-bottom: 1px solid #0f3460;
    text-align: center;
}

.style-selection-header h2 {
    font-size: 24px;
    color: #e94560;
    margin-bottom: 8px;
}

.style-selection-intro {
    color: #888;
    font-size: 14px;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

.style-preview-scene {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(15, 52, 96, 0.3);
    border-radius: 8px;
    display: inline-block;
}

.style-preview-scene-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.style-preview-scene-name {
    font-size: 14px;
    color: #ccc;
}

.style-options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 24px 32px;
}

@media (max-width: 900px) {
    .style-options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .style-options-grid {
        grid-template-columns: 1fr;
    }
}

.style-option-card {
    position: relative;
    background: #16213e;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    border: 2px solid transparent;
}

.style-option-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.style-option-card.selected {
    border-color: #e94560;
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

.style-option-preview {
    position: relative;
    aspect-ratio: var(--style-preview-aspect-ratio, 3 / 4);
    background: #0f3460;
    display: flex;
    align-items: center;
    justify-content: center;
}

.style-option-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.style-option-preview-loading {
    color: #666;
    font-size: 12px;
}

.style-option-preview-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #333;
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.style-option-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e94560;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Radio indicator with hint text in bottom right */
.style-option-radio {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px 4px 6px;
    border-radius: 16px;
    transition: background 0.2s;
}

.style-option-radio.ready {
    cursor: pointer;
}

.style-option-radio.generating {
    cursor: default;
}

.style-option-card:hover .style-option-radio {
    background: rgba(0, 0, 0, 0.85);
}

.style-option-radio .radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid #e94560;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.2s, border-color 0.2s;
}

.style-option-card.selected .style-option-radio .radio-circle {
    background: #e94560;
    border-color: #e94560;
}

.style-option-card.selected .style-option-radio .radio-circle::after {
    content: '✓';
}

.style-option-radio .radio-hint {
    display: none;
    font-size: 11px;
    color: #ccc;
    white-space: nowrap;
}

.style-option-radio.generating .radio-hint-generating {
    display: block;
    color: #888;
}

.style-option-radio.ready .radio-hint-ready {
    display: block;
}

.style-option-card:hover .style-option-radio.ready .radio-hint-ready {
    display: none;
}

.style-option-card:hover .style-option-radio.ready .radio-hint-select {
    display: block;
}

.style-option-card.selected .style-option-radio .radio-hint-selected {
    display: block;
    color: #e94560;
    font-weight: 500;
}

.style-option-card.selected .style-option-radio .radio-hint-generating,
.style-option-card.selected .style-option-radio .radio-hint-ready,
.style-option-card.selected .style-option-radio .radio-hint-select {
    display: none;
}

.style-option-info {
    padding: 12px;
}

.style-option-name {
    font-size: 14px;
    font-weight: 600;
    color: #eee;
    margin-bottom: 4px;
}

.style-option-category {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.style-option-description {
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.style-option-selected-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    background: #e94560;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
}

.style-option-card.selected .style-option-selected-check {
    opacity: 1;
    transform: scale(1);
}

/* Expanded image modal */
.image-expand-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 40px;
    cursor: zoom-out;
}

.image-expand-overlay.hidden {
    display: none;
}

.image-expand-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-expand-container img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-expand-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.image-expand-close:hover {
    opacity: 1;
}

.image-expand-caption {
    text-align: center;
    margin-top: 16px;
    color: #ccc;
}

.image-expand-caption h3 {
    font-size: 18px;
    margin-bottom: 4px;
    color: #fff;
}

.image-expand-caption p {
    font-size: 14px;
    color: #888;
}

/* Navigation arrows for expanded view */
.image-expand-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 50px;
    height: 80px;
    font-size: 28px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.image-expand-nav:hover {
    background: rgba(233, 69, 96, 0.8);
}

.image-expand-nav.prev {
    left: -70px;
}

.image-expand-nav.next {
    right: -70px;
}

.image-expand-position {
    text-align: center;
    margin-top: 8px;
    font-size: 13px;
    color: #666;
}

/* Select button for variant selection in expanded view */
.image-expand-select-btn {
    display: block;
    margin: 16px auto 8px;
    padding: 14px 32px;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.image-expand-select-btn:hover {
    background: #ff6b6b;
    transform: scale(1.02);
}

.image-expand-select-btn.hidden {
    display: none;
}

.style-selection-footer {
    padding: 16px 32px 24px;
    border-top: 1px solid #0f3460;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.style-selection-status {
    font-size: 13px;
    color: #888;
}

.style-confirm-btn {
    background: #e94560;
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.style-confirm-btn:hover:not(:disabled) {
    background: #ff6b6b;
}

.style-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Recommendation reasoning tooltip */
.style-option-reasoning {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #0f3460;
    color: #ddd;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    width: 220px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.style-option-reasoning::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #0f3460;
}

.style-option-card:hover .style-option-reasoning {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Inline Style Selection - Right Pane (Non-Blocking)
   ========================================================================== */

.inline-style-selection {
    /* Fill the image pane using flex, not absolute positioning */
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
    padding: 16px;
    overflow-y: auto;
    min-height: 0;
}

.inline-style-selection.hidden {
    display: none;
}

.inline-style-header {
    text-align: center;
    margin-bottom: 12px;
}

.inline-style-header h3 {
    font-size: 18px;
    color: #e94560;
    margin: 0 0 4px 0;
}

.inline-style-subtitle {
    font-size: 12px;
    color: #888;
    margin: 0;
}

/* Compact 2x4 grid that fits without scrolling */
.inline-style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: max-content;
    gap: 8px;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.inline-style-loading {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    gap: 12px;
}

.inline-style-loading p {
    margin: 0;
    font-size: 14px;
}

.inline-style-loading-subtext {
    font-size: 12px !important;
    color: #666 !important;
}

/* Compact style card for inline grid */
.inline-style-card {
    position: relative;
    background: #16213e;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
}

.inline-style-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.inline-style-card.selected {
    border-color: #e94560;
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.3);
}

.inline-style-preview {
    position: relative;
    aspect-ratio: var(--style-preview-aspect-ratio, 3 / 4);
    background: #0f3460;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inline-style-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inline-style-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 12px;
}

/* Compact radio indicator with hint text in bottom right */
.inline-style-radio {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.7);
    padding: 3px 8px 3px 5px;
    border-radius: 14px;
    transition: background 0.2s;
}

.inline-style-radio.ready {
    cursor: pointer;
}

.inline-style-radio.generating {
    cursor: default;
}

.inline-style-card:hover .inline-style-radio {
    background: rgba(0, 0, 0, 0.85);
}

.inline-style-radio .radio-circle {
    width: 16px;
    height: 16px;
    border: 2px solid #e94560;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: bold;
    transition: background 0.2s, border-color 0.2s;
}

.inline-style-card.selected .inline-style-radio .radio-circle {
    background: #e94560;
    border-color: #e94560;
}

.inline-style-card.selected .inline-style-radio .radio-circle::after {
    content: '✓';
}

.inline-style-radio .radio-hint {
    display: none;
    font-size: 10px;
    color: #ccc;
    white-space: nowrap;
}

.inline-style-radio.generating .radio-hint-generating {
    display: block;
    color: #888;
}

.inline-style-radio.ready .radio-hint-ready {
    display: block;
}

.inline-style-card:hover .inline-style-radio.ready .radio-hint-ready {
    display: none;
}

.inline-style-card:hover .inline-style-radio.ready .radio-hint-select {
    display: block;
}

.inline-style-card.selected .inline-style-radio .radio-hint-selected {
    display: block;
    color: #e94560;
    font-weight: 500;
}

.inline-style-card.selected .inline-style-radio .radio-hint-generating,
.inline-style-card.selected .inline-style-radio .radio-hint-ready,
.inline-style-card.selected .inline-style-radio .radio-hint-select {
    display: none;
}

.inline-style-check {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: #e94560;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s, transform 0.15s;
}

.inline-style-card.selected .inline-style-check {
    opacity: 1;
    transform: scale(1);
}

.inline-style-name {
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #eee;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inline-style-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #0f3460;
}

.inline-style-status {
    font-size: 12px;
    color: #888;
}

.inline-style-confirm-btn {
    background: #e94560;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.inline-style-confirm-btn:hover:not(:disabled) {
    background: #ff6b6b;
}

.inline-style-confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
