:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --success-color: #2ecc71;
    --pami-blue: #0077c8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 20px;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

.app-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.form-section,
.preview-section {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.section-title {
    color: var(--primary-color);
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

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

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark-color);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.medication-item {
    background-color: var(--light-color);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid var(--secondary-color);
}

.medication-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.remove-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- TABS --- */
.tabs {
    overflow: hidden;
    border-bottom: 1px solid #ccc;
    margin-bottom: 15px;
}

.tab-link {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 1rem;
    border-radius: 8px 8px 0 0;
}

.tab-link:hover {
    background-color: #ddd;
}

.tab-link.active {
    background-color: var(--secondary-color);
    color: white;
}

.tab-content {
    padding: 10px 0;
    animation: fadeEffect 0.5s;
}

@keyframes fadeEffect {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- Estilos Receta Estándar (Original) --- */
.receta-estandar-preview {
    border: 1px solid #ddd;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: white;
}

.receta-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.paciente-info {
    margin-bottom: 15px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    background-color: #f5f5f5;
}

.medicamento-section {
    margin: 20px 0;
    padding: 10px;
}

/* --- Estilos Nueva Receta PAMI --- */
#receta-pami-container {
    border: 2px solid black;
    padding: 10px;
    font-family: 'Arial', sans-serif;
    font-size: 0.8rem;
    background-color: white;
}

.pami-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 5px;
    border-bottom: 2px solid black;
}

.pami-logo {
    font-weight: bold;
    font-size: 1.5rem;
}

.pami-logo span {
    color: var(--pami-blue);
}

.pami-info-box {
    border: 1px solid black;
    padding: 2px 5px;
    text-align: center;
}

.pami-field {
    border-bottom: 1px solid black;
    margin-top: 10px;
    padding-bottom: 2px;
}

.pami-field label {
    font-size: 0.7rem;
    font-weight: normal;
    color: black;
    margin: 0;
}

.pami-field span {
    font-weight: bold;
    display: block;
    min-height: 1.2em;
}

.pami-field-group {
    display: flex;
    gap: 20px;
}

.pami-field-group .pami-field {
    flex: 1;
}

.pami-medicamentos {
    margin-top: 15px;
}

.pami-medicamentos>label {
    font-size: 0.7rem;
}

.pami-med-row {
    display: flex;
    align-items: flex-end;
    border-bottom: 1px solid black;
    margin-top: 5px;
    padding-bottom: 5px;
    height: 50px;
}

.pami-med-row span:first-child {
    font-weight: bold;
    margin-right: 10px;
}

.pami-med-row div {
    flex: 1;
    align-self: flex-start;
    padding-top: 5px;
}

.pami-med-row span:last-child {
    font-size: 0.7rem;
    margin-left: 10px;
    border-bottom: 1px solid black;
    width: 60px;
    text-align: center;
}

.pami-footer {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.pami-qr-firma {
    flex: 2;
    display: flex;
    border: 1px solid black;
}

.pami-qr-code {
    padding: 5px;
    border-right: 1px solid black;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pami-qr-code canvas,
.pami-qr-code img {
    max-width: 80px;
    max-height: 80px;
}


.pami-firma {
    flex: 1;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pami-firma label {
    font-size: 0.7rem;
    text-align: center;
    border-bottom: 1px solid black;
}

#pami-firma-img {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pami-firma-img img {
    max-width: 100%;
    max-height: 50px;
}

#pami-profesional-info {
    font-size: 0.7rem;
    text-align: center;
    font-weight: bold;
}

.pami-diagnostico-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pami-diagnostico {
    border: 1px solid black;
    flex: 1;
    padding: 5px;
}

.pami-diagnostico label {
    font-size: 0.7rem;
}

.pami-diagnostico span {
    font-weight: bold;
    display: block;
    min-height: 1.2em;
}

.pami-legal {
    font-size: 0.6rem;
    text-align: center;
    margin-top: 10px;
}


/* --- OTROS --- */
.firma-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    margin-bottom: 10px;
}

#firma-canvas {
    width: 100%;
    height: 150px;
    cursor: crosshair;
}

.firma-placeholder {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.instructions {
    background-color: #e8f4fc;
    padding: 20px;
    border-radius: 8px;
    margin-top: 30px;
}

.instructions h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.instructions ol {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
}

.footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    color: #7f8c8d;
    font-size: 0.9rem;
}

@media print {
    body * {
        visibility: hidden;
    }

    .tab-content.active,
    .tab-content.active * {
        visibility: visible;
    }

    .tab-content.active {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none;
        box-shadow: none;
    }

    .btn,
    .form-section,
    header,
    .instructions,
    .footer,
    .preview-section .section-title,
    #imprimir-receta,
    .tabs {
        display: none;
    }
}