/* ===========================================================================
   AKESO Patient Portal — Stylesheet
   Teal (#69C1A9) + Gold (#C1B683) premium medical aesthetic
   =========================================================================== */
:root {
  --bg: #f6faf9;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f7f5;
  --text: #0f2a2a;
  --text-muted: #5a7575;
  --border: #dce8e6;
  --border-strong: #c0d8d4;

  --primary: #2a9d8f;
  --primary-dark: #21867a;
  --primary-light: #69c1a9;
  --primary-glow: rgba(105, 193, 169, 0.25);

  --gold: #c1b683;
  --gold-dark: #a89d5f;

  --danger: #e63946;
  --success: #2a9d8f;
  --warning: #e9c46a;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --shadow-sm: 0 1px 2px rgba(15, 42, 42, 0.05), 0 4px 12px -4px rgba(15, 42, 42, 0.08);
  --shadow-md: 0 2px 8px rgba(15, 42, 42, 0.06), 0 12px 32px -8px rgba(15, 42, 42, 0.12);
  --shadow-lg: 0 4px 16px rgba(15, 42, 42, 0.08), 0 24px 56px -12px rgba(15, 42, 42, 0.18);

  --sidebar-bg: #0f2a2a;
  --sidebar-text: #b8d8d3;
  --sidebar-active: #69c1a9;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Admin theme — darker sidebar */
.theme-admin {
  --bg: #f4f6f8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-muted); font-size: 0.85rem; }
.text-sm { font-size: 0.85rem; }
.text-success { color: var(--success); font-weight: 600; }
.text-danger { color: var(--danger); font-weight: 600; }
.empty { color: var(--text-muted); font-style: italic; padding: 1.5rem; text-align: center; }

/* ---- Login page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(100% 70% at 0% 0%, rgba(105, 193, 169, 0.18), transparent 50%),
    radial-gradient(100% 70% at 100% 100%, rgba(193, 182, 131, 0.12), transparent 50%),
    linear-gradient(135deg, #0f2a2a, #16403d);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg, 22px);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand h1 { font-size: 1.6rem; font-weight: 800; margin-top: 0.75rem; }
.login-brand .tagline { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-hint { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); text-align: center; }
.login-hint p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.login-hint code { display: block; font-size: 0.75rem; color: var(--primary-dark); margin: 0.25rem 0; }

/* ---- Brand mark ---- */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.brand-mark.sm { width: 34px; height: 34px; font-size: 1.1rem; border-radius: 9px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }

/* ---- Form fields ---- */
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > span { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.field textarea { resize: vertical; min-height: 60px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ---- Alerts ---- */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; margin-bottom: 1rem; }
.alert-error { background: #fde8e8; color: var(--danger); border: 1px solid #f5c2c2; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.25rem;
}
.badge-tag { background: var(--surface-2); color: var(--text-muted); padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.badge-pin { background: var(--gold); color: #fff; padding: 0.15rem 0.5rem; border-radius: 5px; font-size: 0.7rem; font-weight: 700; }
.badge-pending { background: var(--warning); color: #5a4a1a; padding: 0.15rem 0.5rem; border-radius: 5px; font-size: 0.7rem; font-weight: 600; }
.badge-status { padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.badge-status-approved { background: #d4f0ea; color: var(--success); }
.badge-status-pending { background: #fdf3d4; color: #8a7320; }
.badge-status-rejected { background: #fde8e8; color: var(--danger); }

/* ---- App shell ---- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.app-header-inner { max-width: 1200px; margin: 0 auto; padding: 0.75rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.app-logo { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.app-logo-text { font-weight: 800; font-size: 1.1rem; color: var(--text); }
.app-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.app-nav a { padding: 0.5rem 0.85rem; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; font-size: 0.85rem; text-decoration: none; transition: all 0.15s; }
.app-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.app-nav a.active { background: var(--primary); color: #fff; }
.app-header-right { display: flex; align-items: center; gap: 0.75rem; }
.user-name { font-weight: 600; font-size: 0.85rem; }
.app-main { flex: 1; max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }
.app-footer { text-align: center; padding: 1.5rem; color: var(--text-muted); font-size: 0.8rem; }

@media (max-width: 768px) {
  .app-header-inner { flex-wrap: wrap; }
  .app-nav { order: 3; width: 100%; overflow-x: auto; }
}

/* ---- Admin shell ---- */
.admin-shell { display: flex; flex-direction: row; }
.admin-sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.admin-sidebar .app-logo { padding: 0 0.5rem 1.5rem; }
.admin-sidebar .app-logo-text { color: #fff; }
.admin-nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.admin-nav a { padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); color: var(--sidebar-text); font-weight: 600; font-size: 0.85rem; text-decoration: none; transition: all 0.15s; display: flex; align-items: center; justify-content: space-between; }
.admin-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }
.admin-nav a.active { background: var(--sidebar-active); color: var(--sidebar-bg); }
.admin-sidebar-footer { display: flex; flex-direction: column; gap: 0.25rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.admin-sidebar-footer .btn { color: var(--sidebar-text); border-color: rgba(255, 255, 255, 0.2); }
.admin-content { flex: 1; min-width: 0; }
.admin-topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 40; }
.admin-topbar h1 { font-size: 1.2rem; font-weight: 700; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

@media (max-width: 768px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: relative; }
  .admin-nav { flex-direction: row; overflow-x: auto; }
}

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-head h2 { font-size: 1.05rem; font-weight: 700; }

/* ---- Page hero ---- */
.page-hero { margin-bottom: 1.5rem; }
.page-hero h1 { font-size: 1.6rem; font-weight: 800; }
.page-hero p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

/* ---- Stat grid ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.25rem; }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text); }

/* ---- Stage track ---- */
.stage-track { display: flex; justify-content: space-between; margin-bottom: 2rem; position: relative; }
.stage-track::before { content: ''; position: absolute; top: 14px; left: 5%; right: 5%; height: 2px; background: var(--border); z-index: 0; }
.stage-dot { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; position: relative; z-index: 1; flex: 1; }
.stage-num { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.stage-dot.done .stage-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.stage-dot.current .stage-num { background: var(--gold); border-color: var(--gold); color: #fff; box-shadow: 0 0 0 4px var(--primary-glow); }
.stage-label { font-size: 0.7rem; color: var(--text-muted); text-align: center; }
.stage-dot.current .stage-label { color: var(--text); font-weight: 700; }

/* ---- Stage bars (admin dashboard) ---- */
.stage-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.stage-bar { display: flex; align-items: center; gap: 0.75rem; }
.stage-bar-label { width: 50px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.stage-bar-track { flex: 1; height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.stage-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 5px; transition: width 0.4s ease; }
.stage-bar-count { width: 30px; text-align: right; font-weight: 700; font-size: 0.85rem; }

/* ---- Media grid ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.media-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.media-placeholder { height: 140px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-muted); font-size: 0.8rem; }
.media-meta { padding: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }
.media-meta p { font-size: 0.82rem; }

/* ---- Post list ---- */
.post-list { display: flex; flex-direction: column; gap: 1rem; }
.post-item { display: flex; gap: 0.75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.post-item:last-child { border-bottom: none; }
.post-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.post-body { flex: 1; min-width: 0; }
.post-meta { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; flex-wrap: wrap; }
.post-meta strong { font-size: 0.88rem; }
.post-body p { font-size: 0.88rem; color: var(--text); }
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }

/* ---- Comments ---- */
.comments-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.comments-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.comment-item { padding: 0.5rem 0.75rem; background: var(--surface-2); border-radius: var(--radius-xs); font-size: 0.85rem; }
.comment-form { display: flex; gap: 0.5rem; }
.comment-form input { flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-xs); font-family: inherit; font-size: 0.85rem; }

/* ---- Appointments ---- */
.appt-list { display: flex; flex-direction: column; gap: 0.75rem; }
.appt-item { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.appt-date { width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--primary); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.appt-day { font-size: 1.2rem; font-weight: 800; line-height: 1; }
.appt-mon { font-size: 0.7rem; text-transform: uppercase; }
.appt-info { flex: 1; display: flex; flex-direction: column; }
.appt-info strong { font-size: 0.9rem; }
.appt-status { padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.appt-status-requested { background: #fdf3d4; color: #8a7320; }
.appt-status-confirmed { background: #d4f0ea; color: var(--success); }
.appt-status-completed { background: var(--surface-2); color: var(--text-muted); }
.appt-status-cancelled, .appt-status-no_show { background: #fde8e8; color: var(--danger); }

.appt-form, .post-form, .user-form, .upload-form { display: flex; flex-direction: column; gap: 0.75rem; }

/* ---- Filter bar ---- */
.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-xs); font-family: inherit; font-size: 0.88rem; }
.filter-bar input { flex: 1; min-width: 200px; }

/* ---- Data table ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; padding: 0.6rem 0.75rem; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid var(--border); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); }
.data-table tr:hover { background: var(--surface-2); }

/* ---- Profile ---- */
.profile-grid { display: flex; gap: 1.5rem; align-items: center; }
.big-avatar { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; }
.info-list { display: grid; grid-template-columns: 140px 1fr; gap: 0.5rem 1rem; }
.info-list dt { font-weight: 600; color: var(--text-muted); font-size: 0.82rem; }
.info-list dd { font-size: 0.9rem; }

.patient-header { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem; }
.patient-header h2 { font-size: 1.4rem; font-weight: 800; }

/* ---- Notifications ---- */
.notif-list { display: flex; flex-direction: column; gap: 0.5rem; }
.notif-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.notif-item.unread { background: #f0f7f5; border-color: var(--primary-light); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.notif-item:not(.unread) .notif-dot { background: var(--border-strong); }
.notif-content { flex: 1; }
.notif-content strong { font-size: 0.88rem; }
.notif-content p { font-size: 0.82rem; color: var(--text-muted); margin: 0.15rem 0; }

/* ---- Notes box ---- */
.notes-box { background: #fffbeb; border: 1px solid #f5e6b8; border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-top: 1rem; font-size: 0.85rem; }

/* ---- Upload status ---- */
.upload-status { font-size: 0.85rem; margin-top: 0.5rem; }
.upload-status.success { color: var(--success); }
.upload-status.error { color: var(--danger); }
.upload-status.progress { color: var(--primary-dark); }

/* ---- Inline forms ---- */
.inline-form { display: inline; }
.inline-form select { padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-xs); font-family: inherit; font-size: 0.8rem; }

/* ---- Moderation ---- */
.moderation-card { display: flex; flex-direction: column; }
.moderation-actions { display: flex; gap: 0.4rem; padding: 0.6rem; }

/* ---- Config block ---- */
.config-block { background: var(--sidebar-bg); color: #b8d8d3; padding: 1rem; border-radius: var(--radius-sm); font-size: 0.8rem; overflow-x: auto; margin: 0.75rem 0; }

/* ---- Stage update form ---- */
.stage-update-form { display: flex; gap: 0.75rem; align-items: flex-end; margin-top: 1rem; }
.stage-update-form .field { flex: 1; }

/* ---- Treatment stage ---- */
.treatment-stage .stage-desc { color: var(--text-muted); margin: 0.5rem 0 0; font-size: 0.9rem; }
