/* =============================================
   Estilos especificos del generador de documentos
   Identidad Institucional / Legal / Fintech
   ============================================= */

/* =============================================
   Seccion de autoridad (encabezado del documento)
   ============================================= */
.doc-authority-section {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1E40AF 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.doc-authority-section::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    border-radius: 50%;
}

.doc-authority-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.doc-authority-section h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.doc-authority-section p {
    opacity: 0.8;
    font-size: 0.95rem;
    margin-bottom: 0;
    font-weight: 400;
}

.doc-authority-meta {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.doc-authority-meta span {
    font-size: 0.8rem;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* =============================================
   Formulario dinamico
   ============================================= */
.form-generador {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.grupo-campos {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.grupo-campos:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.grupo-campos legend {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary-dark);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #DBEAFE;
    letter-spacing: -0.01em;
}

.grupo-campos .form-label {
    font-weight: 500;
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
    color: var(--text-dark);
}

.grupo-campos .form-control,
.grupo-campos .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--white);
}

.grupo-campos .form-control:focus,
.grupo-campos .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.grupo-campos .form-control.is-invalid {
    border-color: var(--danger);
}

.grupo-campos textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.campo-requerido .form-label::after {
    content: ' *';
    color: var(--danger);
    font-weight: 600;
}

/* Campos auto-generados (monto en letra) */
.campo-auto {
    background-color: #F0F9FF !important;
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
    border-color: #BAE6FD !important;
}

/* =============================================
   Mensaje de seguridad
   ============================================= */
.security-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--accent-green-light);
    border: 1px solid #BBF7D0;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
}

.security-message i {
    color: var(--accent-green);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.security-message p {
    margin: 0;
    font-size: 0.82rem;
    color: #166534;
    line-height: 1.5;
}

.security-message strong {
    font-weight: 600;
}

/* =============================================
   Preview del documento - Desktop sticky
   ============================================= */
.preview-sticky {
    position: sticky;
    top: 80px;
}

.preview-panel {
    background: var(--white);
    border: 1px solid #D1D5DB;
    border-top: 3px solid #1E3A8A;
    border-radius: 0;
    padding: 2.5rem 2rem;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08), 0 4px 24px rgba(0, 0, 0, 0.04);
}

.preview-panel h1 {
    font-size: 1.3rem;
    color: #1E3A8A;
    line-height: 1.4;
}

.preview-panel h2 {
    font-size: 1.1rem;
    color: #1E3A8A;
    line-height: 1.4;
}

.preview-panel p {
    font-size: 0.85rem;
    line-height: 1.7;
    color: #374151;
}

.preview-panel table {
    font-size: 0.85rem;
    color: #374151;
}

/* Placeholder chips para campos vacios en preview */
.preview-panel .placeholder-campo,
.preview-mobile-body .placeholder-campo {
    display: inline-block;
    background: #FEF3C7;
    color: #92400E;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid #FDE68A;
    vertical-align: baseline;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
}

.preview-header h5 {
    font-weight: 700;
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dark);
}

/* =============================================
   Preview Mobile - Boton flotante
   ============================================= */
.btn-preview-mobile {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    width: auto;
    height: 48px;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-preview-mobile:hover,
.btn-preview-mobile:active {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(30, 58, 138, 0.5);
}

.btn-preview-mobile i {
    font-size: 1.2rem;
}

/* Preview Mobile - Overlay */
.preview-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1045;
    transition: opacity 0.3s ease;
}

/* Preview Mobile - Panel deslizable */
.preview-mobile-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1050;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

.preview-mobile-panel.open {
    transform: translateY(0);
}

.preview-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.preview-mobile-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

.preview-mobile-header h5 {
    font-weight: 700;
    margin: 0;
    font-size: 0.95rem;
}

.preview-mobile-body {
    padding: 24px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #374151;
    border-top: 3px solid #1E3A8A;
}

.preview-mobile-body h1 {
    font-size: 1.2rem;
    color: #1E3A8A;
}

.preview-mobile-body h2 {
    font-size: 1rem;
    color: #1E3A8A;
}

/* =============================================
   Boton generar PDF - CTA principal
   ============================================= */
.btn-generar-pdf {
    background-color: var(--accent-green);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.85rem 2.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.3);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-generar-pdf:hover {
    background-color: var(--accent-green-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(21, 128, 61, 0.4);
    color: white;
}

.btn-generar-pdf:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* =============================================
   Breadcrumb documento
   ============================================= */
.doc-breadcrumb {
    background: transparent;
    padding: 0.75rem 0;
}

.doc-breadcrumb .breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.doc-breadcrumb .breadcrumb-item.active {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =============================================
   Info documento (fallback / deprecated)
   ============================================= */
.doc-info-header {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-subtle) 100%);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.doc-info-header h1 {
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.doc-info-header p {
    color: var(--text-muted);
    margin-bottom: 0;
}

/* =============================================
   Pasos del proceso
   ============================================= */
.steps-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
}

.step-item + .step-item::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 2px;
    background: var(--border-color);
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.step-item.active + .step-item::before,
.step-item.completed + .step-item::before {
    background: var(--primary-color);
}

.step-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

.step-item.completed {
    color: var(--accent-green);
}

.step-item .step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    color: var(--text-light);
}

.step-item.active .step-number {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.3);
}

.step-item.completed .step-number {
    background: var(--accent-green);
    color: white;
}

/* =============================================
   Alertas personalizadas
   ============================================= */
.alert-validation {
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--danger);
}

.alert-validation ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 991px) {
    .form-generador {
        padding-bottom: 5rem;
    }
}

@media (max-width: 768px) {
    .doc-authority-section {
        padding: 2rem 1.5rem;
    }

    .doc-authority-section h1 {
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .form-generador {
        padding: 1.25rem;
        padding-bottom: 5rem;
    }

    .doc-authority-section {
        padding: 1.5rem 1.25rem;
    }

    .doc-authority-section h1 {
        font-size: 1.15rem;
    }

    .doc-authority-meta {
        gap: 0.75rem;
    }

    .step-item span:not(.step-number) {
        font-size: 0.78rem;
    }

    .step-item + .step-item::before {
        width: 16px;
    }

    .steps-indicator {
        padding: 0.75rem 1rem;
    }

    .btn-generar-pdf {
        width: 100%;
        justify-content: center;
        padding: 0.85rem 1.5rem;
    }

    .security-message {
        padding: 0.85rem 1rem;
    }
}
