/* ==========================================================================
   Friendse — FP UI Kit  (fp-ui-kit.css)
   --------------------------------------------------------------------------
   Site-wide design system: unique brand tokens, typography, buttons, inputs,
   cards, chips, and a modern mobile-first polish layer.

   IMPORTANT: this file does NOT hijack the existing theme system
   (friende-themes.css). Themes keep controlling --c-* variables. This file
   only ADDS a brand layer (--fp-*) plus shared components, so nothing that
   already works breaks.

   Load AFTER friende-themes.css.
   ========================================================================== */

:root {
  /* ---- Unique brand identity (not Facebook blue) ---- */
  --fp-brand:        #4F46E5;  /* indigo violet   */
  --fp-brand-2:      #7C3AED;  /* violet          */
  --fp-brand-3:      #06B6D4;  /* cyan spark      */
  --fp-brand-ink:    #ffffff;
  --fp-accent:       #10B981;  /* success green   */
  --fp-danger:       #EF4444;
  --fp-warn:         #F59E0B;

  --fp-gradient:      linear-gradient(135deg, var(--fp-brand) 0%, var(--fp-brand-2) 55%, var(--fp-brand-3) 130%);
  --fp-gradient-soft: linear-gradient(135deg,
                        color-mix(in srgb, var(--fp-brand) 12%, transparent),
                        color-mix(in srgb, var(--fp-brand-3) 10%, transparent));

  /* ---- Elevation ---- */
  --fp-shadow-xs: 0 1px 2px rgba(16,24,40,.06);
  --fp-shadow-sm: 0 2px 8px rgba(16,24,40,.07);
  --fp-shadow-md: 0 8px 24px rgba(16,24,40,.10);
  --fp-shadow-lg: 0 22px 60px rgba(16,24,40,.14);
  --fp-ring:      0 0 0 3px color-mix(in srgb, var(--fp-brand) 22%, transparent);

  /* ---- Shape & rhythm ---- */
  --fp-r-sm: 10px;
  --fp-r:    14px;
  --fp-r-lg: 20px;
  --fp-r-pill: 999px;

  /* ---- Motion ---- */
  --fp-ease: cubic-bezier(.22,.61,.36,1);
  --fp-fast: .16s var(--fp-ease);
  --fp-slow: .32s var(--fp-ease);

  /* ---- Safe areas (notch phones) ---- */
  --fp-safe-t: env(safe-area-inset-top, 0px);
  --fp-safe-b: env(safe-area-inset-bottom, 0px);
}

html.dark {
  --fp-shadow-md: 0 8px 24px rgba(0,0,0,.45);
  --fp-shadow-lg: 0 22px 60px rgba(0,0,0,.55);
}

/* ==========================================================================
   1. Base polish
   ========================================================================== */

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--friende-font, 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;            /* kills sideways scroll on phones */
}

/* Nothing may push the page wider than the screen. */
img, video, canvas, svg, iframe, table { max-width: 100%; }
img, video { height: auto; }
pre, code { white-space: pre-wrap; word-break: break-word; }

h1, h2, h3, h4 { font-family: var(--friende-heading-font, inherit); letter-spacing: -.015em; }

::selection { background: color-mix(in srgb, var(--fp-brand) 26%, transparent); }

/* Slim, modern scrollbars (desktop only — phones hide them anyway). */
@media (min-width: 1025px) {
  * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--c-text, #111) 22%, transparent) transparent; }
  *::-webkit-scrollbar { width: 9px; height: 9px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--c-text, #111) 18%, transparent);
    border-radius: 99px; border: 2px solid transparent; background-clip: content-box;
  }
  *::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--fp-brand) 55%, transparent); background-clip: content-box; }
}

/* Visible, accessible focus for keyboard users only. */
:focus-visible { outline: 2px solid var(--fp-brand); outline-offset: 2px; border-radius: 6px; }

/* ==========================================================================
   2. Buttons
   ========================================================================== */

.fp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 18px;
  font-size: 15px; font-weight: 700; line-height: 1;
  border: 1px solid transparent; border-radius: var(--fp-r);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform var(--fp-fast), filter var(--fp-fast), background var(--fp-fast), box-shadow var(--fp-fast);
  -webkit-tap-highlight-color: transparent;
}
.fp-btn:active { transform: translateY(1px) scale(.995); }
.fp-btn[disabled], .fp-btn.is-loading { opacity: .6; pointer-events: none; }

.fp-btn--brand   { background: var(--fp-gradient); color: var(--fp-brand-ink); box-shadow: 0 8px 20px color-mix(in srgb, var(--fp-brand) 28%, transparent); }
.fp-btn--brand:hover { filter: brightness(1.07); }
.fp-btn--solid   { background: var(--c-primary, var(--fp-brand)); color: #fff; }
.fp-btn--soft    { background: color-mix(in srgb, var(--fp-brand) 12%, transparent); color: var(--fp-brand); }
.fp-btn--ghost   { background: transparent; color: var(--c-text, #111); border-color: var(--c-border, #e5e7eb); }
.fp-btn--ghost:hover { background: color-mix(in srgb, var(--c-text, #111) 5%, transparent); }
.fp-btn--danger  { background: var(--fp-danger); color: #fff; }
.fp-btn--block   { width: 100%; }
.fp-btn--sm      { min-height: 36px; padding: 8px 14px; font-size: 13.5px; border-radius: var(--fp-r-sm); }
.fp-btn--pill    { border-radius: var(--fp-r-pill); }

/* ==========================================================================
   3. Form controls
   ========================================================================== */

.fp-field { display: block; margin-bottom: 14px; }
.fp-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--c-text, #111); }
.fp-hint  { font-size: 12.5px; margin-top: 6px; color: var(--c-text-muted, #6b7280); line-height: 1.5; }

.fp-input, .fp-select, .fp-textarea {
  width: 100%;
  /* 16px keeps iOS Safari from zooming the page on focus. */
  font-size: 16px; line-height: 1.4;
  padding: 13px 15px; min-height: 48px;
  color: var(--c-text, #111);
  background: var(--c-bg, #fff);
  border: 1.5px solid var(--c-border, #e5e7eb);
  border-radius: var(--fp-r);
  outline: none; appearance: none;
  transition: border-color var(--fp-fast), box-shadow var(--fp-fast), background var(--fp-fast);
}
.fp-textarea { min-height: 120px; resize: vertical; }
.fp-input::placeholder, .fp-textarea::placeholder { color: color-mix(in srgb, var(--c-text-muted, #6b7280) 85%, transparent); }
.fp-input:focus, .fp-select:focus, .fp-textarea:focus {
  border-color: var(--fp-brand); box-shadow: var(--fp-ring); background: var(--c-surface, #fff);
}
.fp-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 17px;
  padding-right: 42px;
}
html[dir="rtl"] .fp-select { background-position: left 14px center; padding-right: 15px; padding-left: 42px; }

/* ==========================================================================
   4. Surfaces
   ========================================================================== */

.fp-card {
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: var(--fp-r-lg);
  box-shadow: var(--fp-shadow-sm);
}
.fp-card--pad { padding: 18px; }
.fp-card--hover { transition: transform var(--fp-fast), box-shadow var(--fp-fast); }
.fp-card--hover:hover { transform: translateY(-2px); box-shadow: var(--fp-shadow-md); }

.fp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--fp-r-pill);
  font-size: 13px; font-weight: 650;
  background: color-mix(in srgb, var(--fp-brand) 10%, transparent);
  color: var(--fp-brand);
}

.fp-divider { height: 1px; background: var(--c-border, #e5e7eb); border: 0; margin: 18px 0; }

/* Section heading used across pages so every page reads the same. */
.fp-page-head { margin: 0 0 16px; }
.fp-page-title { font-size: clamp(21px, 4.6vw, 28px); font-weight: 850; margin: 0; color: var(--c-text, #111); }
.fp-page-sub { font-size: 14px; margin-top: 6px; color: var(--c-text-muted, #6b7280); }

/* Alerts */
.fp-alert { border-radius: var(--fp-r); padding: 12px 14px; font-size: 13.5px; border: 1px solid; margin-bottom: 16px; line-height: 1.5; }
.fp-alert--ok   { color: #15803d; background: color-mix(in srgb, #22c55e 10%, transparent); border-color: color-mix(in srgb, #22c55e 26%, transparent); }
.fp-alert--err  { color: #dc2626; background: color-mix(in srgb, #ef4444 10%, transparent); border-color: color-mix(in srgb, #ef4444 26%, transparent); }
.fp-alert--info { color: var(--fp-brand); background: color-mix(in srgb, var(--fp-brand) 9%, transparent); border-color: color-mix(in srgb, var(--fp-brand) 24%, transparent); }
.fp-alert ul { margin: 0; padding-left: 18px; }

/* Skeleton shimmer used while content loads (perceived speed). */
.fp-skel {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--c-text, #111) 6%, transparent) 25%,
    color-mix(in srgb, var(--c-text, #111) 11%, transparent) 37%,
    color-mix(in srgb, var(--c-text, #111) 6%, transparent) 63%);
  background-size: 400% 100%; animation: fpShimmer 1.3s linear infinite; border-radius: 10px;
}
@keyframes fpShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Entry animations — cheap, GPU friendly. */
.fp-rise { animation: fpRise .42s var(--fp-ease) both; }
@keyframes fpRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fp-fade { animation: fpFade .32s var(--fp-ease) both; }
@keyframes fpFade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
