/* ==========================================================================
   DRN Counseling & Consulting -- course project stylesheet
   Mobile-first: base rules target small screens, media queries widen up.
   ========================================================================== */

:root {
  --brand-50: #f2f7f6;
  --brand-100: #dcebe8;
  --brand-500: #3f7d72;
  --brand-600: #31655c;
  --brand-700: #28524b;
  --brand-900: #1c3733;
  --mint: #b9dfd4;
  --coral: #f3a28f;
  --ink-900: #181c1f;
  --ink-700: #3a4148;
  --ink-500: #6b7278;
  --ink-100: #eceef0;
  --paper: #f9f8f3;
  --white: #ffffff;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(24, 28, 31, 0.06), 0 1px 2px rgba(24, 28, 31, 0.05);
  --shadow: 0 4px 18px rgba(24, 28, 31, 0.08);
  --shadow-lg: 0 16px 40px rgba(24, 28, 31, 0.14);
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-heading: 'Fraunces', Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--paper);
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

a {
  color: var(--brand-700);
}

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Accessibility helpers ---------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--brand-700);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 100;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 8px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--brand-500);
  outline-offset: 2px;
}

/* Header / nav --------------------------------------------------------- */

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--ink-100);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 14px;
  padding-bottom: 14px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink-900);
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

.logo em {
  font-style: normal;
  color: var(--brand-600);
}

.nav-toggle {
  background: none;
  border: 1px solid var(--ink-100);
  border-radius: 8px;
  font-size: 1.4rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}

.primary-nav {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px 0 6px;
}

.primary-nav.is-open {
  display: flex;
}

.primary-nav a {
  text-decoration: none;
  color: var(--ink-700);
  font-weight: 500;
  padding: 10px 8px;
  border-radius: 8px;
}

.primary-nav a:hover,
.primary-nav a[aria-current='page'] {
  color: var(--brand-700);
  background: var(--brand-50);
}

.primary-nav a.nav-cta {
  background: var(--brand-600);
  color: var(--white);
  text-align: center;
}

.primary-nav a.nav-cta:hover {
  background: var(--brand-700);
  color: var(--white);
}

.nav-account {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.nav-account .avatar-chip {
  width: 26px;
  height: 26px;
  font-size: 0.68rem;
}

@media (min-width: 720px) {
  .nav-account {
    margin-left: 6px;
    padding-left: 14px;
    border-left: 1px solid var(--ink-100);
  }
}

/* Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-family: var(--font-body);
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--brand-600);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--brand-700);
  color: var(--white);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.35) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.btn-primary:hover::after {
  transform: translateX(120%);
}

.btn-secondary {
  background: var(--brand-50);
  color: var(--brand-700);
}

.btn-secondary:hover {
  background: var(--brand-100);
}

.btn-danger {
  background: #fbe4e1;
  color: #9a2f22;
}

.btn-danger:hover {
  background: #f6cec8;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Layout sections --------------------------------------------------------- */

.page-content {
  min-height: 60vh;
  padding: 32px 0 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--brand-100), var(--paper));
  padding: 40px 0 48px;
}

.hero > .container,
.hero > .hero-grid {
  position: relative;
  z-index: 1;
}

/* Soft, slow-drifting gradient blobs behind hero/intro sections for
   depth. Purely decorative -- aria-hidden and z-indexed behind content. */
.motion-blobs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.motion-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: blob-float 18s ease-in-out infinite;
}

.motion-blob--1 { top: -60px; left: -60px; width: 260px; height: 260px; background: var(--mint); }
.motion-blob--2 { top: 20px; right: -80px; width: 320px; height: 320px; background: var(--brand-500); opacity: 0.25; animation-delay: -6s; }
.motion-blob--3 { bottom: -80px; left: 30%; width: 220px; height: 220px; background: var(--coral); opacity: 0.3; animation-delay: -12s; }

@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(4%, -6%) scale(1.08); }
  66% { transform: translate(-3%, 4%) scale(0.94); }
}

.hero .eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-700);
  background: var(--white);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.section {
  padding: 40px 0;
}

.section-heading {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 28px;
}

/* Page header (account/dashboard pages) --------------------------------- */

.page-header {
  padding: 4px 0 28px;
}

.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-header h1 {
  margin-bottom: 6px;
}

.page-header p {
  color: var(--ink-700);
  max-width: 640px;
  margin-bottom: 0;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-700);
  margin-bottom: 14px;
}

.page-back-link:hover {
  color: var(--brand-700);
}

/* Stat cards (dashboard summaries) --------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 0 0 32px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
  display: block;
  font-family: var(--font-heading);
  font-size: 2rem;
  line-height: 1;
  color: var(--brand-700);
  margin-bottom: 6px;
}

.stat-card .stat-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.stat-card.accent-coral .stat-value { color: #c05a3f; }
.stat-card.accent-mint .stat-value { color: #1c5c4d; }

/* Panels (elevated wrapper for forms/tables on account/dashboard pages) - */

.panel {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 28px;
}

.panel > h2:first-child,
.panel-header:first-child {
  margin-top: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0;
}

.panel + .panel {
  margin-top: -8px;
}

.panel form {
  max-width: 640px;
}

.panel form.form-wide {
  max-width: 100%;
}

/* Auth-style forms (login/register/contact) centered in a panel -------- */

.auth-panel {
  max-width: 480px;
  margin: 0 auto;
}

/* Cards --------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.card {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}

a.card:hover,
.card:hover {
  box-shadow: var(--shadow-lg);
}

.card h3 {
  margin-top: 0;
}

/* Avatar chip: initials badge used in nav and table name cells --------- */

.avatar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.name-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.eyebrow-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-700);
  margin-bottom: 4px;
}

/* 3D tilt (assets/js/motion.js sets the transform inline on mousemove) --
   the transition here is what makes the tilt feel smooth instead of
   snapping, and what eases it back to flat on mouseleave. */
[data-tilt] {
  transition: transform 0.15s ease-out;
  will-change: transform;
}

/* Scroll reveal: assets/js/motion.js adds .is-visible via
   IntersectionObserver the first time an element scrolls into view. */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Message thread (appointment_thread.php) ------------------------------- */

.message-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--ink-100);
  background: var(--white);
}

.message-bubble.message-mine {
  align-self: flex-end;
  background: var(--brand-50);
  border-color: var(--brand-100);
}

.message-bubble.message-from-admin:not(.message-mine) {
  border-left: 3px solid var(--brand-500);
}

.message-bubble p {
  margin: 0;
}

.message-meta {
  font-size: 0.78rem;
  color: var(--ink-700);
  margin-bottom: 4px !important;
}

/* Forms --------------------------------------------------------------- */

form {
  max-width: 560px;
}

form.form-wide {
  max-width: 100%;
}

.field {
  margin-bottom: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 640px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
  }
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
}

.required-marker {
  color: #9a2f22;
}

.role-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid #c7cdd1;
  border-radius: 10px;
  cursor: pointer;
}

.role-option input {
  margin-top: 3px;
}

input[type='text'],
input[type='email'],
input[type='tel'],
input[type='date'],
input[type='number'],
input[type='password'],
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c7cdd1;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--white);
  color: var(--ink-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='tel']:focus,
input[type='date']:focus,
input[type='number']:focus,
input[type='password']:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input.field-invalid,
textarea.field-invalid,
select.field-invalid {
  border-color: #b23a2c;
}

.field-error {
  color: #9a2f22;
  font-size: 0.85rem;
  margin-top: 5px;
  min-height: 1.1em;
}

.form-status {
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.form-status.success {
  background: #e4f3ee;
  color: #1c5c4d;
  border: 1px solid #b9dfd4;
}

.form-status.error {
  background: #fbe4e1;
  color: #9a2f22;
  border: 1px solid #f3a28f;
}

/* Tables (dashboard) ----------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius);
  background: var(--white);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
}

caption {
  text-align: left;
  padding: 14px 16px 0;
  font-weight: 600;
  font-family: var(--font-heading);
}

th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: top;
}

th {
  background: var(--brand-50);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-700);
  position: sticky;
  top: 0;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--brand-50);
}

/* Empty states ---------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-700);
}

.empty-state .empty-icon {
  font-size: 2.2rem;
  margin-bottom: 10px;
  opacity: 0.7;
}

.empty-state p {
  margin: 0 0 4px;
}

.empty-state a {
  font-weight: 600;
}

td.empty-state {
  padding: 48px 20px;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-pending { background: #fdf0d5; color: #8a5a10; }
.status-confirmed { background: #e4f3ee; color: #1c5c4d; }
.status-cancelled { background: #f1e2e2; color: #7a2e24; }

/* Footer --------------------------------------------------------------- */

.site-footer {
  background: var(--ink-900);
  color: rgba(255, 255, 255, 0.78);
  padding: 40px 0 32px;
  margin-top: 40px;
  border-top: 3px solid var(--brand-500);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.site-footer a {
  color: var(--mint);
}

.site-footer strong {
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 1.05rem;
}

/* Responsive breakpoints ------------------------------------------------- */

@media (min-width: 720px) {
  h1 { font-size: 2.6rem; }
  h2 { font-size: 2rem; }

  .nav-toggle {
    display: none;
  }

  .primary-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    padding: 0;
  }

  .card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

  .footer-inner {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: center;
  }
}

@media (min-width: 960px) {
  .container {
    padding: 0 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .motion-blob { animation: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
