/* ==========================================================================
   JATO PHARMA - SMART MEDICATION HUB & MODERN UI UPGRADE
   ========================================================================== */

:root {
  --med-blue: #2563eb;
  --med-blue-dark: #1d4ed8;
  --med-blue-light: #3b82f6;
  --med-blue-soft: #eff6ff;
  --med-blue-border: #dbeafe;
  --med-surface: #f4f7fc;
  --med-card-shadow: 0 10px 30px -5px rgba(37, 99, 235, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
}

/* Global subtle polish */
body {
  background-color: var(--med-surface);
}

/* Header Notification Bell */
.nav-notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-dark);
  font-size: 1.05rem;
  transition: var(--transition);
}
.nav-notif-btn:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
}
.notif-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 9px;
  height: 9px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.notif-dot.active {
  display: block;
  animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.85; }
}

/* ==========================================================================
   MEDICATION HUB SECTION
   ========================================================================== */
.med-hub-section {
  padding: 36px 0 28px;
  position: relative;
}

.med-hub-shell {
  background: #ffffff;
  border-radius: 28px;
  padding: 28px;
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: var(--med-card-shadow);
}

/* Greeting Header */
.med-hub-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.med-greeting-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.med-greeting-text .med-greeting-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.med-greeting-text h2 {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.22;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

.med-greeting-text h2 span {
  color: var(--med-blue);
}

.med-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.med-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--med-blue-soft);
  color: var(--med-blue);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--med-blue-border);
}

.med-btn-add-top {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--med-blue);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
  transition: var(--transition);
}
.med-btn-add-top:hover {
  background: var(--med-blue-dark);
  transform: translateY(-1px);
}

/* Search + Filter Strip inside Hub (especially crisp on mobile) */
.med-search-strip {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.med-search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 10px 14px;
}
.med-search-box i {
  color: #94a3b8;
}
.med-search-box input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.92rem;
  color: var(--text-dark);
}
.med-filter-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}
.med-filter-btn:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
  border-color: var(--med-blue-border);
}

/* Main 2-Column Dashboard Grid */
.med-hub-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  width: 100%;
}

.med-col-left,
.med-col-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* Next Dose Hero Card */
.next-dose-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  color: #ffffff;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 48%, #3b82f6 100%);
  box-shadow: 0 16px 34px -8px rgba(37, 99, 235, 0.42);
  transition: var(--transition);
}

.next-dose-card.all-done {
  background: linear-gradient(135deg, #059669 0%, #10b981 60%, #34d399 100%);
  box-shadow: 0 16px 34px -8px rgba(16, 185, 129, 0.35);
}

.next-dose-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.next-dose-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  z-index: 2;
  width: 100%;
}
.next-dose-top > div:first-child {
  min-width: 0;
  flex: 1;
}

.next-dose-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.snooze-pill {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
}

.next-dose-time {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.next-dose-med {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  padding: 6px 14px;
  border-radius: 999px;
}

.next-dose-illustration {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.22));
  animation: floatBottle 4s ease-in-out infinite;
}

@keyframes floatBottle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.next-dose-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
  position: relative;
  z-index: 2;
}

.btn-dose-taken {
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 16px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  transition: var(--transition);
}
.btn-dose-taken:hover {
  background: #f8fafc;
  transform: translateY(-1px);
}
.next-dose-card.all-done .btn-dose-taken {
  color: #059669;
}

.btn-dose-snooze {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 14px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: var(--transition);
}
.btn-dose-snooze:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* Quick Features Grid ("Tính năng nhanh") */
.med-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.med-block-title h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
}
.med-see-all {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--med-blue);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.med-see-all:hover {
  text-decoration: underline;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-action-tile {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
  transition: var(--transition);
}
.quick-action-tile:hover {
  background: #ffffff;
  border-color: var(--med-blue-border);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
  transform: translateY(-2px);
}

.qa-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--med-blue-soft);
  color: var(--med-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.qa-icon.teal { background: #ecfdf5; color: #059669; }
.qa-icon.indigo { background: #eef2ff; color: #4f46e5; }
.qa-icon.sky { background: #e0f2fe; color: #0284c7; }

.quick-action-tile span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.25;
}

/* Adherence Ring Card ("Tuân thủ uống thuốc") */
.adherence-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.adherence-card:hover {
  background: #ffffff;
  border-color: var(--med-blue-border);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}

.adherence-info h4 {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.adherence-percent {
  font-size: 2rem;
  font-weight: 900;
  color: var(--med-blue);
  line-height: 1.1;
  margin-bottom: 4px;
}
.adherence-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
}

.adherence-ring-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  flex-shrink: 0;
}
.adherence-ring-svg {
  width: 78px;
  height: 78px;
  transform: rotate(-90deg);
}
.adherence-ring-bg {
  fill: none;
  stroke: #dbeafe;
  stroke-width: 8;
}
.adherence-ring-progress {
  fill: none;
  stroke: var(--med-blue);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.adherence-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--med-blue);
  font-size: 1.35rem;
}

/* Today's Schedule Card ("Lịch uống hôm nay") */
.schedule-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 20px;
}

.schedule-filter-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.sch-filter-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid #e2e8f0;
  transition: var(--transition);
}
.sch-filter-pill.active {
  background: var(--med-blue);
  color: #ffffff;
  border-color: var(--med-blue);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-item {
  background: #ffffff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
}
.schedule-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}
.schedule-item.is-next {
  border-color: var(--med-blue-border);
  background: linear-gradient(to right, #ffffff, #f8fbff);
}

.sch-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sch-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.sch-status-icon.taken {
  background: #10b981;
  color: #fff;
}
.sch-status-icon.due {
  background: var(--med-blue);
  color: #fff;
}
.sch-status-icon.upcoming {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.sch-time {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-dark);
  min-width: 46px;
}

.sch-med-info {
  min-width: 0;
}
.sch-med-name {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sch-med-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.sch-action-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}
.sch-action-btn.taken-badge {
  background: #dcfce7;
  color: #15803d;
  cursor: default;
}
.sch-action-btn.take-now {
  background: var(--med-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.sch-action-btn.take-now:hover {
  background: var(--med-blue-dark);
  transform: translateY(-1px);
}
.sch-action-btn.take-upcoming {
  background: #f1f5f9;
  color: var(--text-dark);
}
.sch-action-btn.take-upcoming:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
}

/* ==========================================================================
   MODALS FOR MEDICATION HUB (Add Med, Med List, Adherence Report, Notifs)
   ========================================================================== */
.med-modal-content {
  max-width: 560px !important;
  width: 94%;
  border-radius: 24px !important;
  padding: 26px !important;
}

.med-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-right: 32px;
}
.med-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--med-blue-soft);
  color: var(--med-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.med-modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
}
.med-modal-header p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.med-quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.med-quick-chip {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-dark);
  border: 1px solid #e2e8f0;
  transition: var(--transition);
}
.med-quick-chip:hover {
  background: var(--med-blue-soft);
  color: var(--med-blue);
  border-color: var(--med-blue-border);
}

.med-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.med-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.med-form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
}
.med-form-group input,
.med-form-group select {
  padding: 10px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 0.92rem;
  background: #f8fafc;
}
.med-form-group input:focus,
.med-form-group select:focus {
  border-color: var(--med-blue);
  background: #ffffff;
}

/* Med Manager List */
.med-manager-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.med-mgr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.med-mgr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.med-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: var(--transition);
}
.med-icon-btn.buy {
  background: #ecfdf5;
  color: #059669;
}
.med-icon-btn.buy:hover { background: #d1fae5; }
.med-icon-btn.del {
  background: #fef2f2;
  color: #ef4444;
}
.med-icon-btn.del:hover { background: #fee2e2; }

/* Adherence Analytics Modal */
.report-summary-banner {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-radius: 20px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.report-kpi-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}
.report-kpi-box strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--med-blue);
}
.report-kpi-box span {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.weekly-chart-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
}
.weekly-chart-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  height: 120px;
  align-items: end;
  margin-top: 12px;
}
.wc-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.wc-bar-track {
  width: 100%;
  max-width: 24px;
  height: 88px;
  background: #e2e8f0;
  border-radius: 999px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.wc-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-radius: 999px;
  transition: height 0.5s ease;
}
.wc-day {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Notification List */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}
.notif-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.notif-item.urgent {
  background: var(--med-blue-soft);
  border-color: var(--med-blue-border);
}

/* ==========================================================================
   MOBILE APP EXPERIENCE POLISH (<= 768px)
   ========================================================================== */
@media (max-width: 991px) {
  .med-hub-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .med-hub-section {
    padding: 14px 0 18px;
  }
  .med-hub-section .container {
    padding: 0 12px;
  }
  .med-hub-shell {
    border-radius: 22px;
    padding: 16px 14px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .med-greeting-text h2 {
    font-size: 1.28rem;
  }
  .med-top-actions .med-pill-badge {
    display: none;
  }
  .med-btn-add-top {
    padding: 8px 13px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .med-search-strip {
    display: flex;
  }
  .next-dose-card {
    padding: 18px 16px;
    border-radius: 20px;
    width: 100%;
    max-width: 100%;
  }
  .next-dose-time {
    font-size: 1.45rem;
  }
  .next-dose-med {
    font-size: 0.88rem;
    padding: 5px 12px;
    max-width: 100%;
  }
  .next-dose-illustration {
    width: 62px;
    height: 62px;
  }
  .next-dose-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
  }
  .btn-dose-taken,
  .btn-dose-snooze {
    font-size: 0.78rem;
    padding: 10px 8px;
    white-space: nowrap;
  }
  .quick-actions-grid {
    gap: 8px;
    width: 100%;
  }
  .quick-action-tile {
    padding: 10px 4px;
    border-radius: 16px;
    min-width: 0;
  }
  .qa-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 12px;
  }
  .quick-action-tile span {
    font-size: 0.7rem;
  }
  .adherence-card {
    padding: 15px 16px;
    border-radius: 20px;
  }
  .schedule-card {
    padding: 14px 12px;
    border-radius: 20px;
    width: 100%;
  }
  .schedule-item {
    padding: 11px 10px;
    gap: 8px;
  }
  .sch-time {
    min-width: 40px;
    font-size: 0.82rem;
  }
  .sch-med-info {
    flex: 1;
    min-width: 0;
  }
  .sch-med-name {
    font-size: 0.85rem;
  }
  .sch-action-btn {
    padding: 6px 10px;
    font-size: 0.74rem;
    white-space: nowrap;
  }
  .med-form-grid {
    grid-template-columns: 1fr;
  }

  /* Sleeker Glassmorphic Bottom Nav */
  .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.06) !important;
    padding-bottom: env(safe-area-inset-bottom, 4px);
  }
  .mb-nav-item.active {
    color: var(--med-blue) !important;
  }
}
