/* ==========================================================================
   Character Selection - Protagonist Modal, Variants
   ========================================================================== */

/* Character Selection Modal */
.character-modal-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: 100;
}

.character-modal-overlay.hidden {
    display: none;
}

.character-modal {
    background: #16213e;
    border-radius: 16px;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.character-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #0f3460;
}

.character-modal-header h2 {
    color: #e94560;
    font-size: 20px;
    margin: 0;
}

.character-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.character-modal-close:hover {
    color: #e94560;
}

.character-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.character-modal-intro {
    color: #aaa;
    margin-bottom: 24px;
    font-size: 14px;
}

.character-section {
    margin-bottom: 32px;
}

.character-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #e94560;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-card {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.character-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.character-name {
    font-size: 16px;
    font-weight: 600;
    color: #eee;
}

.character-desc {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

.character-variants {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.variant-option {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}

.variant-option:hover {
    transform: scale(1.02);
    border-color: #0f3460;
}

.variant-option.selected {
    border-color: #e94560;
}

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

.variant-check {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #e94560;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.variant-option.selected .variant-check {
    display: flex;
}

.variant-loading {
    width: 100%;
    height: 100%;
    background: #0f3460;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
}

.supporting-character {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #1a1a2e;
    border-radius: 8px;
    margin-bottom: 8px;
}

.supporting-character-img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
}

.supporting-character-info {
    flex: 1;
}

.supporting-character-name {
    font-size: 14px;
    font-weight: 500;
    color: #eee;
}

.supporting-character-desc {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

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

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

.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;
}

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

.confirm-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

/* Protagonist Selection Mode (in image pane) */
.protagonist-selection {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
}

.protagonist-selection.hidden {
    display: none;
}

.protagonist-selection-header {
    text-align: center;
    margin-bottom: 16px;
}

.protagonist-selection-header h3 {
    color: #e94560;
    font-size: 18px;
    margin-bottom: 8px;
}

.protagonist-selection-header p {
    color: #888;
    font-size: 13px;
}

.protagonist-info {
    background: #16213e;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.protagonist-name {
    font-size: 20px;
    font-weight: 600;
    color: #eee;
    margin-bottom: 4px;
}

.protagonist-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.4;
}

.protagonist-variants-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.protagonist-variant {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
}

.protagonist-variant:hover {
    transform: scale(1.02);
    border-color: #0f3460;
}

.protagonist-variant.selected {
    border-color: #e94560;
}

.protagonist-variant img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Radio indicator with hint text in bottom right */
.protagonist-variant-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;
    cursor: pointer;
}

.protagonist-variant:hover .protagonist-variant-radio {
    background: rgba(0, 0, 0, 0.85);
}

.protagonist-variant-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;
}

.protagonist-variant.selected .protagonist-variant-radio .radio-circle {
    background: #e94560;
    border-color: #e94560;
}

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

.protagonist-variant:not(.selected) .protagonist-variant-radio .radio-hint-preview {
    display: inline;
}

.protagonist-variant:hover:not(.selected) .protagonist-variant-radio .radio-hint-preview {
    display: none;
}

.protagonist-variant:hover:not(.selected) .protagonist-variant-radio .radio-hint-select {
    display: inline;
}

.protagonist-variant.selected .protagonist-variant-radio .radio-hint-selected {
    display: inline;
    color: #e94560;
    font-weight: 500;
}

.protagonist-variant-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* Placeholder for variants still being generated */
.protagonist-variant-placeholder {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #333;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.protagonist-variant-placeholder .variant-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.protagonist-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #0f3460;
}

.protagonist-nav-btn {
    background: #0f3460;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.protagonist-nav-btn:hover:not(:disabled) {
    background: #1a4a7a;
}

.protagonist-nav-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

.protagonist-nav-btn.primary {
    background: #e94560;
}

.protagonist-nav-btn.primary:hover:not(:disabled) {
    background: #ff6b6b;
}

.protagonist-progress {
    font-size: 13px;
    color: #888;
}

/* Supporting Characters in Dev Tools */
.dev-supporting-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #0f3460;
}

.dev-supporting-header {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dev-supporting-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.dev-supporting-char {
    position: relative;
    aspect-ratio: 3/2;
    border-radius: 4px;
    overflow: hidden;
    cursor: help;
}

.dev-supporting-char img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dev-supporting-char-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 9px;
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dev-supporting-empty {
    color: #666;
    font-size: 11px;
    text-align: center;
    padding: 12px;
}

/* ==========================================================================
   Analysis Loading - Non-blocking indicator during book analysis
   ========================================================================== */

.analysis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 32px;
    text-align: center;
}

.analysis-loading.hidden {
    display: none;
}

.analysis-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #0f3460;
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

.analysis-loading-text {
    font-size: 18px;
    color: #eee;
    margin-bottom: 8px;
}

.analysis-loading-subtext {
    font-size: 14px;
    color: #888;
}
