* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    text-align: center;
    border-left: 4px solid #e67e22;
}

header h1 { color: #2C3E50; margin-bottom: 8px; }
.subtitle { color: #7f8c8d; }

/* Step Cards */
.step-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.step-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.step-card.completed .step-header {
    background: #f0fdf4;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 25px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

.step-number {
    background: #e67e22;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95em;
    flex-shrink: 0;
}

.step-card.completed .step-number {
    background: #27ae60;
}

.step-header h2 {
    color: #2C3E50;
    font-size: 1.1em;
    flex: 1;
}

.step-badge {
    background: #e67e22;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.step-content {
    padding: 25px;
}

.step-description {
    color: #666;
    margin-bottom: 18px;
    font-size: 0.95em;
}

/* Textarea */
#textoCorreo {
    width: 100%;
    height: 200px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #333;
    resize: vertical;
    transition: border-color 0.2s;
    line-height: 1.5;
}

#textoCorreo:focus {
    outline: none;
    border-color: #e67e22;
}

.step-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s;
}

.btn-large { padding: 12px 28px; font-size: 1em; }

.btn-primary { background: #e67e22; color: white; }
.btn-primary:hover { background: #d35400; }

.btn-secondary { background: #ecf0f1; color: #555; }
.btn-secondary:hover { background: #dde1e4; }

.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #219a52; }

.btn-disponible { background: #2980b9; color: white; }
.btn-disponible:hover { background: #2471a3; }

.btn-ia { background: #7c3aed; color: white; }
.btn-ia:hover { background: #6d28d9; }
.btn-ia:disabled { background: #a78bfa; cursor: not-allowed; }

.timer-ia {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.88em;
    font-weight: 600;
    color: #7c3aed;
    font-family: monospace;
    min-width: 70px;
    opacity: 0;
    transition: opacity 0.2s;
}
.timer-ia.visible { opacity: 1; }
.timer-ia.stopped { color: #555; }

/* Secciones detectadas */
.seccion-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.seccion-card:hover { border-color: #e67e22; }

.seccion-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fafafa;
    cursor: pointer;
    user-select: none;
}

.seccion-header-row:hover { background: #f0f0f0; }

.seccion-check-label {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.seccion-check {
    width: 16px;
    height: 16px;
    accent-color: #e67e22;
    cursor: pointer;
}

.seccion-titulo {
    flex: 1;
    font-weight: 700;
    color: #2C3E50;
    font-size: 0.95em;
}

.seccion-count {
    background: #f0f0f0;
    color: #555;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    flex-shrink: 0;
}

.seccion-toggle {
    color: #aaa;
    font-size: 0.8em;
    flex-shrink: 0;
}

.seccion-body {
    padding: 12px 16px 12px 44px;
    border-top: 1px solid #eee;
    background: white;
}

.bloque-preview {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px solid #f5f5f5;
}

.bloque-preview:last-child { border-bottom: none; }

.bloque-nombre {
    font-weight: 600;
    font-size: 0.88em;
    color: #2C3E50;
    flex: 1;
}

.bloque-detalle {
    font-size: 0.82em;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.mas-bloques {
    color: #aaa;
    font-size: 0.82em;
    font-style: italic;
    margin-top: 6px;
}

/* PDF General Box */
.pdf-general-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #fff8f3;
    border: 1px solid #f0a070;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pdf-general-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pdf-general-info strong {
    font-size: 1.05em;
    color: #2C3E50;
}

.pdf-general-info span {
    font-size: 0.88em;
    color: #777;
}

.separador-pdf {
    text-align: center;
    position: relative;
    margin: 5px 0 20px;
}

.separador-pdf::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

.separador-pdf span {
    position: relative;
    background: white;
    padding: 0 12px;
    color: #aaa;
    font-size: 0.85em;
}

/* Grid de PDFs por sección */
.pdf-secciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.btn-pdf-seccion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    width: 100%;
}

.btn-pdf-seccion:hover {
    border-color: #e67e22;
    background: #fff8f3;
    box-shadow: 0 2px 6px rgba(230, 126, 34, 0.15);
}

.btn-pdf-icon { font-size: 1.2em; flex-shrink: 0; }

.btn-pdf-titulo {
    font-size: 0.85em;
    font-weight: 600;
    color: #2C3E50;
    line-height: 1.3;
}

/* Overlay generando */
.generando-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.generando-box {
    background: white;
    border-radius: 12px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.generando-box p {
    margin-top: 15px;
    color: #555;
    font-size: 0.95em;
}

.loading-spinner-large {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #e67e22;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* Mensajes */
.message-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9000;
}

.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-top: 8px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.message-success { background: #27ae60; color: white; }
.message-error   { background: #e74c3c; color: white; }
.message-info    { background: #3498db; color: white; }

/* Disponible Export Box */
.disponible-export-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: #eaf4fb;
    border: 1px solid #7fb3d3;
    border-radius: 10px;
    padding: 20px 24px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.disponible-export-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.disponible-export-info strong {
    font-size: 1.05em;
    color: #2C3E50;
}

.disponible-export-info span {
    font-size: 0.88em;
    color: #777;
}

/* Responsive */
@media (max-width: 600px) {
    .pdf-general-box { flex-direction: column; align-items: stretch; }
    .disponible-export-box { flex-direction: column; align-items: stretch; }
    .pdf-secciones-grid { grid-template-columns: 1fr; }
    .step-actions { flex-direction: column; }
}
