/* COMPACT LAYOUT STYLES */

/* Responsive Grid Utilities (Polyfill para emular Tailwind en vistas con estilos inline) */
.grid { display: grid; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.w-full { width: 100%; box-sizing: border-box; }

@media (min-width: 1024px) {
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr) !important; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 767px) {
  .grid-cols-1 { grid-template-columns: 1fr !important; }
  .hidden-mobile { display: none !important; }
}

/* Metrics Grid legacy support */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Cards */
.metric-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 12px -2px rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.04);
  transition: transform 0.2s;
  height: 100%;
  box-sizing: border-box;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -4px rgba(0,0,0,0.06);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.metric-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.metric-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 1.75rem; font-weight: 800; color: #004d68; line-height: 1.2; }
.metric-sub { color: #2E3338; font-size: 0.8rem; font-weight: 500; margin-top: 0.25rem; }

/* CALENDAR STYLES */
.calendar-container {
  background: white;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 800px; 
}

.calendar-header {
  display: grid;
  /* grid-template-columns set inline in view */
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  z-index: 30;
  position: sticky;
  top: 0;
}

.calendar-col-header:first-child {
  position: sticky;
  left: 0;
  z-index: 31;
  background: white;
}

.calendar-col-header { text-align: center; padding: 12px 4px; border-left: 1px solid #f1f5f9; min-width: 0; overflow: hidden; }
.calendar-col-header.today { background: #eff6ff; }

.calendar-body {
  overflow-y: auto;
  flex: 1;
  position: relative;
  display: grid;
  /* Columns set inline */
  background: 
    repeating-linear-gradient(0deg, transparent, transparent 119px, #f1f5f9 120px),
    repeating-linear-gradient(90deg, transparent, transparent 59px, transparent 60px); 
}

.time-label-col { 
  border-right: 1px solid #f1f5f9; 
  position: sticky; 
  left: 0; 
  z-index: 21; 
  background: white; 
}

.time-label {
  height: 120px; display: flex; align-items: flex-start; justify-content: center;
  font-size: 0.7rem; color: #94a3b8; font-weight: 700;
  transform: translateY(-8px); background: white; padding-top: 4px;
}

.day-col { border-left: 1px solid #f1f5f9; position: relative; } /* height set inline */
.day-col.today { background: rgba(239, 246, 255, 0.3); }

.appt-block {
  position: absolute; 
  box-sizing: border-box; 
  border-radius: 6px; padding: 4px 6px;
  font-size: 0.75rem; overflow: hidden;
  cursor: pointer; z-index: 5;
  background-clip: padding-box;
  border: 2px solid white; 
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  transition: all 0.1s;
}
.appt-block:hover { z-index: 20 !important; transform: scale(1.02); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }

.appt-confirmed { background: #eff6ff; color: #1e40af; border-left: 3px solid #3b82f6; }
.appt-pending { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; border: 1px solid #fcd34d; font-weight: 600; }
.appt-cancelled { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; opacity: 0.7; }

/* Responsive tweaks for calendar on small screens */
@media (max-width: 767px) {
  .calendar-container { height: 600px; }
  .calendar-header, .calendar-body { 
    min-width: 800px; /* Force overflow for horizontal scroll */
  }
  .appt-block { font-size: 0.6rem; padding: 2px 4px; }
  .calendar-col-header div:first-child { font-size: 0.6rem !important; }
  .calendar-col-header div:last-child { font-size: 0.8rem !important; }
}

/* Animation for pending */
@keyframes pulse-yellow { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); } }
.appt-pending { animation: pulse-yellow 2s infinite; }

/* --- APPOINTMENT DETAIL MODAL --- */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px);
  z-index: 10002; justify-content: center; align-items: center;
  opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal-card {
  background: white; border-radius: 20px; width: 90%; max-width: 400px;
  padding: 24px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95); transition: transform 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-overlay.active .modal-card { transform: scale(1); }

.advanced-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1024px) { .advanced-grid { grid-template-columns: repeat(3, 1fr); } }

.list-item-bi { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; }
.rank-badge { background: #f1f5f9; color: #2E3338; font-weight: 600; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; margin-right: 8px; }
