/* =================================================================
   SINTETIZADOR IA — ESTILOS PROPIOS
   Reutiliza variables de index.css y patrones de forms.css
   ================================================================= */

.ai-wrapper { max-width: 760px; }

/* --- Cabecera --- */
.ai-hero { text-align: center; margin-bottom: 1.75rem; }
.ai-hero__icon {
    font-size: 2.75rem;
    display: inline-block;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 4px 8px rgba(37, 99, 235, 0.2));
}
.ai-hero h2 {
    font-size: 1.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
    letter-spacing: -0.5px;
}
.ai-hero p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 520px;
    margin: 0 auto;
}

/* --- Pasos numerados --- */
.step-title {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.9rem;
    color: var(--text-main);
}
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 800;
    margin-right: 0.6rem;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
}

/* --- Cards de modo --- */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
}
.mode-card { cursor: pointer; }
.mode-card input[type="radio"] { display: none; }
.mode-card__inner {
    padding: 1rem 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    text-align: center;
    transition: all 0.2s ease;
    height: 100%;
}
.mode-card:hover .mode-card__inner {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}
.mode-card input[type="radio"]:checked + .mode-card__inner {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.mode-card__icon { font-size: 1.7rem; margin-bottom: 0.35rem; }
.mode-card__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}
.mode-card__desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* --- Badge PRO en la card Educativo Pro --- */
.mode-card--pro .mode-card__inner { position: relative; }
.mode-card--pro .mode-card__inner::after {
    content: "PRO";
    position: absolute;
    top: 0.5rem;
    right: 0.55rem;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}
.mode-card--pro input[type="radio"]:checked + .mode-card__inner {
    border-color: #7c3aed;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}
.mode-card--pro:hover .mode-card__inner {
    border-color: #7c3aed;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

/* --- Pestañas de origen --- */
.source-tabs {
    display: flex;
    gap: 0.4rem;
    background: #f1f5f9;
    padding: 0.4rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}
.source-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.source-tab:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.55); }
.source-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.source-tab__icon { font-size: 1.05rem; }

.source-panel { display: none; }
.source-panel.active { display: block; }

/* --- URL input con icono --- */
.url-field { position: relative; }
.url-field__icon {
    position: absolute;
    top: 50%;
    left: 0.95rem;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1rem;
    pointer-events: none;
}
.url-field input[type="url"] {
    width: 100%;
    padding: 0.9rem 0.9rem 0.9rem 2.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.url-field input[type="url"]::placeholder { color: #94a3b8; }
.url-field input[type="url"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* --- Upload zone para archivos --- */
.upload-zone {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 1.4rem 1.6rem;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}
.upload-zone:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(37, 99, 235, 0.18);
}
.upload-zone__icon { font-size: 2.2rem; flex-shrink: 0; line-height: 1; }
.upload-zone__text { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.upload-zone__title { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.upload-zone__hint { font-size: 0.83rem; color: var(--text-muted); }
.upload-zone__filename {
    display: none;
    font-size: 0.88rem;
    color: #15803d;
    font-weight: 700;
    word-break: break-all;
}
.upload-zone.has-file {
    border-style: solid;
    border-color: #86efac;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}
.upload-zone.has-file .upload-zone__hint { display: none; }
.upload-zone.has-file .upload-zone__filename { display: block; }
.upload-zone input[type="file"] {
    position: absolute;
    opacity: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
}

/* --- Botón CTA --- */
.btn-submit-ai {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    padding: 1.05rem;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-submit-ai:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #1e40af 100%);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    transform: translateY(-2px);
}
.btn-submit-ai:active:not(:disabled) { transform: translateY(0); }
.btn-submit-ai:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}
.submit-hint {
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
kbd {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border: 1px solid #cbd5e1;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: white;
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: var(--text-main);
    font-weight: 700;
}

/* --- Loading state --- */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.75rem 1rem;
}
.loading-state__msg {
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}
.loading-state__hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
    text-align: center;
    max-width: 380px;
}

/* --- Result container --- */
#resultContainer {
    margin-top: 2rem;
    text-align: left;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08);
    animation: aiReveal 0.4s ease-out;
}
@keyframes aiReveal {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 0.85rem 1.1rem;
}
.result-header__title {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.result-actions { display: flex; gap: 0.4rem; }
.result-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 0.4rem 0.7rem;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    transition: background 0.2s ease, transform 0.15s ease;
}
.result-action-btn:hover { background: rgba(255, 255, 255, 0.32); transform: translateY(-1px); }
.result-action-btn:active { transform: translateY(0); }

.result-stats {
    display: flex;
    gap: 1.25rem;
    padding: 0.65rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}
.result-stats span { display: inline-flex; align-items: center; gap: 0.35rem; }
.result-stats strong { color: var(--primary); font-weight: 800; }

/* --- Tipografía del resumen --- */
.result-body {
    padding: 1.4rem 1.5rem 1.6rem;
    font-family: 'Inter', sans-serif;
    line-height: 1.7;
    color: #334155;
    font-size: 0.95rem;
}
.result-body p { margin: 0 0 0.85rem; }
.result-body p:last-child { margin-bottom: 0; }
.result-body strong { color: var(--text-main); font-weight: 700; }
.result-body em { color: #475569; }
.result-body ul, .result-body ol { margin: 0 0 0.95rem; padding-left: 1.4rem; }
.result-body ul li, .result-body ol li { margin-bottom: 0.4rem; }
.result-body ul li::marker { color: var(--primary); }
.result-body ol li::marker { color: var(--primary); font-weight: 700; }
.result-body h3, .result-body h4, .result-body h5 {
    color: var(--text-main);
    margin: 1.1rem 0 0.5rem;
    font-weight: 700;
}
.result-body h3 { font-size: 1.1rem; }
.result-body h4 { font-size: 1.02rem; }
.result-body h5 { font-size: 0.95rem; color: var(--primary); }
.result-body code {
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88em;
    color: #1e40af;
}
.result-body > *:first-child { margin-top: 0; }

/* --- Status box --- */
.status-box {
    margin-top: 1.25rem;
    transition: all 0.3s ease;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .ai-hero h2 { font-size: 1.55rem; }
    .mode-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .source-tab { padding: 0.65rem 0.5rem; font-size: 0.88rem; }
    .upload-zone { padding: 1.1rem; }
    .upload-zone__icon { font-size: 1.8rem; }
    .result-header { flex-wrap: wrap; }
    .result-action-btn { font-size: 0.78rem; padding: 0.35rem 0.55rem; }
    .result-stats { flex-direction: column; gap: 0.3rem; padding: 0.7rem 1rem; }
    .result-body { padding: 1.1rem 1.1rem 1.3rem; }
}

/* =====================================================================
   DARK MODE — overrides para el sintetizador IA
   ===================================================================== */
[data-theme="dark"] .mode-card__inner {
    background: var(--bg-color);
    border-color: var(--gray-200);
}
[data-theme="dark"] .mode-card:hover .mode-card__inner { border-color: var(--primary); }
[data-theme="dark"] .mode-card input[type="radio"]:checked + .mode-card__inner {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--primary);
}
[data-theme="dark"] .mode-card--pro input[type="radio"]:checked + .mode-card__inner {
    background: rgba(124, 58, 237, 0.15);
    border-color: #7c3aed;
}

[data-theme="dark"] .source-tabs { background: var(--card-bg); }
[data-theme="dark"] .source-tab:hover { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .source-tab.active {
    background: var(--bg-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .url-field input[type="url"] {
    background: var(--bg-color);
    border-color: var(--gray-200);
    color: var(--text-main);
}
[data-theme="dark"] .url-field input[type="url"]::placeholder { color: var(--text-muted); }

[data-theme="dark"] .upload-zone {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-color) 100%);
    border-color: var(--gray-300);
}
[data-theme="dark"] .upload-zone:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, var(--card-bg) 100%);
}
[data-theme="dark"] .upload-zone.has-file {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, var(--card-bg) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] #resultContainer {
    background: var(--card-bg);
    border-color: var(--gray-200);
}
[data-theme="dark"] .result-stats {
    background: var(--bg-color);
    border-bottom-color: var(--gray-200);
}
[data-theme="dark"] .result-body { color: var(--text-main); }
[data-theme="dark"] .result-body em { color: var(--text-muted); }
[data-theme="dark"] .result-body code {
    background: var(--bg-color);
    color: #93c5fd;
}
[data-theme="dark"] .btn-submit-ai:disabled {
    background: var(--gray-200);
    color: var(--text-muted);
}
[data-theme="dark"] kbd {
    background: var(--card-bg);
    border-color: var(--gray-300);
    color: var(--text-main);
}
