/* ═══════════════════════════════════════════════════════════════
   Store Communications Portal — base.css
   Design system: variables, reset, typography
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand palette */
  --color-primary:     #1A3C5E;
  --color-primary-2:   #2E6DA4;
  --color-primary-3:   #4A90C4;
  --color-accent:      #E8F0F8;
  --color-accent-2:    #C9DDF0;

  /* Semantic */
  --color-success:     #2E7D32;
  --color-success-bg:  #E8F5E9;
  --color-warning:     #E65100;
  --color-warning-bg:  #FFF3E0;
  --color-danger:      #C62828;
  --color-danger-bg:   #FFEBEE;
  --color-info:        #0277BD;
  --color-info-bg:     #E1F5FE;

  /* Neutrals */
  --color-text:        #1A1A1A;
  --color-text-muted:  #666666;
  --color-text-light:  #999999;
  --color-bg:          #FFFFFF;
  --color-bg-2:        #F5F7FA;
  --color-bg-3:        #EEF2F7;
  --color-border:      #E0E0E0;
  --color-border-2:    #C8D0DC;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.14), 0 8px 16px rgba(0,0,0,0.08);

  /* Typography */
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;

  /* Transitions */
  --transition-fast:   all 0.12s ease;
  --transition-normal: all 0.22s ease;
  --transition-slow:   all 0.35s ease;

  /* Layout */
  --sidebar-width:        240px;
  --sidebar-width-tablet: 64px;
  --header-height:        60px;
  --bottom-nav-height:    64px;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg-2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; display: block; }
a { color: var(--color-primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.875rem; }
h6 { font-size: 0.8125rem; }

.display-font { font-family: var(--font-display); }
.text-muted   { color: var(--color-text-muted); }
.text-sm      { font-size: 0.8125rem; }
.text-xs      { font-size: 0.75rem; }
.text-lg      { font-size: 1.0625rem; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

/* ─── Utility ───────────────────────────────────────────────── */
.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;
}
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-2); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-light); }

/* ─── Focus ring ────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary-2);
  outline-offset: 2px;
}

/* ─── Loading states ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg-3) 25%, var(--color-border) 50%, var(--color-bg-3) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Fade in animation ─────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.28s ease both; }

/* ─── Spin animation ────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* ─── Toast notifications ───────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: all;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-text);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
