/* General styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Navbar styles */
.navbar {
    background-color: #ffffff;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-brand {
    font-size: 1.5em;
    font-weight: 700;
    color: #333;
    text-decoration: none;
}
.nav-links { display: flex; gap: 15px; }
.nav-links button, .nav-links a {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1em;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.3s ease;
}
.nav-links button:hover, .nav-links a:hover { color: #007bff; }
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1;
}
.dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; }
.dropdown-content a:hover { background-color: #f1f1f1; }
.dropdown:hover .dropdown-content { display: block; }

/* Page content styles */
.page-title {
    color: #004d99;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.content-section {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}
.section-title { font-size: 1.2em; font-weight: 500; color: #555; margin-top: 0; }

/* Form styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding-bottom: 20px;
}
.form-group { position: relative; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    background-color: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #007bff;
    outline: none;
}
.form-group label {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #999;
    font-size: 14px;
    transition: all 0.3s ease;
    pointer-events: none;
    background-color: #ffffff;
    padding: 0 5px;
}
.form-group input:focus + label, .form-group input:not(:placeholder-shown) + label,
.form-group select:focus + label, .form-group select:valid + label,
.form-group textarea:focus + label, .form-group textarea:not(:placeholder-shown) + label {
    top: -10px;
    left: 5px;
    font-size: 12px;
    color: #007bff;
}
.form-group select {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23999%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: .65em auto;
}
.form-buttons { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }

/* Button styles */
.btn { padding: 10px 20px; border-radius: 4px; border: none; cursor: pointer; font-weight: 500; transition: background-color 0.3s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background-color: #007bff; color: white; }
.btn-primary:hover { background-color: #0056b3; }
.btn-secondary { background-color: #6c757d; color: white; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-danger { background-color: #dc3545; color: white; }
.btn-danger:hover { background-color: #c82333; }

/* Table styles */
.table-container { padding-top: 20px; }
.table-search-header { margin-bottom: 15px; }
#searchInput { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; box-sizing: border-box; }
.table-responsive table { width: 100%; border-collapse: collapse; font-family: 'Poppins', sans-serif; }
.table-responsive table th, .table-responsive table td { padding: 12px 10px; border-bottom: 1px solid #e9ecef; text-align: left; font-size: 14px; word-wrap: break-word; }
.table-responsive table thead { background-color: #e0f7fa; color: #004d99; }
.table-responsive table thead th { font-weight: 500; text-transform: capitalize; letter-spacing: 0.5px; text-align: left; font-size: 13px; vertical-align: middle; }
.table-responsive table tbody tr:nth-child(even) { background-color: #f8f9fa; }
.table-responsive table tbody tr:hover { background-color: #e9ecef; cursor: pointer; }

/*
 * ===================================================================
 * AJUSTE DE ALINEACIÓN DE BOTONES
 * ===================================================================
 */

/* 1. Estilos para la cabecera de la última columna */
.table-responsive table th:last-child {
    width: 100px;
    text-align: center;
    vertical-align: middle;
}

/* 2. Estilos para la celda de acciones (usando Flexbox) */
.table-responsive table td:last-child {
    width: 100px;
    text-align: center;
    /* --- INICIO DE LA CORRECCIÓN --- */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px; /* Añade un espacio limpio entre botones */
    /* --- FIN DE LA CORRECCIÓN --- */
}

/* 3. Estilos para los botones (eliminamos el margen) */
.btn-action { 
    background: transparent; 
    border: none; 
    color: #555; 
    padding: 5px; 
    cursor: pointer; 
    font-size: 1.1em; 
    /* margin: 0 2px; <-- Eliminamos esto */
    transition: color 0.3s ease, transform 0.2s ease; 
}
/* ===================================================================
 * FIN DEL AJUSTE
 * ===================================================================
 */

.btn-action:hover { transform: scale(1.1); }
.btn-action.edit-btn:hover { color: #007bff; }
.btn-action.delete-btn:hover { color: #dc3545; }
.btn-action[title]:hover::after { content: attr(title); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); white-space: nowrap; background-color: #333; color: #fff; padding: 5px 8px; border-radius: 4px; font-size: 0.75em; z-index: 1001; }

/* Modal styles */
.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);
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: none;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.close-button { color: #aaa; position: absolute; top: 10px; right: 15px; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-button:hover, .close-button:focus { color: black; }
.modal-confirm-content { text-align: center; }
.modal-confirm-content .btn-group { margin-top: 20px; display: flex; justify-content: center; gap: 10px; }

/* Pacientes Module Specific Styles */
.sub-form-section { grid-column: 1 / -1; border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px; margin-top: 10px; background-color: #f8f9fa; }
.sub-form-section legend { font-weight: 600; color: #004d99; padding: 0 10px; }
.input-group-inline { display: flex; gap: 10px; align-items: flex-start; }
.input-group-inline .form-group { flex: 1; }
.input-group-inline .form-group-currency { flex: 0 0 120px; }
.file-list-container { margin-top: 10px; padding: 10px; border: 1px solid #eee; border-radius: 5px; min-height: 40px; }
.file-item { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 14px; }
.file-item a { color: #007bff; text-decoration: none; }
.file-item a:hover { text-decoration: underline; }
progress { width: 100px; height: 10px; }
.status-abierto { color: #28a745; font-weight: 600; }
.status-cerrado { font-weight: 600; }

/* Utility classes */
.full-width { grid-column: 1 / -1; }

/* Estilos para el modal de detalle del paciente */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
    text-align: left;
}
.detail-grid div {
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}
.detail-grid div.full-width {
    grid-column: 1 / -1;
}
.detail-grid strong {
    font-weight: 500;
    color: #555;
    display: block;
    font-size: 0.8em;
    text-transform: uppercase;
}
.detail-grid p {
    margin: 2px 0 0 0;
    font-size: 1em;
}
.detail-grid hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
    grid-column: 1 / -1;
}
.detail-grid h4 {
    grid-column: 1 / -1;
    margin: 10px 0 5px 0;
    color: #004d99;
}
.detail-grid ul {
    grid-column: 1 / -1;
    margin: 0;
    padding-left: 20px;
    list-style: none;
}
.detail-grid ul li a {
    text-decoration: none;
    color: #007bff;
}
.detail-grid ul li a:hover {
    text-decoration: underline;
}

/* Styles for input fields with a button next to them */
.input-with-button {
    display: flex;
    align-items: center; /* Vertically align input and button */
    gap: 5px; /* Small space between input and button */
    position: relative; /* Needed for the label positioning */
}

.input-with-button input {
    flex-grow: 1; /* Input takes up available space */
    width: auto; /* Override default width */
}

/* Style for the small icon button */
.btn-icon {
    background: none;
    border: none;
    color: #6c757d; /* Secondary color */
    padding: 8px; /* Adjust padding to align vertically with input text */
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    transition: color 0.3s ease;
}

.btn-icon:hover {
    color: #007bff; /* Primary color on hover (Or #FF9800 if using orange theme) */
}

/* Adjust label positioning when next to a button */
.input-with-button label {
    /* Keep the floating label behavior */
    position: absolute;
    top: 10px;
    left: 10px;
    /* ... rest of your existing label styles ... */
}
.input-with-button input:focus + label,
.input-with-button input:not(:placeholder-shown) + label {
    top: -10px;
    /* ... rest of your existing floating label styles ... */
}