body {
    font-family: Arial, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-width: 95%;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-top: 10px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
}

.header-logo {
    height: 100px;
    width: auto;
}

.header-info {
    height: 80px;
    width: auto;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

input, select, textarea {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#update-btn {
    background-color: #3498db;
    color: white;
}

#update-btn:hover {
    background-color: #2980b9;
}

#export-btn {
    background-color: #2ecc71;
    color: white;
}

#export-btn:hover {
    background-color: #27ae60;
}

#save-btn {
    background-color: #f39c12;
    color: white;
}

#save-btn:hover {
    background-color: #e67e22;
}

.btn-warning {
    background-color: #e74c3c;
    color: white;
}

.btn-warning:hover {
    background-color: #c0392b;
}

.actions-bar {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-success {
    background-color: #2ecc71;
    color: white;
}

/* Fix for Examen buttons in rich text controls to have dark text */
.rich-text-controls .btn-success {
    color: #333;
    border: 1px solid #27ae60;
}

.rich-text-controls .btn-success:hover {
    color: white;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-share {
    background-color: #3498db;
    color: white;
}

.btn-share:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-share:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.btn-delete-selected {
    background-color: #e74c3c;
    color: white;
}

.btn-delete-selected:hover:not(:disabled) {
    background-color: #c0392b;
}

.btn-delete-selected:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.selection-actions {
    display: flex;
    gap: 10px;
}

.saved-rx-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.btn-view {
    background-color: #9b59b6;
    color: white;
}

.btn-view:hover {
    background-color: #8e44ad;
}

.rich-text-controls {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    background: #eee;
    padding: 5px;
    border-radius: 4px 4px 0 0;
    border: 1px solid #ddd;
    border-bottom: none;
    flex-wrap: wrap;
    align-items: center;
}

.receta-field-wrapper {
    margin-bottom: 15px;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 4px;
}

.receta-field-wrapper label {
    font-size: 14px;
    color: #3498db;
}

.format-btn {
    padding: 5px 10px;
    font-size: 14px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    min-width: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-fx {
    background-color: #e67e22;
    color: white;
    border-color: #d35400;
}

/* Login Screen Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f4f7f6;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    height: 120px;
    margin-bottom: 20px;
}

.login-card h2 {
    margin-bottom: 25px;
    color: #2c3e50;
}

.admin-only {
    /* Will be managed by JS */
}

.assistant-only {
    /* Will be managed by JS */
}

.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.status-pendiente {
    background-color: #f39c12;
    color: white;
}

.status-hecho {
    background-color: #2ecc71;
    color: white;
}

.btn-fx:hover {
    background-color: #d35400;
}

.format-btn:hover {
    background: #f0f0f0;
}

#receta {
    border-radius: 0 0 4px 4px;
}

.preview-modal-content {
    max-width: 900px;
    width: 90%;
}

.modal-actions {
    margin-top: 15px;
    display: flex;
    justify-content: center;
}

.close-modal-preview {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal-preview:hover,
.close-modal-preview:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.btn-secondary {
    background-color: #7f8c8d;
    color: white;
}

.btn-secondary:hover {
    background-color: #95a5a6;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.template-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    cursor: pointer;
}

.template-checkbox-item input {
    cursor: pointer;
}

/* Modal Styles */
.patients-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 20px;
}

.patient-item {
    background-color: #fff;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.patient-item:hover {
    background-color: #f9f9f9;
}

.patient-info-dir {
    display: flex;
    flex-direction: column;
}

.patient-name-dir {
    font-weight: bold;
    font-size: 1.1em;
    color: #2c3e50;
}

.patient-meta-dir {
    font-size: 0.9em;
    color: #7f8c8d;
}

.patient-actions-dir {
    display: flex;
    gap: 10px;
}

.btn-select-patient {
    background-color: #2ecc71;
    color: white;
}

.btn-select-patient:hover {
    background-color: #27ae60;
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); 
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 80%; 
    max-width: 800px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-header h2 {
    margin: 0;
}

.search-container {
    flex-grow: 1;
    margin: 0 20px;
}

#search-rx {
    width: 100%;
    box-sizing: border-box;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.saved-rx-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    background: #fdfdfd;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
}

.patient-group {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.patient-header {
    background-color: #f8f9fa;
    padding: 10px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    color: #2c3e50;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.patient-header:hover {
    background-color: #e9ecef;
}

.patient-header::after {
    content: '▼';
    font-size: 0.8em;
    color: #999;
}

.patient-content {
    padding: 5px 0;
}

.saved-rx-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f1f1;
}

.saved-rx-item:last-child {
    border-bottom: none;
}

.saved-rx-item:hover {
    background-color: #fcfcfc;
}

.saved-rx-info {
    flex-grow: 1;
}

.saved-rx-actions button {
    padding: 4px 8px;
    margin-left: 5px;
    font-size: 12px;
}

.btn-load { background-color: #3498db; color: white; }
.btn-delete { background-color: #e74c3c; color: white; }

.multi-results-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
    border: 2px solid #2ecc71;
}

.multi-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.multi-results-list img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preview-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    overflow: auto;
    border: 1px solid #eee;
    padding: 10px;
}

#rx-canvas {
    max-width: 100%;
    height: auto;
}

.calibration {
    grid-template-columns: 1fr;
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}

.coord-group {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.coord-group span {
    margin-left: 15px;
    font-weight: bold;
}