/* Specific styles for Citas */
body {
    background: #f0f2f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-bottom: 80px; /* Space for bottom navigation */
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* Header Section */
.citas-header {
    background: #ffffff;
    padding: 1rem 1.5rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 100;
    margin: -1rem -1.5rem 1rem -1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.citas-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2d5a3d;
    margin: 0;
    text-align: center;
    padding: 0 3rem; /* Space for buttons */
}

.back-button {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #2d5a3d;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    z-index: 101;
}

.back-button:hover {
    background-color: #f3f4f6;
}

.agendar-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #39a452 0%, #28b1489c 100%);
    border: none;
    border-radius: 50px;
    padding: 0.4rem 0.8rem;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
    white-space: nowrap;
    z-index: 101;
}

.agendar-button:hover {
    background: linear-gradient(135deg, #39a452 0%, #28b14893 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
    color: #ffffff;
    text-decoration: none;
}

/* Section Title */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d5a3d;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

/* Card Styles - Modern WhatsApp inspired */
.card-cita {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.card-cita:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-cita h5 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1c1c1e;
    margin-bottom: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-cita p {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-cita i {
    color: #007aff;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Contenedor para la fila de fecha y hora */
.card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Los párrafos dentro de esta fila no necesitan margen inferior */
.card-meta-row p {
    margin-bottom: 0;
}


/* Nueva clase para la fila de fecha y hora */
.card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Los párrafos dentro de esta fila no necesitan margen inferior */
.card-meta-row p {
    margin-bottom: 0.5rem; 
}


/* Responsable Section */
.responsable-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 12px;
    flex-wrap: wrap;
}

.responsable-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.responsable-name {
    font-weight: 500;
    color: #374151;
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Badge Styles - Asistencia */
.badge-asistencia {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.badge-asistencia.asistio {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%);
    color: #ffffff;
}

.badge-asistencia.no-asistio {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
    color: #ffffff;
}

.badge-asistencia.no-registrado {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #000000;
}

/* Popup para seleccionar asistencia */
.asistencia-popup {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    min-width: 180px;
}

.asistencia-option {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    color: #333;
}

.asistencia-option:hover {
    background-color: #f0f0f0;
}

.asistencia-option:first-child {
    border-radius: 8px 8px 0 0;
}

.asistencia-option:last-child {
    border-radius: 0 0 8px 8px;
}

/* Cancel Button */
.cancel-button {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.cancel-button:hover {
    background: #fef2f2;
    color: #b91c1c;
}

/* Alert Styles */
.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #2196f3;
    border-radius: 12px;
    color: #0d47a1;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Loading and Empty States */
.loading-container {
    text-align: center;
    padding: 3rem 1rem;
}

.spinner-border {
    color: #007aff;
    width: 2rem;
    height: 2rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
    font-size: 0.95rem;
}

.error-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #dc3545;
    font-size: 0.95rem;
}

/* Responsive adjustments - Consistent with style_main.css */
@media (min-width: 768px) {
    .container {
        max-width: 480px;
        margin: 0 auto;
    }
    
    .card-cita {
        padding: 1.75rem;
    }
    
    .citas-title {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .agendar-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 520px;
    }
    
    .card-cita {
        padding: 2rem;
    }
}

/* Mobile adjustments - Consistent with style_main.css */
@media (max-width: 767px) {
    body {
        overflow-x: hidden;
    }
    
    .container {
        padding: 0.5rem 0.75rem;
        width: 100%;
        max-width: 100%;
    }
    
    .citas-header {
        padding: 0.75rem 0.75rem 0.5rem;
        margin: -0.5rem -0.75rem 1rem -0.75rem;
        width: 100%;
    }
    
    .citas-title {
        font-size: 1.1rem;
        padding: 0 2.5rem;
    }
    
    .back-button {
        left: 0.25rem;
        font-size: 1.1rem;
        padding: 0.4rem;
    }
    
    .agendar-button {
        right: 0.25rem;
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
        gap: 0.2rem;
    }
    
    .card-cita {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .card-cita h5 {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .card-cita p {
        font-size: 0.8rem;
        gap: 0.3rem;
    }
    
    .section-title {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .responsable-section {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .responsable-avatar {
        width: 32px;
        height: 32px;
    }
    
    .responsable-name {
        font-size: 0.85rem;
    }
    
    .badge-estado {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    .cancel-button {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    
    .alert-info {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem 0.5rem;
    }
    
    .citas-header {
        padding: 0.5rem 0.5rem 0.25rem;
        margin: -0.5rem -0.5rem 1rem -0.5rem;
    }
    
    .citas-title {
        font-size: 1rem;
        padding: 0 2rem;
    }
    
    .agendar-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .card-cita {
        padding: 0.5rem;
    }
    
    .card-cita h5 {
        font-size: 0.9rem;
    }
    
    .card-cita p {
        font-size: 0.75rem;
    }
    
    .responsable-avatar {
        width: 28px;
        height: 28px;
    }
    
    .responsable-name {
        font-size: 0.8rem;
    }
    
    .badge-estado {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
    }
}

/* --- Status Popup --- */
.status-popup {
  position: absolute;
  background-color: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  padding: 0.5rem 0;
  min-width: 160px;
}

.status-option {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  display: block;
  text-align: left;
  width: 100%;
  border: none;
  background: none;
  font-size: 0.9rem;
  color: #333;
  transition: background-color 0.2s ease;
}

.status-option:hover {
  background-color: #f5f5f5;
}

/* Make the badge clickable for responsible users */
.badge-estado[data-responsable-id] {
    cursor: pointer;
}


@media (max-width: 767px) {
  .status-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    max-width: 320px;
  }
}