/* ICUcal Availability - Shared Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: #f5f5f7; color: #1d1d1f; }

/* ---- Physician Form ---- */
.header {
  background: linear-gradient(135deg, #1a3a5c 0%, #2d6a9f 100%);
  color: #fff; padding: 32px 32px 28px;
}
.header-brand { display: flex; align-items: center; gap: 14px; }
.header-logo { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.header h1 { font-size: 26px; font-weight: 700; }
.header .subtitle { font-size: 15px; opacity: 0.8; margin-top: 4px; }
.header .physician-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(10px);
  border-radius: 20px; padding: 6px 16px 6px 8px; margin-top: 12px; font-size: 14px;
}
.header .physician-badge .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}

.container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }

.instructions {
  background: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); font-size: 14px; color: #515154; line-height: 1.5;
}
.instructions strong { color: #1d1d1f; }

.month-group { margin-bottom: 24px; }
.month-label {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: #86868b; padding: 0 4px; margin-bottom: 8px;
}

.week-card {
  background: #fff; border-radius: 12px; padding: 16px 20px; margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex; align-items: flex-start; gap: 16px;
  transition: box-shadow 0.15s;
}
.week-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.week-card.saving { opacity: 0.7; }

.week-info { flex-shrink: 0; width: 130px; min-width: 130px; padding-top: 4px; }
.week-date { font-weight: 600; font-size: 16px; }
.week-range { font-size: 12px; color: #86868b; margin-top: 2px; }

.availability-picker { flex: 1; min-width: 0; }
.pill-group { display: flex; gap: 4px; flex-wrap: nowrap; }
.pill {
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500;
  border: 1.5px solid #d2d2d7; background: #fff; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.pill:hover { border-color: #86868b; }
.pill.selected-available { background: #e8f8ee; border-color: #34c759; color: #1a7a3a; }
.pill.selected-unavailable { background: #ffe5e5; border-color: #ff3b30; color: #d30000; }
.pill.selected-constraint { background: #fff3d6; border-color: #ff9f0a; color: #946200; }
.pill.selected-other { background: #e8e0f5; border-color: #8e5fd3; color: #5a2d9e; }

.note-input {
  width: 100%; margin-top: 6px; padding: 6px 10px; border: 1.5px solid #8e5fd3;
  border-radius: 8px; font-size: 12px; font-family: inherit; background: #f9f6fd;
  color: #1d1d1f; resize: none; outline: none;
}
.note-input:focus { box-shadow: 0 0 0 2px rgba(142,95,211,0.2); }
.note-input::placeholder { color: #b8a8d0; }

.submit-section {
  background: #fff; border-radius: 12px; padding: 20px; margin-top: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); text-align: center;
}
.btn-submit {
  padding: 12px 40px; border-radius: 10px; border: none; font-size: 16px;
  font-weight: 600; cursor: pointer; background: #0071e3; color: #fff;
  transition: all 0.15s;
}
.btn-submit:hover { background: #0077ed; transform: translateY(-1px); }
.btn-submit:disabled { background: #86868b; cursor: default; transform: none; }
.btn-submit.submitted { background: #34c759; }
.submit-note { font-size: 12px; color: #86868b; margin-top: 8px; }
.view-schedule-link {
  display: inline-block; margin-top: 12px; font-size: 13px; color: #0071e3;
  text-decoration: none; font-weight: 500;
}
.view-schedule-link:hover { text-decoration: underline; }

.saved-indicator {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: #34c759; opacity: 0; transition: opacity 0.3s;
}
.saved-indicator.visible { opacity: 1; }

.error-banner {
  background: #ffe5e5; border: 1px solid #ff3b30; border-radius: 12px;
  padding: 16px 20px; margin-bottom: 20px; color: #d30000; font-size: 14px;
}

.loading { text-align: center; padding: 60px 20px; color: #86868b; font-size: 16px; }

/* ---- Admin Dashboard ---- */
.nav {
  background: #1d1d1f; color: #fff; padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between; font-size: 14px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo { width: 28px; height: 28px; border-radius: 6px; }
.nav .brand { font-weight: 700; font-size: 16px; letter-spacing: -0.3px; }

.page-header {
  background: #fff; border-bottom: 1px solid #d2d2d7; padding: 20px 32px;
  display: flex; align-items: flex-end; justify-content: space-between;
}
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header .meta { font-size: 13px; color: #86868b; }
.page-header .actions { display: flex; gap: 8px; }

.btn {
  padding: 8px 16px; border-radius: 8px; border: none; font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.btn-outline { background: transparent; border: 1.5px solid #d2d2d7; color: #1d1d1f; }
.btn-outline:hover { border-color: #86868b; }
.btn-success { background: #34c759; color: #fff; }
.btn-success:hover { background: #2db84e; }
.btn-primary { background: #0071e3; color: #fff; }
.btn-primary:hover { background: #0077ed; }

.admin-container { padding: 24px 32px; }

.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border-radius: 12px; padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: #86868b; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value.green { color: #34c759; }
.stat-value.orange { color: #ff9f0a; }
.stat-value.red { color: #ff3b30; }

.combined-section {
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 24px;
  overflow-x: auto;
}

.combined-table { border-collapse: separate; border-spacing: 0; width: 100%; }
.combined-table th {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  color: #86868b; padding: 6px 8px; white-space: nowrap; position: sticky; top: 0;
  background: #fff; z-index: 2;
}
.combined-table th.physician-col { text-align: center; min-width: 68px; }
.combined-table th.assign-col { text-align: center; min-width: 90px; color: #0071e3; background: #f8fbff; }
.combined-table th.week-col { text-align: left; min-width: 58px; }
.combined-table th.avail-col { text-align: center; min-width: 44px; font-size: 9px; }
.combined-table th.divider-col { width: 2px; padding: 0; min-width: 2px; }

.combined-table td {
  text-align: center; font-size: 11px; padding: 0; height: 34px; vertical-align: middle;
}
.combined-table td.week-label {
  text-align: left; font-weight: 600; font-size: 12px; padding: 0 10px;
  white-space: nowrap; background: none;
}
.combined-table td.avail-count { font-weight: 700; font-size: 12px; text-align: center; padding: 0 4px; }
.combined-table td.divider-cell { width: 2px; padding: 0; background: #d2d2d7; min-width: 2px; }

.hm { border-radius: 3px; margin: 1px; padding: 6px 3px; display: block; }
.hm-available { background: #d4f5dd; color: #1a7a3a; }
.hm-unavailable { background: #ffd4d4; color: #d30000; }
.hm-constraint { background: #fff0cc; color: #946200; }
.hm-empty { background: #f5f5f7; color: #c7c7cc; }

.count-good { color: #34c759; }
.count-warn { color: #ff9f0a; }
.count-bad { color: #ff3b30; }

.combined-table td.assign-cell { padding: 2px 3px; }
.combined-table td.assign-cell select {
  width: 100%; padding: 5px 6px; border: 1.5px solid #c5d9f0; border-radius: 5px;
  font-size: 11px; background: #f8fbff; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2386868b'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center; padding-right: 16px;
}
.combined-table td.assign-cell select:focus {
  border-color: #0071e3; outline: none; box-shadow: 0 0 0 2px rgba(0,113,227,0.15);
}
.combined-table td.assign-cell select.has-value {
  border-color: #0071e3; background-color: #edf4ff; font-weight: 600; color: #0071e3;
}

.combined-table tr.month-sep td { padding: 0; height: auto; border: none; }
.combined-table tr.month-sep td.month-name {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: #86868b; padding: 14px 10px 4px; text-align: left;
}

.combined-table tbody tr:not(.month-sep):hover td { background: rgba(0,113,227,0.03); }
.combined-table tbody tr:not(.month-sep):hover td.divider-cell { background: #d2d2d7; }

.link-section {
  margin-top: 24px; padding: 16px 20px; background: #fff; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.link-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.link-row {
  display: flex; align-items: center; gap: 12px; padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}
.link-row:last-child { border-bottom: none; }
.link-row .physician-name { font-size: 13px; font-weight: 600; width: 100px; }
.link-row .status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.link-row .status-dot.responded { background: #34c759; }
.link-row .status-dot.pending { background: #ff9f0a; }
.link-row input {
  flex: 1; padding: 6px 10px; border: 1px solid #d2d2d7; border-radius: 6px;
  font-size: 12px; font-family: 'SF Mono', monospace; color: #515154; background: #f5f5f7;
}
.link-row .btn { flex-shrink: 0; padding: 6px 12px; font-size: 12px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: #1d1d1f; color: #fff;
  padding: 12px 20px; border-radius: 10px; font-size: 14px;
  transform: translateY(100px); opacity: 0; transition: all 0.3s;
  z-index: 1000;
}
.toast.visible { transform: translateY(0); opacity: 1; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .header { padding: 24px 16px 20px; }
  .header h1 { font-size: 22px; }
  .week-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; }
  .week-info { width: auto; min-width: auto; }
  .pill-group { flex-wrap: wrap; }
  .pill { padding: 8px 14px; font-size: 13px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .admin-container { padding: 16px; }
  .page-header { padding: 16px; flex-direction: column; gap: 12px; align-items: flex-start; }
}
