/**
 * Estilos del Frontend - Certificados Digitales
 */

/* ========================================
   VARIABLES CSS - COLORES PERSONALIZABLES
   ======================================== */
:root {
    --certificados-color-primario: #2271b1;
    --certificados-color-hover: #135e96;
    --certificados-color-exito: #00a32a;
    --certificados-color-error: #d63638;
    --certificados-color-primario-light: rgba(34, 113, 177, 0.1);
    --certificados-color-primario-dark: #135e96;
}

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */
.certificados-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ========================================
   HEADER
   ======================================== */
.certificados-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8e8e8;
}

.certificados-header h2 {
    font-size: 32px;
    color: #2c3e50;
    margin: 0 0 12px 0;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.certificados-descripcion {
    font-size: 16px;
    color: #7f8c8d;
    margin: 0;
    line-height: 1.6;
}

/* ========================================
   PESTAÑAS DE NAVEGACIÓN
   ======================================== */
.certificados-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e8e8e8;
    flex-wrap: wrap;
    justify-content: center;
}

.certificados-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #7f8c8d;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.certificados-tab:hover {
    color: var(--certificados-color-primario, #3498db);
    background: var(--certificados-color-primario-light, rgba(52, 152, 219, 0.05));
}

.certificados-tab.active {
    color: var(--certificados-color-primario, #3498db);
    border-bottom-color: var(--certificados-color-primario, #3498db);
    font-weight: 600;
}

/* ========================================
   CONTENIDO DE PESTAÑAS
   ======================================== */
.certificados-tabs-content {
    position: relative;
}

.certificados-tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.certificados-tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   FORMULARIO
   ======================================== */
.certificados-form-container {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    max-width: 900px;
    margin: 0 auto;
}

.certificados-subtitulo {
    font-size: 16px;
    color: #556273;
    margin: 0 0 20px 0;
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.6px;
}

.certificados-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #34495e;
}

.certificados-input {
    padding: 20px;
    border: 2px solid #dcdde1;
    border-radius: 8px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
}

.certificados-input:focus {
    outline: none;
    border-color: var(--certificados-color-primario, #3498db);
    box-shadow: 0 0 0 4px var(--certificados-color-primario-light, rgba(52, 152, 219, 0.15));
    transform: scale(1.01);
}

.certificados-input::placeholder {
    color: #95a5a6;
    font-weight: 400;
    letter-spacing: 1px;
}

.certificados-btn-buscar {
    padding: 14px 28px;
    background: var(--certificados-color-primario, #3498db);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    max-width: 350px;
    margin: 0 auto;
    display: block;
    width: 100%;
}

.certificados-btn-buscar:hover {
    background: var(--certificados-color-hover, #2980b9);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.certificados-btn-buscar:active {
    transform: translateY(0);
    background: var(--certificados-color-primario-dark, #2574a9);
}

.certificados-btn-buscar:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========================================
   RESULTADOS
   ======================================== */
.certificados-result {
    padding: 40px 50px;
    border-radius: 8px;
    animation: slideDown 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-success {
    background: #d4edda;
    border: 2px solid #c3e6cb;
    color: #155724;
    border-radius: 8px;
    max-width: 350px;
    flex-direction: column;
    gap: 20px;
}

.result-error {
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    color: #721c24;
    border-radius: 8px;
    flex-direction: column;
    gap: 20px;
}

.result-message,
.error-message {
    margin: 0;
    font-size: 16px;
    line-height: 1.8;
    word-wrap: break-word;
    white-space: normal;
    font-weight: 500;
    padding: 10px;
}

.result-message strong,
.error-message strong {
    display: block;
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 700;
}

.result-message small,
.error-message small {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-top: 8px;
}

.certificados-btn-download {
    padding: 14px 32px;
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
    white-space: nowrap;
}

.certificados-btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(39, 174, 96, 0.4);
}

/* ========================================
   MODAL DE ENCUESTA
   ======================================== */
.certificados-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #ffffff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 24px;
}

.modal-body p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #34495e;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.certificados-btn-primary,
.certificados-btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    flex: 1;
    min-width: 140px;
}

.certificados-btn-primary {
    background: var(--certificados-color-primario, #3498db);
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.certificados-btn-primary:hover {
    background: var(--certificados-color-hover, #2980b9);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.certificados-btn-secondary {
    background: #ecf0f1;
    color: #34495e;
}

.certificados-btn-secondary:hover {
    background: #bdc3c7;
}

/* ========================================
   MENSAJES DE ERROR
   ======================================== */
.certificados-error {
    padding: 30px 25px;
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    font-size: 15px;
    text-align: center;
    margin: 20px 0;
    line-height: 1.6;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .certificados-container {
        padding: 20px;
        margin: 20px auto;
    }

    .certificados-header h2 {
        font-size: 24px;
    }
    /* En móvil, apilar las pestañas verticalmente */
    .certificados-tabs {
        display: flex;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        margin-bottom: 20px;
        border-bottom: none;
    }

    .certificados-tab {
        white-space: normal;
        width: 100%;
        text-align: center;
        padding: 12px 16px;
        border-radius: 8px;
        background: transparent;
        border-bottom: 3px solid transparent;
    }

    .certificados-tab.active {
        border-bottom-color: transparent;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        background: var(--certificados-color-primario, #3498db);
        color: #ffffff;
        font-weight: 600;
    }

    .certificados-form-container {
        padding: 20px;
    }

    .certificados-result {
        padding: 30px 20px;
        min-height: 180px;
    }

    .result-message,
    .error-message {
        font-size: 14px;
    }

    .result-message strong,
    .error-message strong {
        font-size: 16px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .certificados-btn-primary,
    .certificados-btn-secondary {
        width: 100%;
    }
}

/* ========================================
   MODAL DE VALIDACIÓN
   ======================================== */
.certificados-modal-validacion .modal-content {
    max-width: 600px;
}

.validacion-loading {
    text-align: center;
    padding: 40px 20px;
}

.validacion-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--certificados-color-primario, #3498db);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.validacion-loading p {
    color: #7f8c8d;
    font-size: 16px;
    margin: 0;
}

.validacion-resultado {
    padding: 30px;
    text-align: center;
}

.validacion-exito,
.validacion-error {
    animation: fadeIn 0.3s ease;
}

.validacion-icono {
    font-size: 64px;
    margin-bottom: 20px;
    line-height: 1;
}

.validacion-exito h4 {
    color: #27ae60;
    font-size: 24px;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.validacion-error h4 {
    color: var(--certificados-color-error, #e74c3c);
    font-size: 24px;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.validacion-datos {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    text-align: left;
}

.validacion-datos p {
    margin: 10px 0;
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.6;
}

.validacion-datos strong {
    color: #34495e;
    font-weight: 600;
    display: inline-block;
    min-width: 100px;
}

.validacion-error p {
    color: #7f8c8d;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}