/* ============================================================
   PATTERNS.CSS — Light Designs, Glassmorphism, Neumorphism,
                  Gradient UIs, Feature Sections, App Screens
   PWA CSS Library by CSTRSK
   ============================================================ */


/* ── GLASSMORPHISM ──────────────────────────────────────────── */

.glass {
  background: rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-xl);
}

.glass--dark {
  background: rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass--card {
  background: rgba(255, 255, 255, 0.20);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: var(--radius-2xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.glass--nav {
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px) saturate(200%);
  backdrop-filter: blur(12px) saturate(200%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

@media (prefers-color-scheme: dark) {
  .glass {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  .glass--card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  .glass--nav {
    background: rgba(0, 0, 0, 0.75);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
}


/* ── NEUMORPHISM (LIGHT ONLY) ───────────────────────────────── */

.neumorphic {
  background: #e8eaf0;
  border-radius: var(--radius-xl);
  box-shadow:
    6px 6px 12px #c8cad0,
    -6px -6px 12px #ffffff;
}

.neumorphic--inset {
  background: #e8eaf0;
  border-radius: var(--radius-xl);
  box-shadow:
    inset 4px 4px 8px #c8cad0,
    inset -4px -4px 8px #ffffff;
}

.neumorphic-btn {
  background: #e8eaf0;
  border-radius: var(--radius-lg);
  box-shadow:
    5px 5px 10px #c8cad0,
    -5px -5px 10px #ffffff;
  padding: var(--space-3) var(--space-5);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  cursor: pointer;
  transition: box-shadow var(--duration-fast) var(--ease-default);
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.neumorphic-btn:active {
  box-shadow:
    inset 4px 4px 8px #c8cad0,
    inset -4px -4px 8px #ffffff;
}


/* ── BENTO GRID ─────────────────────────────────────────────── */

.bento {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 140px;
}

.bento__item {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: box-shadow var(--duration-fast) var(--ease-default),
              transform  var(--duration-fast) var(--ease-default);
}

.bento__item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Size variants */
.bento__item--wide    { grid-column: span 2; }
.bento__item--tall    { grid-row:    span 2; }
.bento__item--large   { grid-column: span 2; grid-row: span 2; }
.bento__item--full    { grid-column: 1 / -1; }

.bento__item--brand {
  background: linear-gradient(135deg, var(--interactive-primary), var(--interactive-primary-hover));
  border: none;
  color: white;
}

.bento__item--brand .bento__title,
.bento__item--brand .bento__value { color: white; }

.bento__icon  { color: var(--icon-brand); width: 28px; height: 28px; }
.bento__title { font-size: var(--text-xs); font-weight: var(--font-weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-widest); color: var(--text-tertiary); }
.bento__value { font-size: var(--text-2xl); font-weight: var(--font-weight-bold); color: var(--text-primary); letter-spacing: var(--tracking-tight); line-height: 1; }
.bento__sub   { font-size: var(--text-sm); color: var(--text-secondary); }
.bento__badge { margin-top: auto; align-self: flex-start; }

@media (max-width: 767px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 120px;
  }
  .bento__item--large { grid-column: 1 / -1; }
  .bento__item--wide  { grid-column: 1 / -1; }
}


/* ── HERO SECTIONS ──────────────────────────────────────────── */

/* Clean light hero */
.hero--light {
  background: var(--bg-surface);
  padding: var(--space-20) var(--space-6) var(--space-16);
  text-align: center;
}

.hero--light .hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-brand);
  margin-bottom: var(--space-5);
}

.hero--light .hero__heading {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero--light .hero__sub {
  font-size: var(--text-md);
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto var(--space-8);
  line-height: var(--leading-relaxed);
}

.hero--light .hero__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* Gradient mesh hero */
.hero--mesh {
  position: relative;
  overflow: hidden;
  padding: var(--space-20) var(--space-6);
  text-align: center;
  background: var(--bg-base);
}

.hero--mesh::before {
  content: '';
  position: absolute;
  top: -50%; left: -20%;
  width: 60%; aspect-ratio: 1;
  background: radial-gradient(circle, var(--color-brand-200) 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.hero--mesh::after {
  content: '';
  position: absolute;
  bottom: -30%; right: -10%;
  width: 50%; aspect-ratio: 1;
  background: radial-gradient(circle, var(--color-accent-400) 0%, transparent 70%);
  opacity: 0.25;
  pointer-events: none;
}

.hero--mesh > * { position: relative; z-index: 1; }

/* Split hero (image left, text right) */
.hero--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: center;
  padding: var(--space-16) var(--space-8);
  background: var(--bg-surface);
}

@media (max-width: 767px) {
  .hero--split {
    grid-template-columns: 1fr;
    padding: var(--space-10) var(--space-5);
    text-align: center;
  }
}

.hero--split .hero__media {
  border-radius: var(--radius-2xl);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--bg-subtle);
}

.hero--split .hero__media img {
  width: 100%; height: 100%;
  object-fit: cover;
}


/* ── FEATURE GRID ────────────────────────────────────────────── */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.feature-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  transition: var(--transition-fast);
}

.feature-item:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.feature-item__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-xl);
  background: var(--color-brand-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-brand);
  font-size: 22px;
}

.feature-item__title {
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.feature-item__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  flex: 1;
}

.feature-item__link {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-brand);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}


/* ── PROFILE CARD ────────────────────────────────────────────── */

.profile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}

.profile-card__cover {
  height: 100px;
  background: linear-gradient(135deg, var(--interactive-primary), var(--interactive-primary-hover));
  position: relative;
}

.profile-card__avatar {
  position: absolute;
  bottom: -24px;
  left: var(--space-5);
  border: 4px solid var(--bg-surface);
  border-radius: var(--radius-full);
}

.profile-card__body {
  padding: var(--space-10) var(--space-5) var(--space-5);
}

.profile-card__name {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.profile-card__role {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.profile-card__bio {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

.profile-card__stats {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border-default);
}

.profile-card__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-card__stat-value {
  font-weight: var(--font-weight-bold);
  font-size: var(--text-md);
  color: var(--text-primary);
}

.profile-card__stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}


/* ── MEDIA CARD ─────────────────────────────────────────────── */

.media-card {
  position: relative;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--bg-subtle);
  cursor: pointer;
}

.media-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-default);
}

.media-card:hover img { transform: scale(1.05); }

.media-card__overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
  padding: var(--space-5) var(--space-4) var(--space-4);
}

.media-card__category {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  margin-bottom: var(--space-1);
}

.media-card__title {
  font-size: var(--text-md);
  font-weight: var(--font-weight-bold);
  color: white;
  line-height: var(--leading-tight);
}

.media-card__badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}


/* ── CHAT BUBBLES ────────────────────────────────────────────── */

.chat {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
}

.chat__message {
  display: flex;
  gap: var(--space-2);
  max-width: 80%;
}

.chat__message--out {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat__bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  position: relative;
}

.chat__message--in  .chat__bubble {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.chat__message--out .chat__bubble {
  background: var(--interactive-primary);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.chat__meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  padding: 0 var(--space-2);
  margin-top: var(--space-0-5);
  text-align: right;
}

.chat__message--in .chat__meta { text-align: left; }

.chat__avatar { flex-shrink: 0; margin-top: auto; }

/* Typing indicator */
.chat__typing .chat__bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: var(--space-3) var(--space-4);
}

.chat__typing-dot {
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  background: var(--text-tertiary);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.chat__typing-dot:nth-child(2) { animation-delay: .2s; }
.chat__typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}


/* ── CALENDAR STRIP ──────────────────────────────────────────── */

.cal-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding: var(--space-2) 0;
  -webkit-overflow-scrolling: touch;
}
.cal-strip::-webkit-scrollbar { display: none; }

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
  width: 52px;
  padding: var(--space-2) var(--space-1);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.cal-day:hover { background: var(--bg-subtle); }

.cal-day.is-active {
  background: var(--interactive-primary);
}

.cal-day.is-today:not(.is-active) {
  border: 2px solid var(--interactive-primary);
}

.cal-day__weekday {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.cal-day__num {
  font-size: var(--text-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.cal-day.is-active .cal-day__weekday,
.cal-day.is-active .cal-day__num { color: white; }

.cal-day__dot {
  width: 4px; height: 4px;
  border-radius: var(--radius-full);
  background: var(--interactive-primary);
}

.cal-day.is-active .cal-day__dot { background: rgba(255,255,255,.6); }


/* ── METRIC RING ─────────────────────────────────────────────── */

.metric-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.metric-ring__svg {
  transform: rotate(-90deg);
  overflow: visible;
}

.metric-ring__track {
  fill: none;
  stroke: var(--bg-subtle);
}

.metric-ring__fill {
  fill: none;
  stroke: var(--interactive-primary);
  stroke-linecap: round;
  transition: stroke-dashoffset var(--duration-xslow) var(--ease-out);
}

.metric-ring__content {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-ring__value {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  line-height: 1;
}

.metric-ring__label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}


/* ── SETTINGS LIST ────────────────────────────────────────────── */

.settings-group {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.settings-group__title {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  min-height: var(--tap-min);
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default);
  -webkit-tap-highlight-color: transparent;
}

.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: var(--bg-subtle); }

.settings-row__icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.settings-row__body    { flex: 1; min-width: 0; }
.settings-row__label   { font-size: var(--text-base); color: var(--text-primary); }
.settings-row__sub     { font-size: var(--text-xs); color: var(--text-secondary); }
.settings-row__trail   { color: var(--text-tertiary); flex-shrink: 0; }

/* Chevron for navigation rows */
.settings-row__chevron {
  width: 16px; height: 16px;
  color: var(--text-tertiary);
}

/* Colored icon backgrounds */
.settings-icon--red    { background: #fee2e2; color: #dc2626; }
.settings-icon--blue   { background: #dbeafe; color: #2563eb; }
.settings-icon--green  { background: #dcfce7; color: #16a34a; }
.settings-icon--orange { background: #ffedd5; color: #ea580c; }
.settings-icon--purple { background: #ede9fe; color: #7c3aed; }
.settings-icon--gray   { background: var(--bg-subtle); color: var(--text-secondary); }

@media (prefers-color-scheme: dark) {
  .settings-icon--red    { background: rgba(220,38,38,.2); }
  .settings-icon--blue   { background: rgba(37,99,235,.2); }
  .settings-icon--green  { background: rgba(22,163,74,.2); }
  .settings-icon--orange { background: rgba(234,88,12,.2); }
  .settings-icon--purple { background: rgba(124,58,237,.2); }
}


/* ── SPOTLIGHT SEARCH ────────────────────────────────────────── */

.spotlight {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 80px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-default);
}

.spotlight.is-open {
  pointer-events: all;
  opacity: 1;
}

.spotlight__backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.spotlight__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  transform: scale(0.97) translateY(-8px);
  transition: transform var(--duration-normal) var(--ease-spring);
  margin: 0 var(--space-4);
}

.spotlight.is-open .spotlight__panel {
  transform: scale(1) translateY(0);
}

.spotlight__input-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-default);
}

.spotlight__icon { color: var(--icon-default); flex-shrink: 0; }

.spotlight__input {
  flex: 1;
  font-size: var(--text-md);
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
}
.spotlight__input::placeholder { color: var(--text-tertiary); }

.spotlight__results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.spotlight__result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default);
}

.spotlight__result:hover,
.spotlight__result.is-focused {
  background: var(--bg-subtle);
}

.spotlight__result-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-default);
  flex-shrink: 0;
}

.spotlight__result-body { flex: 1; min-width: 0; }
.spotlight__result-title { font-size: var(--text-sm); font-weight: var(--font-weight-medium); color: var(--text-primary); }
.spotlight__result-sub   { font-size: var(--text-xs); color: var(--text-tertiary); }
.spotlight__result-kbd   { flex-shrink: 0; }

.spotlight__section-label {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-tertiary);
  padding: var(--space-3) var(--space-5) var(--space-1);
}

.spotlight__footer {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-default);
  background: var(--bg-subtle);
}

.spotlight__hint {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}


/* ── MARKDOWN / RICH TEXT ────────────────────────────────────── */

.prose {
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  max-width: 65ch;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  color: var(--text-primary);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.prose h1 { font-size: var(--text-2xl); }
.prose h2 { font-size: var(--text-xl); border-bottom: 1px solid var(--border-default); padding-bottom: var(--space-2); }
.prose h3 { font-size: var(--text-lg); }

.prose p  { margin-bottom: 1em; }
.prose a  { color: var(--text-brand); text-decoration: underline; }
.prose a:hover { text-decoration: none; }

.prose ul, .prose ol {
  list-style: initial;
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.prose ol { list-style: decimal; }

.prose li { margin-bottom: 0.4em; }

.prose blockquote {
  border-left: 4px solid var(--border-focus);
  padding-left: var(--space-4);
  margin: var(--space-4) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
  font-size: var(--text-sm);
}

.prose th {
  background: var(--bg-subtle);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  border-bottom: 2px solid var(--border-default);
}

.prose td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-default);
}

.prose img {
  border-radius: var(--radius-xl);
  margin: var(--space-6) 0;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: var(--space-8) 0;
}

.prose strong { font-weight: var(--font-weight-semibold); color: var(--text-primary); }
.prose em     { font-style: italic; }

.prose code {
  background: var(--bg-subtle);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--text-brand);
  border: 1px solid var(--border-default);
}

.prose pre {
  background: var(--color-neutral-900);
  color: #e2e8f0;
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  overflow-x: auto;
  margin-bottom: 1em;
  border: none;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}
