.termo-protese-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

/* Estilos para a seleção de UBS */
.ubs-selection-section {
    display: block;
}

.ubs-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eaeaea;
}

.ubs-header h2 {
    color: #2c3e50;
    margin: 20px 0 10px 0;
    font-size: 28px;
    font-weight: 600;
}

.ubs-header p {
    color: #7f8c8d;
    margin: 0;
    font-size: 16px;
}

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

.logo {
    max-width: 350px;
    height: 90px !important;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px auto;
}

#ubs-search-protese {
    width: 100%;
    padding: 15px 45px 15px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    box-sizing: border-box;
}

#ubs-search-protese:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #7f8c8d;
}

.ubs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.ubs-card {
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    padding: 30px 20px 20px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ubs-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.ubs-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.ubs-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

/* Estilos para o formulário do termo */
.termo-form-container {
    display: none;
}

.termo-header-with-logo {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eaeaea;
}

.termo-header-content {
    flex: 1;
    margin-left: 30px;
}

.termo-header-content h2 {
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
}

.ubs-name-display {
    color: #3498db;
    font-weight: 600;
    font-size: 18px;
    margin: 0 0 15px 0;
}

.back-button {
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.back-button:hover {
    background: #7f8c8d;
}

.form-content-with-logo {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.form-section {
    flex: 1;
    min-width: 300px;
}

.termo-preview-section {
    flex: 2;
    min-width: 300px;
}

.form-section, .termo-preview-section, .signature-section {
    padding: 25px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #eaeaea;
}

.form-section h3, .termo-preview-section h3, .signature-section h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    font-size: 20px;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
    text-align: left;
}

.termo-input-protese {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    box-sizing: border-box;
    background: #fff;
}

.termo-input-protese:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.validation-message {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    min-height: 18px;
}

.validation-message.valid {
    color: #27ae60;
    text-align: left;
}

.validation-message.invalid {
    color: #e74c3c;
    text-align: left;
}

.termo-content {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    line-height: 1.6;
    font-size: 15px;
    color: #333;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
}

.termo-content h4 {
    text-align: center;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
}

.preview-field {
    border-bottom: 2px dashed #3498db;
    padding: 0 5px;
    min-width: 50px;
    display: inline-block;
    min-height: 22px;
    background-color: #f1f9ff;
    border-radius: 3px;
}

.signature-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.signature-box {
    text-align: center;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #eaeaea;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.signature-box p {
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 15px;
}

.signature-container {
    position: relative;
    margin: 0 auto;
    width: 100%;
    max-width: 400px;
    height: 150px;
    overflow: hidden;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #fff;
}

.signature-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.clear-signature {
    margin-top: 15px;
    padding: 10px 18px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.clear-signature:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.termo-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
}

.pdf-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 32px;
    background: linear-gradient(135deg, #27ae60 0%, #219653 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    min-width: 200px;
}

.pdf-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.pdf-button:disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-icon {
    margin-right: 10px;
    font-size: 20px;
}

/* Responsividade */
@media (max-width: 968px) {
    .form-content-with-logo {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .termo-protese-container {
        padding: 15px;
    }
    
    .termo-header-with-logo {
        flex-direction: column;
        text-align: center;
    }
    
    .termo-header-content {
        margin-left: 0;
        margin-top: 20px;
    }
    
    .form-section, .termo-preview-section, .signature-section {
        padding: 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .ubs-grid {
        grid-template-columns: 1fr;
    }
    
    .signature-area {
        grid-template-columns: 1fr;
    }
    
    .signature-container {
        height: 120px;
    }
    
    .termo-content {
        padding: 20px;
        font-size: 14px;
    }
}

/* Animações */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.ubs-card, .form-section, .termo-preview-section, .signature-section {
    animation: fadeIn 0.5s ease-out;
}