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

body {
    font-family: "Noto Color Emoji", sans-serif;
    background-color: #f8f9fa;
    padding: 20px;
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center; /* centra horizontalmente */
    align-items: center;     /* centra verticalmente */
    box-sizing: border-box;
    min-height: 100vh; 
    max-height: 100%;
    margin: 0;
}

.screen {
    width: 100%; /* Usa un ancho relativo en lugar de fijo */
    max-width: 90%;
    margin: 20px auto;
    background-color: white;
    padding: 5vw; /* Padding relativo para que se ajuste a pantallas pequeñas */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.hidden {
    display: none;
}

/* Pantalla de PIN */
#pin-screen {
    text-align: center;
}

.logo-container {
    margin-bottom: 20px;
}

.logo {
    height: 10rem;
    margin-bottom: 15px;
}

#pin-display {
    font-size: 2rem;
    letter-spacing: 5px;
    margin: 20px 0;
    min-height: 40px;
    color: #2c3e50;
}

.pinpad {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 300px;
    margin: 0 auto;
     justify-content: center;
}

.pin-row {
    display: flex;
    justify-content: center;
    gap: 12px;
   
}

.pin-btn {
    width: 70px;
    height: 70px;
    font-size: 1.5rem;
    border: 2px solid #e0e0e0;
    background-color: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    
}

.pin-btn:hover {
    background-color: #e0e0e0;
    transform: scale(1.05);
}

.clear-btn {
    width: 70px;
    height: 70px;
    font-size: 1rem;
    border: 2px solid #ff6b6b;
    background-color: #ffebee;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background-color: #ffcdd2;
}

/* Pantalla de formulario */
.form-logo{
    text-align: center;
    margin-bottom: 25px;
}

.form-header {
    text-align: center;
    margin-bottom: 25px;
}

.form-header p {
    color: #7f8c8d;
}

.form-columns {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.form-column {
    flex: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border 0.3s;
}
#mtype {
    width: 20%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border 0.3s;
}
#amount{
    width: 78%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.signature-group {
    margin-top: 30px;
}

.signature-container {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

#signature-pad {
    border: 1px solid #ddd;
    background-color: white;
    cursor: crosshair;
    width: 100%;
    height: 300px;
}

.signature-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.signature-instruction {
    color: #7f8c8d;
    font-size: 14px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}

/* Botones */
button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn {
    background-color: #3498db;
    color: white;
}

.primary-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.secondary-btn {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.secondary-btn:hover {
    background-color: #bdc3c7;
}

/* Pantalla de vista previa */
.certificate-logo {
  display: flex;
}

.preview-header-column {
  display: flex;
}

#logo-prestamo-preview {
    width: 13rem;
    height: auto;
}

.preview-header {
    text-align: center;
    margin-bottom: 25px;
}

.preview-header p {
    color: #7f8c8d;
}

/* Estilos específicos para el certificado */
.certificate {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
    border: 1px solid #ddd;
    background-color: white;
}

.certificate-header {
    text-align: center;
    margin-bottom: 15px;
}

.certificate-header h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #000;
}

.contact-info {
    font-size: 14px;
    margin-bottom: 5px;
}

.brand-info {
    font-size: 14px;
    margin-top: 10px;
}

.divider {
    border-top: 1px solid #000;
    margin: 15px 0;
}

.certificate-body h3 {
    text-align: center;
    font-size: 16px;
    margin: 15px 0;
    letter-spacing: 3px;
}

.main-text {
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.dates-section {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 20px;
}

.client-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

.client-table th, .client-table td {
    border: 1px solid #000;
    padding: 8px;
    text-align: center;
}

.client-table th {
    background-color: #f0f0f0;
    font-weight: bold;
}

.totals-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}

.total-row {
    display: flex;
    justify-content: space-between;
}
.signature-row {
    text-align: center;
    font-weight: bold;
}

.total-row .label {
    font-weight: bold;
}

.signature-img {
    max-width: 30%;
    height: 30%;
    border: 1px solid #ddd;
}

.clauses-section {
    font-size: 12px;
    line-height: 1.4;
    margin-top: 20px;
}

.preview-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    padding: 10px 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.whatsapp {
    background-color: #25D366;
    color: white;
}
.enviar {
    background-color: #176433;
    color: white;
}

.email {
    background-color: #4285F4;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .form-columns {
        flex-direction: column;
        gap: 0;
    }
    
    .pin-btn, .clear-btn {
        width: 60px;
        height: 60px;
    }
    
    .preview-actions {
        flex-direction: column;
    }
    
    .share-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .share-btn {
        flex: 1;
        justify-content: center;
    }
}

@media print {
    body * {
        visibility: hidden;
    }
    #certificate-preview, #certificate-preview * {
        visibility: visible;
    }
    #certificate-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
    }
    .preview-actions {
        display: none;
    }
}
/* Mejora para pantallas muy pequeñas */
@media (max-width: 480px) {
    .screen {
        padding: 4vw 3vw;
        border-radius: 6px;
    }
    #logo-prestamo-preview {
        display: none;
    }
    #signature-pad{
        height: 150px;
    }
}