/* ========================================
   ESTILOS GENERALES
   ======================================== */
body {
    background-color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.875rem;
}

.main-content {
    min-height: calc(100vh - 140px);
}

/* ========================================
   CALENDARIO
   ======================================== */
.calendar-container {
    margin-bottom: 10px;
}

.calendar-table {
    table-layout: fixed;
    font-size: 0.75rem;
}

.calendar-table th {
    text-align: center;
    font-weight: bold;
    background-color: #e9ecef;
    padding: 0.25rem;
}

.calendar-day {
    height: 30px;
    text-align: center;
    cursor: pointer;
    position: relative;
    padding: 2px;
    font-size: 0.75rem;
}

.calendar-day:hover {
    background-color: #e9ecef;
}

.calendar-day.selected-day {
    background-color: #90EE90;
    color: black;
    font-weight: bold;
}

.calendar-day.has-events {
    font-weight: bold;
}

.event-count {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
}

td.empty {
    background-color: #f8f9fa;
}

/* ========================================
   FORMULARIOS
   ======================================== */
.form-control, .form-select {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    height: calc(1.5em + 0.5rem + 2px);
}

.form-label {
    font-weight: 500;
    font-size: 0.800rem;
    margin-bottom: 0.25rem;
}

.form-check-label {
    cursor: pointer;
}

.form-text.text-muted {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.input-group-text {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Estados de validación */
.was-validated .form-control:valid,
.was-validated .form-select:valid {
    border-color: #198754;
    background-image: none;
}

.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
    border-color: #dc3545;
    background-image: none;
}

/* ========================================
   BOTONES
   ======================================== */
.btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-group .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Botones de ordenación */
.sort-btn {
    transition: all 0.2s ease;
    position: relative;
}

.sort-btn.active {
    background-color: #0d6efd;
    color: white;
    z-index: 1;
}

.sort-btn:hover {
    z-index: 2;
}

#order-info {
    font-style: italic;
    color: #6c757d;
}

/* ========================================
   TABLAS
   ======================================== */
.table {
    font-size: 0.825rem;
    margin-bottom: 0.5rem;
}

.table th, .table td {
    padding: 0.35rem;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Tabla de pacientes */
#patientsTable {
    table-layout: fixed !important;
    width: 100%;
}

#patientsTable th:nth-child(1),
#patientsTable td:nth-child(1) {
    width: 15%; /* Apellido */
    min-width: 120px;
}

#patientsTable th:nth-child(2),
#patientsTable td:nth-child(2) {
    width: 15%; /* Nombre */
    min-width: 120px;
}

#patientsTable th:nth-child(3),
#patientsTable td:nth-child(3) {
    width: 20%; /* Patología */
    min-width: 150px;
}

#patientsTable th:nth-child(4),
#patientsTable td:nth-child(4) {
    width: 12%; /* Sanatorio */
    min-width: 100px;
}

#patientsTable th:nth-child(5),
#patientsTable td:nth-child(5) {
    width: 10%; /* Prepaga */
    min-width: 80px;
}

#patientsTable th:nth-child(6),
#patientsTable td:nth-child(6) {
    width: 10%; /* Fecha */
    min-width: 90px;
}

#patientsTable th:nth-child(7),
#patientsTable td:nth-child(7) {
    width: 8%; /* Horario */
    min-width: 70px;
}

#patientsTable th:nth-child(8),
#patientsTable td:nth-child(8) {
    width: 15%; /* Cirujanos */
    min-width: 120px;
}

/* Filas de pacientes clickeables - SIN desalineación */
.patient-row {
    cursor: pointer !important;
    transition: background-color 0.2s ease;
}

.patient-row:hover {
    background-color: rgba(0, 123, 255, 0.1) !important;
}

.patient-row:active {
    background-color: rgba(0, 123, 255, 0.15) !important;
}

/* Indicador de que es clickeable - solo en hover */
.patient-row:hover td:last-child::after {
    content: ' ✏️';
    opacity: 0.6;
    font-size: 14px;
    margin-left: 8px;
}

/* ========================================
   TARJETAS (CARDS)
   ======================================== */
.card {
    margin-bottom: 0.75rem;
}

.card-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.925rem;
}

.card-body {
    padding: 0.75rem;
}

.card-header.bg-primary,
.card-header.bg-secondary,
.card-header.bg-success {
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

/* Tarjetas de servicios en la nube */
.cloud-card {
    border-radius: 8px;
    transition: all 0.3s ease;
}

.cloud-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

/* ========================================
   NAVEGACIÓN Y PAGINACIÓN
   ======================================== */
.pagination {
    font-size: 0.825rem;
}

.pagination .page-link {
    padding: 0.25rem 0.5rem;
}

/* Navbar improvements */
.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.navbar .dropdown-header {
    color: #6c757d;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.navbar .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.navbar .dropdown-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: #0d6efd;
}

.navbar .dropdown-item i {
    width: 1.2rem;
    margin-right: 0.5rem;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: rgba(0, 0, 0, 0.1);
}

/* ========================================
   ALERTAS
   ======================================== */
.alert {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.alert-info {
    border-left: 4px solid #0dcaf0;
}

.alert-info .alert-heading {
    color: #0c5460;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.alert-info ul {
    margin-left: 1rem;
}

.alert-info ul li {
    margin-bottom: 0.25rem;
}

/* ========================================
   PESTAÑAS (TABS)
   ======================================== */
.nav-tabs .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* ========================================
   BADGES Y ELEMENTOS ESPECIALES
   ======================================== */
.badge {
    font-size: 0.75em;
    padding: 0.375rem 0.5rem;
}

[data-bs-toggle="tooltip"] {
    cursor: help;
}

/* Iconos para servicios de nube */
.bi-google {
    color: #4285F4;
}

.bi-microsoft {
    color: #0078D4;
}

/* ========================================
   MULTIMEDIA Y GALERÍA
   ======================================== */
.embed-responsive {
    position: relative;
    overflow: hidden;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.embed-responsive iframe {
    border: 0;
    width: 100%;
}

/* Galería de imágenes */
#patient-images-gallery .image-card {
    height: 100%;
    transition: all 0.3s ease;
}

#patient-images-gallery .image-card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#patient-images-gallery .card-img-top {
    width: 100%;
    object-fit: contain;
    max-height: 180px;
    min-height: 100px;
}

#patient-images-gallery .card-body {
    padding: 0.5rem;
    background-color: #f8f9fa;
}

#patient-images-gallery a {
    display: block;
    overflow: hidden;
}

#patient-images-gallery a img {
    transition: transform 0.3s ease;
}

#patient-images-gallery a:hover img {
    transform: scale(1.05);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    margin-top: 1rem;
    padding: 0.5rem;
    font-size: 0.825rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 767.98px) {
    body {
        font-size: 0.8rem;
    }
    
    .table-responsive {
        font-size: 0.75rem;
    }
    
    .form-control, .form-select {
        font-size: 0.8rem;
    }
    
    /* En dispositivos móviles, hacer el icono más visible */
    .patient-row:hover td:last-child::after {
        opacity: 0.8;
    }
    
    /* Botones responsive */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
        border-radius: 0.375rem !important;
    }
    
    /* Tabla responsive */
    #patientsTable {
        table-layout: auto !important;
    }
    
    #patientsTable th,
    #patientsTable td {
        width: auto !important;
        min-width: 60px !important;
        font-size: 0.75rem;
    }
}
/* ========================================
   CIRUGÍAS CANCELADAS - AGREGAR AL FINAL DEL CSS EXISTENTE
   ======================================== */

/* Fila con fondo rojizo para cirugías canceladas */
.cancelled-surgery {
    background-color: #ffe6e6 !important;
    border-left: 4px solid #dc3545 !important;
}

.cancelled-surgery:hover {
    background-color: #ffcccc !important;
}

/* Badge para indicar cirugía cancelada */
.badge-cancelled {
    background-color: #dc3545;
    color: white;
    font-size: 0.7em;
    padding: 0.25em 0.5em;
    border-radius: 0.375rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Responsive para móviles */
@media (max-width: 767.98px) {
    .badge-cancelled {
        font-size: 0.6em;
        padding: 0.2em 0.4em;
    }
}