/* ==========================================
   MangaStudio - Continuation Modal
   Apple-inspired minimalist design
   ========================================== */

/* ==========================================
   Modal Container
   ========================================== */

.continuation-modal {
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary, #ffffff);
    animation: continuationModalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes continuationModalSlide {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================
   Header
   ========================================== */

.continuation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px 20px;
    border-bottom: 1px solid var(--border-light, #e5e5e7);
    background: var(--bg-primary, #ffffff);
}

.continuation-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.continuation-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f0f0f5 0%, #e8e8ed 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #86868b);
}

.continuation-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.continuation-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    letter-spacing: -0.02em;
    margin: 0;
}

.continuation-subtitle {
    font-size: 13px;
    color: var(--text-tertiary, #86868b);
}

.continuation-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary, #86868b);
    transition: all 0.2s ease;
}

.continuation-close-btn:hover {
    background: var(--bg-secondary, #f5f5f7);
    color: var(--text-primary, #1d1d1f);
}

/* ==========================================
   Stepper
   ========================================== */

.continuation-stepper {
    padding: 20px 32px;
    background: var(--bg-secondary, #f5f5f7);
    border-bottom: 1px solid var(--border-light, #e5e5e7);
}

.stepper-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    transition: all 0.25s ease;
}

.stepper-step.active,
.stepper-step.completed {
    opacity: 1;
}

.stepper-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-primary, #ffffff);
    border: 2px solid var(--border-light, #e5e5e7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary, #86868b);
    transition: all 0.25s ease;
}

.stepper-step.active .stepper-circle {
    background: var(--accent, #0071e3);
    border-color: var(--accent, #0071e3);
    color: #ffffff;
}

.stepper-step.completed .stepper-circle {
    background: #34c759;
    border-color: #34c759;
    color: #ffffff;
}

.stepper-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary, #86868b);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stepper-step.active .stepper-label,
.stepper-step.completed .stepper-label {
    color: var(--text-secondary, #424245);
}

.stepper-connector {
    width: 40px;
    height: 2px;
    background: var(--border-light, #e5e5e7);
    margin: 0 8px;
    margin-bottom: 20px;
    transition: background 0.25s ease;
}

.stepper-connector.completed {
    background: #34c759;
}

/* ==========================================
   Content Area
   ========================================== */

.continuation-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.continuation-step {
    padding: 24px 32px;
}

.step-content {
    min-height: 280px;
}

/* Custom scrollbar */
.continuation-content::-webkit-scrollbar {
    width: 6px;
}

.continuation-content::-webkit-scrollbar-track {
    background: transparent;
}

.continuation-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.continuation-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ==========================================
   Step 1: Configuration
   ========================================== */

.config-section {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
}

.config-hint {
    font-size: 13px;
    color: var(--text-tertiary, #86868b);
    margin: 0;
    line-height: 1.5;
}

.config-options {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.config-option {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border-light, #e5e5e7);
    border-radius: 12px;
    background: var(--bg-primary, #ffffff);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-option:hover {
    border-color: var(--accent, #0071e3);
    background: rgba(0, 113, 227, 0.04);
}

.config-option.active {
    background: var(--accent, #0071e3);
    border-color: var(--accent, #0071e3);
    color: #ffffff;
}

/* Mode Options */
.mode-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-light, #e5e5e7);
    border-radius: 12px;
    background: var(--bg-primary, #ffffff);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-option:hover {
    border-color: var(--accent, #0071e3);
    background: rgba(0, 113, 227, 0.02);
}

.mode-option.active {
    border-color: var(--accent, #0071e3);
    background: rgba(0, 113, 227, 0.04);
}

.mode-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg-secondary, #f5f5f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #86868b);
    transition: all 0.2s ease;
}

.mode-option.active .mode-icon {
    background: var(--accent, #0071e3);
    color: #ffffff;
}

.mode-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
}

.mode-desc {
    font-size: 13px;
    color: var(--text-tertiary, #86868b);
}

/* ==========================================
   Step 2: Processing
   ========================================== */

.processing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.processing-visual {
    margin-bottom: 24px;
}

.processing-spinner {
    position: relative;
    width: 80px;
    height: 80px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--bg-secondary, #f5f5f7);
    border-top-color: var(--accent, #0071e3);
    border-radius: 50%;
    animation: spinnerRotate 1s linear infinite;
}

@keyframes spinnerRotate {
    to {
        transform: rotate(360deg);
    }
}

.spinner-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent, #0071e3);
    animation: spinnerPulse 2s ease-in-out infinite;
}

@keyframes spinnerPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

.processing-info {
    margin-bottom: 24px;
}

.processing-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    margin: 0 0 8px;
}

.processing-status {
    font-size: 14px;
    color: var(--text-secondary, #86868b);
    margin: 0;
    transition: color 0.2s ease;
}

.progress-container {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar-track {
    height: 6px;
    background: var(--bg-secondary, #f5f5f7);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #0071e3) 0%, #40a9ff 100%);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-percentage {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary, #86868b);
    text-align: center;
}

/* ==========================================
   Step 3a: Suggestions
   ========================================== */

.suggestions-intro {
    font-size: 14px;
    color: var(--text-secondary, #86868b);
    margin: 0 0 20px;
    line-height: 1.5;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestion-card {
    padding: 16px;
    border: 1px solid var(--border-light, #e5e5e7);
    border-radius: 12px;
    background: var(--bg-primary, #ffffff);
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-card:hover {
    border-color: var(--accent, #0071e3);
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.08);
}

.suggestion-card.selected {
    border-color: var(--accent, #0071e3);
    background: rgba(0, 113, 227, 0.04);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

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

.suggestion-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    margin: 0;
}

.suggestion-badges {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.risk-badge,
.score-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.risk-badge.risk-baixo {
    background: rgba(52, 199, 89, 0.12);
    color: #34c759;
}

.risk-badge.risk-medio {
    background: rgba(255, 204, 0, 0.15);
    color: #cc9900;
}

.risk-badge.risk-alto {
    background: rgba(255, 59, 48, 0.12);
    color: #ff3b30;
}

.score-badge {
    background: var(--bg-secondary, #f5f5f7);
    color: var(--text-secondary, #86868b);
}

.suggestion-premise {
    font-size: 14px;
    color: var(--text-secondary, #424245);
    line-height: 1.6;
    margin: 0 0 12px;
}

.suggestion-details {
    border-top: 1px solid var(--border-light, #e5e5e7);
    padding-top: 12px;
}

.toggle-details-btn {
    font-size: 13px;
    color: var(--accent, #0071e3);
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.toggle-details-btn:hover {
    text-decoration: underline;
}

.suggestion-details-content {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-tertiary, #86868b);
    line-height: 1.6;
}

.no-suggestions {
    text-align: center;
    color: var(--text-tertiary, #86868b);
    padding: 40px 20px;
    font-size: 14px;
}

/* ==========================================
   Step 3b: Custom Idea
   ========================================== */

.custom-idea-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-idea-textarea {
    width: 100%;
    min-height: 160px;
    padding: 14px 16px;
    border: 1px solid var(--border-light, #e5e5e7);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text-primary, #1d1d1f);
    resize: vertical;
    transition: all 0.2s ease;
}

.custom-idea-textarea:focus {
    outline: none;
    border-color: var(--accent, #0071e3);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.custom-idea-textarea::placeholder {
    color: var(--text-tertiary, #86868b);
}

/* ==========================================
   Step 4: Preview
   ========================================== */

.preview-header {
    margin-bottom: 20px;
}

.preview-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    margin: 0 0 4px;
}

.preview-desc {
    font-size: 13px;
    color: var(--text-tertiary, #86868b);
    margin: 0;
}

.preview-chapters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.preview-chapter-card {
    padding: 16px;
    background: var(--bg-secondary, #f5f5f7);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.preview-chapter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.preview-chapter-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent, #0071e3);
    background: rgba(0, 113, 227, 0.08);
    padding: 4px 8px;
    border-radius: 6px;
}

.preview-chapter-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    margin: 0;
}

.preview-chapter-summary {
    font-size: 13px;
    color: var(--text-secondary, #86868b);
    line-height: 1.6;
    margin: 0 0 12px;
}

.preview-chapter-meta {
    display: flex;
    gap: 12px;
}

.preview-meta-item {
    font-size: 12px;
    color: var(--text-tertiary, #86868b);
}

.preview-changes {
    padding-top: 16px;
    border-top: 1px solid var(--border-light, #e5e5e7);
}

.changes-summary h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    margin: 0 0 12px;
}

.changes-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 24px;
}

.changes-summary li {
    font-size: 13px;
    color: var(--text-secondary, #86868b);
}

.changes-summary li strong {
    color: var(--text-primary, #1d1d1f);
    font-weight: 600;
}

/* ==========================================
   Step 5: Success
   ========================================== */

.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.success-visual {
    margin-bottom: 20px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(52, 199, 89, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #34c759;
    animation: successPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successPop {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.success-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    margin: 0 0 8px;
}

.success-message {
    font-size: 14px;
    color: var(--text-secondary, #86868b);
    margin: 0 0 24px;
}

.success-summary {
    width: 100%;
    max-width: 320px;
}

.success-chapters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.success-chapter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary, #f5f5f7);
    border-radius: 10px;
}

.success-chapter-num {
    font-size: 12px;
    font-weight: 600;
    color: #34c759;
    background: rgba(52, 199, 89, 0.12);
    padding: 4px 8px;
    border-radius: 6px;
}

.success-chapter-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1d1d1f);
}

/* ==========================================
   Footer
   ========================================== */

.continuation-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 32px;
    border-top: 1px solid var(--border-light, #e5e5e7);
    background: var(--bg-primary, #ffffff);
}

.continuation-footer .btn {
    min-width: 120px;
}

.continuation-footer .btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
}

.continuation-footer .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 640px) {
    .continuation-modal {
        max-height: 100vh;
        border-radius: 0;
    }

    .continuation-header {
        padding: 20px;
    }

    .continuation-stepper {
        padding: 16px 20px;
    }

    .stepper-connector {
        width: 24px;
        margin: 0 4px;
    }

    .stepper-label {
        display: none;
    }

    .continuation-step {
        padding: 20px;
    }

    .config-options {
        flex-wrap: wrap;
    }

    .mode-option {
        padding: 14px;
    }

    .mode-icon {
        width: 40px;
        height: 40px;
    }

    .suggestion-header {
        flex-direction: column;
        gap: 8px;
    }

    .changes-summary ul {
        flex-direction: column;
        gap: 8px;
    }

    .continuation-footer {
        padding: 16px 20px;
    }

    .continuation-footer .btn {
        flex: 1;
    }
}
