/*!
 * ZippyMeals — base.css
 * ---------------------
 * Project: ZippyMeals (UI Foundation / Design Tokens / Base Components)
 * Author : Mayank Chawdhari (BOSS294)
 * Version: 1.0.0
 * Build  : 2025-11-06
 * License: Copyright (c) 2025 ZippyMeals. All rights reserved.
 * Trademark: "ZippyMeals" is a trademark of ZippyMeals Private Limited.
 *
 * Description:
 *   This file contains the core CSS design tokens, utility variables,
 *   reset, base typography, layout helpers, and canonical button styles
 *   used across the ZippyMeals website and admin surfaces.
 *
 * Changelog:
 *   1.0.0 — Initial production-ready token set + buttons + toasts + helpers.
 *
 * Creator / Developer:
 *   Mayank Chawdhari (BOSS294)
 *
 * HOW TO USE / INTEGRATE
 * ----------------------
 * 1) Include this file globally (recommended in <head>):
 *      <link rel="stylesheet" href="/assets/styles/base.css">
 *
 * 2) Fonts:
 *    - This CSS defines token names for font stacks ( --font-sans / --font-display ).
 *    - Import desired web fonts in your HTML (Google Fonts / local) and then
 *      optionally override the font tokens via :root or theme variables.
 *
 * 3) Theming:
 *    - The file exposes CSS variables under :root for the default theme.
 *    - To create alternate themes, set variables on body[data-theme="theme-id"]
 *      or on .theme--<name> selectors. Example:
 *
 *      body[data-theme="ember-coal"] {
 *        --color-bg: #0b0b0c;
 *        --color-surface: #151515;
 *        --color-accent: #ff6b6b;
 *        --color-accent-2: #ffd166;
 *      }
 *
 * 4) Buttons:
 *    - Use the .btn base and modifier classes:
 *        <button class="btn btn--primary">Order Now</button>
 *        <button class="btn btn--outline btn--sm">Save</button>
 *
 *    - Available modifiers:
 *        .btn--primary  (solid CTA)
 *        .btn--accent   (alternate solid)
 *        .btn--outline  (glass / outline)
 *        .btn--danger   (destructive)
 *        .btn--sm       (small)
 *        .btn--lg       (large)
 *
 * 5) Toasts:
 *    - Container: .toasts  (fixed container)
 *    - Each toast should use .toast and .toast--<type> for visuals
 *      (the JavaScript in your app can create the DOM nodes).
 *
 * 6) Utilities:
 *    - Use .card, .container, .row, .col, .muted, .pill when building components.
 *
 * Accessibility / Best Practices:
 *    - Buttons include strong focus styles and reduced motion fallbacks.
 *    - Use semantic HTML (button, header, main, nav) and aria-* attributes.
 *    - Respect prefers-reduced-motion queries in JS & CSS.
 *
 * NOTES:
 *   - This file is intentionally token-first. Changing a few variables at the top
 *     will propagate across all components.
 *   - Keep this file loaded before component-specific CSS so those components can
 *     leverage tokens and override only what they need.
 */

/* =========================
   DESIGN TOKENS (variables)
   ========================= */
:root{
  /* --- Color scale (dark theme base) --- */
  --color-bg: #0b0b0d;            /* page background */
  --color-bg-2: #121217;          /* elevated background */
  --color-surface: #0f1316;       /* cards / panels */
  --color-panel: #12161a;         /* alternate surface */
  --color-glass: rgba(255,255,255,0.02);

  /* accents */
  --color-accent: #ff6b6b;        /* primary accent (CTA) */
  --color-accent-2: #ffd166;      /* warm secondary accent */
  --color-accent-3: #4ab3ff;      /* cool accent */

  /* semantic */
  --color-success: #9ef0b0;
  --color-info: #bfeaff;
  --color-warn: #ffd99a;
  --color-danger: #ffb6b6;

  /* text */
  --color-text: #e6eef6;
  --color-muted: #9fb3d2;
  --color-faint: rgba(230,238,246,0.12);

  /* borders & dividers */
  --color-border: rgba(255,255,255,0.03);
  --color-divider: rgba(255,255,255,0.02);

  /* Elevation / shadows */
  --shadow-1: 0 6px 18px rgba(2,6,12,0.55);
  --shadow-2: 0 12px 30px rgba(2,6,12,0.62);
  --shadow-3: 0 20px 50px rgba(2,6,12,0.7);
  --shadow-inset: inset 0 -6px 18px rgba(0,0,0,0.36);

  /* Spacing */
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 36px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Typography stacks (tokens — override these if you import different fonts) */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Poppins", var(--font-sans);
  --font-mono: "ui-monospace","SFMono-Regular","Menlo","Monaco","Roboto Mono",monospace;

  /* Type scale */
  --type-base: 16px;
  --type-xs: 12px;
  --type-sm: 14px;
  --type-md: 16px;
  --type-lg: 20px;
  --type-xl: 28px;

  /* Transitions */
  --ease-slow: cubic-bezier(.2,.9,.2,1);
  --transition-fast: 150ms;
  --transition-default: 220ms;

  /* Buttons tokenized */
  --btn-radius: var(--radius-md);
  --btn-padding-y: 10px;
  --btn-padding-x: 14px;
  --btn-min-height: 44px;

  --btn-solid-bg: linear-gradient(180deg, var(--color-accent) 0%, color-mix(in srgb, var(--color-accent) 80%, black 10%) 100%);
  --btn-solid-color: #071017;
  --btn-solid-border: rgba(255,255,255,0.06);

  --btn-outline-bg: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.006));
  --btn-outline-color: var(--color-text);
  --btn-outline-border: rgba(255,255,255,0.06);

  /* Toasts */
  --toast-width: 340px;
  --toast-bg: linear-gradient(180deg, rgba(255,255,255,0.018), rgba(255,255,255,0.006));
  --toast-border: rgba(255,255,255,0.03);

  /* Accessibility */
  --focus-ring: 3px;
  --focus-color: color-mix(in srgb, var(--color-accent) 60%, white 40%);
}

/* =========================
   RESET / BASE
   ========================= */
*,
*::before,
*::after { box-sizing: border-box; }

html { font-size: var(--type-base); -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
.scroll-target-focus:focus {
  outline: 3px solid color-mix(in srgb, var(--color-accent) 65%, white 35%);
  outline-offset: 6px;
  border-radius: 8px;
}
/* small subtle active nav highlight for scroll-spy */
.zm-scroll-active { color: var(--color-accent); font-weight: 800; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

/* make images behave */
img, picture, video { max-width: 100%; height: auto; display: block; }

/* default link */
a { color: var(--color-accent-3); text-decoration: none; }
a:hover { text-decoration: underline; }

/* structural helpers */
.container { max-width: 1180px; margin-left: auto; margin-right: auto; padding-left: var(--space-md); padding-right: var(--space-md); }
.row { display:flex; gap: var(--space-md); align-items:center; }
.col { display:flex; flex-direction:column; gap: var(--space-sm); }

/* cards & surfaces */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.007));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  padding: var(--space-md);
}

/* small subtle glass panel */
.panel {
  background: var(--btn-outline-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
}

/* text utilities */
.h1 { font-family: var(--font-display); font-size: var(--type-xl); font-weight:700; margin:0 0 var(--space-sm) 0; color:var(--color-text); }
.h2 { font-family: var(--font-display); font-size: var(--type-lg); font-weight:700; margin:0 0 var(--space-xs) 0; }
.lead { font-size: var(--type-md); color: var(--color-muted); margin:0; }

/* small helpers */
.muted { color: var(--color-muted); font-size: var(--type-sm); }
.small { font-size: var(--type-sm); color: var(--color-muted); }

/* pills */
.pill {
  display:inline-block;
  padding: 6px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text);
  font-weight:700;
  font-size: 13px;
}

/* =========================
   BUTTONS (canonical)
   ========================= */

/* Base button (use semantic <button> elements) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--btn-padding-y) var(--btn-padding-x);
  min-height: var(--btn-min-height);
  height: auto;
  border-radius: var(--btn-radius);
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  border: 0;
  outline: none;
  transition: transform var(--transition-default) var(--ease-slow),
              box-shadow var(--transition-default),
              filter var(--transition-fast);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  color: var(--btn-solid-color);
  background: var(--btn-solid-bg);
  box-shadow: var(--shadow-1), var(--shadow-inset);
  border: 1px solid var(--btn-solid-border);
}

/* size modifiers */
.btn--sm { padding: 8px 10px; min-height: 36px; font-size: .93rem; border-radius: 10px; }
.btn--lg { padding: 14px 18px; min-height: 52px; font-size: 1.05rem; border-radius: var(--radius-lg); }

/* Hover: 3D lift (solid) */
.btn:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-3), var(--shadow-inset);
  filter: brightness(1.03);
}

/* Active (pressed) */
.btn:active {
  transform: translateY(2px) scale(.995);
  box-shadow: var(--shadow-1);
}

/* Focus visible (keyboard) */
.btn:focus-visible {
  box-shadow: 0 10px 30px rgba(2,6,12,0.45), 0 0 0 var(--focus-ring) var(--focus-color);
  border-color: color-mix(in srgb, var(--color-accent) 60%, white 30%);
}

/* Variant: primary (solid) - token-driven */
.btn--primary {
  background: var(--btn-solid-bg);
  color: var(--btn-solid-color);
  border: 1px solid var(--btn-solid-border);
}

/* Variant: accent (alternate solid) */
.btn--accent {
  background: linear-gradient(180deg, var(--color-accent-3) 0%, color-mix(in srgb, var(--color-accent-3) 75%, black 10%) 100%);
  color: #031016;
  border: 1px solid rgba(255,255,255,0.04);
  box-shadow: var(--shadow-1), var(--shadow-inset);
}

/* Variant: outline / glass */
.btn--outline {
  background: var(--btn-outline-bg);
  color: var(--btn-outline-color);
  border: 1.2px solid var(--btn-outline-border);
  box-shadow: 0 10px 30px rgba(2,6,12,0.55), var(--shadow-inset);
  backdrop-filter: blur(6px);
}
.btn--outline:hover {
  border-color: rgba(255,255,255,0.09);
}

/* Variant: danger */
.btn--danger {
  background: linear-gradient(180deg, var(--color-danger) 0%, color-mix(in srgb, var(--color-danger) 80%, black 10%) 100%);
  color: #120607;
  border: 1px solid rgba(255,255,255,0.04);
}

/* Icon helpers in button */
.btn .ico { display:inline-flex; align-items:center; justify-content:center; font-size:16px; line-height:1; }

/* Disabled */
.btn[disabled],
.btn.disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* =========================
   TOASTS
   ========================= */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  width: var(--toast-width);
  display:flex;
  gap:12px;
  align-items:center;
  padding:12px;
  border-radius: 12px;
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  box-shadow: var(--shadow-3);
  transform-origin: right bottom;
  transform: translateY(12px) scale(.98);
  opacity: 0;
  transition: transform .28s var(--ease-slow), opacity .28s;
  font-weight: 600;
}

.toast.show { transform: translateY(0) scale(1); opacity: 1; }

.toast__icon {
  width:44px;
  height:44px;
  border-radius:10px;
  display:grid;
  place-items:center;
  font-weight:800;
  flex: 0 0 44px;
  color: #071017;
}

.toast__body {
  flex:1;
  color: var(--color-text);
  font-size: 14px;
}

.toast__close {
  background: transparent;
  border: 0;
  color: var(--color-muted);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
}

/* type tokens for toast icon backgrounds (used by JS to set class) */
.toast--success .toast__icon { background: linear-gradient(180deg, #dff9e6, #9ef0b0); color: #03371f; }
.toast--info    .toast__icon { background: linear-gradient(180deg, #dff6ff, #bfeaff); color: #042a36; }
.toast--warn    .toast__icon { background: linear-gradient(180deg, #fff6e0, #ffd99a); color: #3d2a00; }
.toast--error   .toast__icon { background: linear-gradient(180deg, #ffdede, #ffb6b6); color: #3a0b0b; }

/* =========================
   OTHER UTILITIES
   ========================= */

/* tiny input reset */
.input {
  display:inline-block;
  padding:8px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.005));
  color: var(--color-text);
  outline: none;
  transition: box-shadow .18s;
}
.input:focus { box-shadow: 0 8px 24px rgba(2,6,12,0.45), 0 0 0 var(--focus-ring) var(--focus-color); }

/* subtle divider */
.hr { height:1px; background: var(--color-divider); border-radius:1px; }

/* responsive helpers */
@media (max-width: 980px) {
  :root { --toast-width: 90vw; }
  .container { padding-left: 14px; padding-right: 14px; }
}
  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 43, 43, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(255, 43, 43, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 43, 43, 0); }
  }
/* reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .btn, .toast, .card, .panel { transition: none !important; animation: none !important; }
}

/* =========================
   THEME EXAMPLES (usage)
   ========================= */
/* Example: set an alternate theme by overriding tokens on a selector
   Place these in a separate theme file or inside <style> when toggling themes. */

/*
body[data-theme="ember-coal"] {
  --color-bg: #0b0b0c;
  --color-bg-2: #151515;
  --color-surface: #151515;
  --color-accent: #ff6b6b;
  --color-accent-2: #ffd166;
  --color-accent-3: #ffb86b;
  --color-text: #fff2f2;
}

body[data-theme="ocean-midnight"] {
  --color-bg: #031b2a;
  --color-bg-2: #072835;
  --color-surface: #072835;
  --color-accent: #2dd4bf;
  --color-accent-2: #7ce7d8;
  --color-accent-3: #4ab3ff;
  --color-text: #d7fbfa;
}
*/

/* =========================
   END OF base.css
   ========================= */
