/* ═══════════════════════════════════════════════════════════════
   dashboard-modals.css — DED Express 2.0
   Estilos dos modais, wizard de geração e componentes internos.
   ═══════════════════════════════════════════════════════════════ */

/* ── Step Indicator ─────────────────────────────────────────── */
.step-indicator {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    padding: 18px 32px;
    background: #f9f7ff;
    border-bottom: 1px solid #e8e0f5;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.step {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    font-weight: 600;
    color: #9b8fb0;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.25s ease;
}

.step .step-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: #e2d9f3;
    color: #9b8fb0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    transition: all 0.3s var(--ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.step.active {
    color: #4a0e8f;
}

.step.active .step-num {
    background: #6a1fc2;
    color: white;
    box-shadow: 0 3px 10px rgba(106, 31, 194, 0.35);
}

.step.done {
    color: #16a34a;
}

.step.done .step-num {
    background: #22c55e;
    color: white;
}

.step-connector {
    flex: 1;
    height: 2px;
    background: #e2d9f3;
    margin: 0 14px;
    min-width: 20px;
    border-radius: 2px;
    transition: background 0.4s ease;
}

.step-connector.done {
    background: #22c55e;
}

/* ── Template Cards ─────────────────────────────────────────── */
.template-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.template-card {
    border: 1.5px solid #d8cfee;
    padding: 14px;
    border-radius: 14px;
    cursor: pointer;
    background: white;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.22s ease;
}

.template-card:hover {
    border-color: #6a1fc2;
    background: #faf8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(106, 31, 194, 0.12);
}

.template-card i {
    font-size: 20px;
    color: #6a1fc2;
    margin-bottom: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

.template-card span {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #1a1028;
}

.template-card .template-desc {
    font-size: 11px;
    color: #6b6080;
    font-weight: 400;
    margin-top: 2px;
}

/* ── Chips (Série e Disciplina) ─────────────────────────────── */
.chip-btn,
.disc-chip {
    background: white;
    border: 1.5px solid #d0c8e8;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #6b6080;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
}

.chip-btn:hover,
.disc-chip:hover {
    border-color: #6a1fc2;
    color: #4a0e8f;
    background: #f5f0ff;
}

.chip-btn.active,
.disc-chip.active {
    background: #4a0e8f;
    color: white;
    border-color: #4a0e8f;
    box-shadow: 0 2px 8px rgba(74, 14, 143, 0.25);
}

/* ── Chips Group Layout ─────────────────────────────────────── */
.chips-group {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.disc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

/* ── Option Cards (tipo de questão, layout, etc) ─────────────── */
.option-card {
    border: 1.5px solid #d0c8e8;
    padding: 14px;
    border-radius: 14px;
    cursor: pointer;
    background: white;
    text-align: center;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.option-card:hover {
    border-color: #6a1fc2;
    background: #faf8ff;
}

.option-card.active {
    border-color: #6a1fc2;
    background: rgba(106, 31, 194, 0.07);
    box-shadow: 0 3px 12px rgba(106, 31, 194, 0.15);
}

.option-card i {
    font-size: 20px;
    color: #6a1fc2;
}

.option-card span {
    font-size: 12px;
    font-weight: 700;
    color: #1a1028;
}

/* ── AI Options Grid ────────────────────────────────────────── */
.ai-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ── Smart Prompt Buttons ──────────────────────────────────── */
.smart-prompt-btn {
    background: rgba(106, 31, 194, 0.07);
    color: #4a0e8f;
    border: 1.5px solid #c4b5f4;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
}

.smart-prompt-btn:hover {
    background: #6a1fc2;
    color: white;
    border-color: #6a1fc2;
}

/* ── Config Section h3 ──────────────────────────────────────── */
.config-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: #4a0e8f;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #ede8f8;
}

/* ── Modal Input, Textarea, Select ─────────────────────────── */
.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body textarea,
.modal-body select {
    border: 1.5px solid #d0c8e8;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: #1a1028;
    background: white;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.modal-body textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    border-color: #6a1fc2;
    box-shadow: 0 0 0 3px rgba(106, 31, 194, 0.1);
}

/* ── Panel Title & Subtitle ────────────────────────────────── */
.panel-title {
    font-size: 17px;
    font-weight: 800;
    color: #4a0e8f;
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 12px;
    color: #6b6080;
    margin-bottom: 22px;
}

/* ── Modal Header ───────────────────────────────────────────── */
.modal-header {
    padding: 22px 28px;
    background: white;
    border-bottom: 1.5px solid #ede8f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 800;
    color: #4a0e8f;
}

/* ── Modal Body ─────────────────────────────────────────────── */
.modal-body {
    flex: 1;
    overflow-y: auto;
    display: block; /* override grid — step panels handle layout */
    padding: 0;
}

/* ── Modal Footer ───────────────────────────────────────────── */
.modal-footer {
    padding: 16px 28px;
    background: #f9f7ff;
    border-top: 1.5px solid #ede8f8;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
}

/* ── Modal Buttons ──────────────────────────────────────────── */
.btn-primary-modal {
    background: linear-gradient(135deg, #6a1fc2, #4a0e8f);
    color: white;
    border: none;
    padding: 11px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px rgba(106, 31, 194, 0.25);
}

.btn-primary-modal:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(106, 31, 194, 0.35);
}

.btn-primary-modal:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: transparent;
    border: 1.5px solid #d0c8e8;
    color: #6b6080;
    font-weight: 600;
    padding: 11px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-ghost:hover {
    background: #f5f0ff;
    border-color: #6a1fc2;
    color: #4a0e8f;
}

/* ── Modal Overlay Enhancements ─────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 16, 40, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    animation: overlayFadeIn 0.25s ease both;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-container {
    background: white;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    position: relative;
}

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

/* ── Review Box (Step 3) ────────────────────────────────────── */
.step-review-box {
    background: #f9f7ff;
    border: 1.5px solid #d8cfee;
    border-radius: 14px;
    padding: 22px;
}

/* ── Loading Overlay ────────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    border-radius: 24px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.loading-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid #ede8f8;
    border-top-color: #6a1fc2;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

.loading-text {
    font-size: 15px;
    font-weight: 800;
    color: #4a0e8f;
    letter-spacing: -0.01em;
}

.loading-subtext {
    font-size: 12px;
    color: #9b8fb0;
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ── Week Generation Counter Widget ────────────────────────── */
.gen-counter-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1.5px solid #d8cfee;
    background: white;
    font-size: 12px;
    font-weight: 700;
    color: #4a0e8f;
    cursor: default;
    transition: all 0.2s;
    white-space: nowrap;
}

.gen-counter-widget i {
    font-size: 13px;
    color: #6a1fc2;
}

.gen-counter-bar-wrap {
    width: 60px;
    height: 5px;
    background: #e2d9f3;
    border-radius: 99px;
    overflow: hidden;
}

.gen-counter-bar {
    height: 100%;
    background: linear-gradient(90deg, #6a1fc2, #8b5cf6);
    border-radius: 99px;
    transition: width 0.4s var(--ease-bounce, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.gen-counter-widget.limit-warning {
    border-color: #f59e0b;
    color: #92400e;
}

.gen-counter-widget.limit-warning i {
    color: #f59e0b;
}

.gen-counter-widget.limit-reached {
    border-color: #ef4444;
    color: #991b1b;
    background: #fef2f2;
}

.gen-counter-widget.limit-reached i {
    color: #ef4444;
}

/* ── Responsive Modal ───────────────────────────────────────── */
@media (max-width: 768px) {
    .modal-container {
        max-height: 95vh;
        border-radius: 16px;
        margin: 0;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 0;
    }

    .modal-footer {
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .step-indicator {
        padding: 12px 16px;
        gap: 0;
    }

    .step span:not(.step-num) {
        display: none;
    }

    .template-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .ai-options-grid {
        grid-template-columns: 1fr 1fr;
    }

    .gen-counter-widget {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .gen-counter-bar-wrap {
        width: 40px;
    }
}

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