/* ═══════════════════════════════════════════════════════════════
   CLAYMORPHIC DESIGN SYSTEM
   Matching the Flutter app's neumorphic/claymorphic theme
   ═══════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────────
   CSS Variables (Design Tokens)
   ─────────────────────────────────────────────────────────────── */
:root {
  /* Core Colors */
  --background-color: #F6F5EF;
  --primary-color: #A47864;
  --primary-color-light: rgba(164, 120, 100, 0.8);

  /* Text Colors */
  --text-primary: rgba(0, 0, 0, 0.87);
  --text-secondary: rgba(0, 0, 0, 0.54);
  --text-on-primary: #FFFFFF;
  --text-on-color: #222222;

  /* Shadow Colors */
  --light-shadow: rgba(255, 255, 255, 0.9);
  --dark-shadow: rgba(0, 0, 0, 0.25);
  --light-shadow-soft: rgba(255, 255, 255, 0.7);
  --dark-shadow-soft: rgba(0, 0, 0, 0.15);

  /* Border Radius */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Shadows */
  --shadow-raised: -4px -4px 15px var(--light-shadow), 4px 4px 15px var(--dark-shadow);
  --shadow-raised-sm: -2px -2px 8px var(--light-shadow), 2px 2px 8px var(--dark-shadow);
  --shadow-inset: inset 4px 4px 15px var(--dark-shadow-soft), inset -4px -4px 15px var(--light-shadow);
  --shadow-inset-sm: inset 2px 2px 8px var(--dark-shadow-soft), inset -2px -2px 8px var(--light-shadow);

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 24px;
  --font-size-3xl: 32px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease-out;

  /* Layout */
  --max-content-width: 600px;
  --page-padding: 4%;
}

/* ───────────────────────────────────────────────────────────────
   Base Reset & Typography
   ─────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

img {
  max-width: 100%;
  height: auto;
}

/* ───────────────────────────────────────────────────────────────
   Claymorphic Container
   ─────────────────────────────────────────────────────────────── */
.clay-container {
  background-color: var(--background-color);
  border-radius: var(--radius-sm);
  transition: box-shadow var(--transition-fast);
}

.clay-container--raised {
  box-shadow: var(--shadow-raised);
}

.clay-container--raised-sm {
  box-shadow: var(--shadow-raised-sm);
}

.clay-container--inset {
  box-shadow: var(--shadow-inset);
}

.clay-container--inset-sm {
  box-shadow: var(--shadow-inset-sm);
}

/* Dark shadow variant (both shadows are dark) */
.clay-container--dark-shadow {
  box-shadow:
    2px 2px 4px var(--dark-shadow),
    -2px -2px 4px var(--dark-shadow-soft);
}

/* ───────────────────────────────────────────────────────────────
   Claymorphic Text (Embossed Effect)
   ─────────────────────────────────────────────────────────────── */
.clay-text {
  color: var(--background-color);
  text-shadow:
    -1.2px -1.2px 0 rgba(255, 255, 255, 0.9),
    1px 1px 0 rgba(0, 0, 0, 0.15);
}

.clay-text--dark {
  color: var(--text-primary);
  text-shadow:
    -0.8px -0.8px 0 rgba(255, 255, 255, 0.6),
    0.8px 0.8px 0 rgba(0, 0, 0, 0.1);
}

/* ───────────────────────────────────────────────────────────────
   Claymorphic Button
   ─────────────────────────────────────────────────────────────── */
.clay-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  font-size: var(--font-size-lg);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-lg);
  background-color: var(--background-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-raised-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  user-select: none;
}

.clay-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.clay-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-inset-sm);
}

.clay-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary button (gradient) */
.clay-button--primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-color-light));
  color: var(--text-on-primary);
}

.clay-button--primary:active:not(:disabled) {
  background: linear-gradient(135deg, rgba(164, 120, 100, 0.9), var(--primary-color-light));
}

/* Secondary button (outline) */
.clay-button--secondary {
  background-color: var(--background-color);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

/* Small button */
.clay-button--sm {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-md);
}

/* ───────────────────────────────────────────────────────────────
   Claymorphic Input / Textarea
   ─────────────────────────────────────────────────────────────── */
.clay-input {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--font-size-lg);
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  background-color: var(--background-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-inset-sm);
  transition: box-shadow var(--transition-fast);
  resize: none;
}

.clay-input:focus {
  outline: none;
  box-shadow: var(--shadow-inset);
}

.clay-input::placeholder {
  color: var(--text-secondary);
}

/* ───────────────────────────────────────────────────────────────
   Claymorphic Checkbox / Toggle
   ─────────────────────────────────────────────────────────────── */
.clay-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.clay-checkbox input {
  display: none;
}

.clay-checkbox__box {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  background-color: var(--background-color);
  box-shadow: var(--shadow-inset-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.clay-checkbox input:checked + .clay-checkbox__box {
  background-color: var(--primary-color);
  box-shadow: var(--shadow-raised-sm);
}

.clay-checkbox__icon {
  color: var(--text-on-primary);
  font-size: 16px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.clay-checkbox input:checked + .clay-checkbox__box .clay-checkbox__icon {
  opacity: 1;
}

.clay-checkbox__label {
  font-size: var(--font-size-md);
  color: var(--text-primary);
}

/* ───────────────────────────────────────────────────────────────
   Claymorphic Toggle Button (Pill)
   ─────────────────────────────────────────────────────────────── */
.clay-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 12px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-lg);
  background-color: var(--background-color);
  color: var(--primary-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.clay-toggle:hover {
  background-color: rgba(164, 120, 100, 0.05);
}

.clay-toggle--active {
  background-color: var(--primary-color);
  color: var(--text-on-primary);
}

.clay-toggle--active:hover {
  background-color: var(--primary-color);
}

.clay-toggle__icon {
  font-size: 14px;
}

/* ───────────────────────────────────────────────────────────────
   Neumorphic Icon (3-Layer Stack)
   ─────────────────────────────────────────────────────────────── */
.neumorphic-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.neumorphic-icon__layer {
  position: absolute;
}

.neumorphic-icon__layer--shadow {
  color: rgba(0, 0, 0, 0.18);
  transform: translate(1px, 1px);
}

.neumorphic-icon__layer--highlight {
  color: rgba(255, 255, 255, 0.7);
  transform: translate(-1.2px, -1.2px);
}

.neumorphic-icon__layer--main {
  position: relative;
  color: var(--background-color);
}

/* ───────────────────────────────────────────────────────────────
   Avatar / Profile Picture
   ─────────────────────────────────────────────────────────────── */
.clay-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  overflow: hidden;
  box-shadow: var(--shadow-raised-sm);
}

.clay-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clay-avatar--sm {
  width: 40px;
  height: 40px;
}

.clay-avatar--lg {
  width: 80px;
  height: 80px;
}

.clay-avatar--xl {
  width: 100px;
  height: 100px;
}

/* Avatar with initial letter */
.clay-avatar__initial {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  font-weight: 600;
  color: var(--text-on-primary);
  background-color: var(--text-secondary);
}

/* ───────────────────────────────────────────────────────────────
   Loading Spinner
   ─────────────────────────────────────────────────────────────── */
.clay-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--background-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.clay-spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.clay-spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.clay-spinner--on-primary {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: var(--text-on-primary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ───────────────────────────────────────────────────────────────
   Skeleton Loading
   ─────────────────────────────────────────────────────────────── */
.clay-skeleton {
  background: linear-gradient(
    90deg,
    var(--background-color) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    var(--background-color) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.clay-skeleton--circle {
  border-radius: 50%;
}

.clay-skeleton--text {
  height: 1em;
  margin-bottom: 0.5em;
}

.clay-skeleton--text:last-child {
  width: 70%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ───────────────────────────────────────────────────────────────
   Toast Notification
   ─────────────────────────────────────────────────────────────── */
.clay-toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.clay-toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background-color: var(--text-primary);
  color: var(--background-color);
  font-size: var(--font-size-md);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease-out;
  max-width: 90vw;
  text-align: center;
}

.clay-toast--success {
  background-color: #4CAF50;
  color: white;
}

.clay-toast--error {
  background-color: #F44336;
  color: white;
}

.clay-toast--warning {
  background-color: #FF9800;
  color: white;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ───────────────────────────────────────────────────────────────
   Utility Classes
   ─────────────────────────────────────────────────────────────── */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-on-primary { color: var(--text-on-primary); }

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ───────────────────────────────────────────────────────────────
   Responsive Breakpoints
   ─────────────────────────────────────────────────────────────── */
@media (min-width: 480px) {
  :root {
    --page-padding: 5%;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-md: 15px;
    --font-size-lg: 17px;
    --font-size-xl: 19px;
  }
}

@media (min-width: 768px) {
  :root {
    --page-padding: 8%;
    --max-content-width: 640px;
  }
}

@media (min-width: 1024px) {
  :root {
    --page-padding: 10%;
    --max-content-width: 680px;
  }
}

/* ───────────────────────────────────────────────────────────────
   Desktop Centering & Card Layout
   ─────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

/* ───────────────────────────────────────────────────────────────
   Fluid Typography Utilities
   ─────────────────────────────────────────────────────────────── */
.text-fluid-sm {
  font-size: clamp(12px, 3vw, 14px);
}

.text-fluid-md {
  font-size: clamp(14px, 3.5vw, 16px);
}

.text-fluid-lg {
  font-size: clamp(16px, 4vw, 18px);
}

.text-fluid-xl {
  font-size: clamp(18px, 4.5vw, 22px);
}
