/* Estilos para el Generador de Testamentos */

#testamento-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#testamento-form-container h3 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.testamento-form-group {
    margin-bottom: 25px;
}

.testamento-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.testamento-form-group label .required {
    color: #e74c3c;
    font-weight: bold;
}

.testamento-form-group input[type="text"],
.testamento-form-group select,
.testamento-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #ffffff;
    box-sizing: border-box;
}

.testamento-form-group input[type="text"]:focus,
.testamento-form-group select:focus,
.testamento-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.testamento-form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.testamento-form-group textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.testamento-form-group textarea#herencia_texto {
    min-height: 120px;
}

.testamento-form-submit {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #ecf0f1;
}

#generate-testamento-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

#generate-testamento-btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

#generate-testamento-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(52, 152, 219, 0.3);
}

#generate-testamento-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#testamento-loading {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-top: 20px;
}

#testamento-loading p {
    margin: 0;
    font-size: 16px;
    color: #6c757d;
    font-style: italic;
}

/* Animación de carga */
#testamento-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensajes de error y éxito */
.testamento-message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 6px;
    font-weight: 500;
}

.testamento-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.testamento-message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Validación visual */
.testamento-form-group input.error,
.testamento-form-group select.error,
.testamento-form-group textarea.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.testamento-form-group input.valid,
.testamento-form-group select.valid,
.testamento-form-group textarea.valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    #testamento-form-container {
        margin: 10px;
        padding: 20px;
    }
    
    #testamento-form-container h3 {
        font-size: 20px;
    }
    
    .testamento-form-group input[type="text"],
    .testamento-form-group select,
    .testamento-form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    #generate-testamento-btn {
        width: 100%;
        padding: 18px 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #testamento-form-container {
        margin: 5px;
        padding: 15px;
    }
    
    .testamento-form-group {
        margin-bottom: 20px;
    }
    
    .testamento-form-group label {
        font-size: 13px;
    }
}

/* Mejoras de accesibilidad */
.testamento-form-group input:focus,
.testamento-form-group select:focus,
.testamento-form-group textarea:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Estilo para campos de solo lectura */
.testamento-form-group input[readonly] {
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Tooltips informativos */
.testamento-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    color: #3498db;
    cursor: help;
}

.testamento-tooltip::before {
    content: '?';
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    text-align: center;
    font-size: 11px;
    line-height: 16px;
    font-weight: bold;
}

.testamento-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #34495e;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
}

.testamento-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Estilos para impresión */
@media print {
    #testamento-form-container {
        box-shadow: none;
        border: none;
        background: transparent;
    }
    
    #generate-testamento-btn {
        display: none;
    }
}