/* ===================================================================
   STYLE.CSS — Design tokens for ESS FOUR
   Edit the variables in :root to restyle the entire UI in one place.
   Pages use Tailwind utility classes; these tokens are available for
   any custom CSS that still references them (e.g. shade cards in JS).
   =================================================================== */


/* ─── DESIGN TOKENS ──────────────────────────────────────────────────
   All visual decisions live here as CSS custom properties.
   Change a value once → it updates every element that uses it.
   ------------------------------------------------------------------- */
:root {

  /* ── Brand / Accent color ──────────────────────────────────────────
     To change brand: set --color-brand to any hex, update hover/muted/border.
     Example violet: #7c3aed / #8b5cf6 */
  --color-brand:          #1e3a8a;          /* blue-900 / navy  */
  --color-brand-hover:    #1e40af;          /* blue-800        */
  --color-brand-muted:    rgba(30,58,138,0.10);
  --color-brand-border:   rgba(30,58,138,0.20);

  /* ── Page & Surface Backgrounds ──────────────────────────────────── */
  --color-bg-page:        #f9fafb;          /* gray-50  */
  --color-bg-surface:     #ffffff;          /* white    */
  --color-bg-raised:      #f3f4f6;          /* gray-100 */
  --color-bg-hover:       #e5e7eb;          /* gray-200 */

  /* ── Text Colors ─────────────────────────────────────────────────── */
  --color-text-primary:   #111827;          /* gray-900 */
  --color-text-secondary: #4b5563;          /* gray-600 */
  --color-text-muted:     #9ca3af;          /* gray-400 */

  /* ── Border Color ─────────────────────────────────────────────────── */
  --color-border:         #e5e7eb;          /* gray-200 */
  --color-border-soft:    rgba(229,231,235,0.8);

  /* ── Status / Semantic Colors ────────────────────────────────────── */
  --color-success:        #059669;          /* emerald-600 */
  --color-success-bg:     rgba(5,150,105,0.08);
  --color-success-border: rgba(5,150,105,0.20);

  --color-warning:        #d97706;          /* amber-600   */
  --color-warning-bg:     rgba(217,119,6,0.08);
  --color-warning-border: rgba(217,119,6,0.20);

  --color-danger:         #dc2626;          /* red-600     */
  --color-danger-bg:      rgba(220,38,38,0.07);
  --color-danger-border:  rgba(220,38,38,0.20);

  /* ── Typography ──────────────────────────────────────────────────── */
  --font-sans:            'DM Sans',  sans-serif;
  --font-mono:            'DM Mono',  monospace;
}

/* ─── GLOBAL BASE ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--color-bg-page); color: var(--color-text-primary); font-size: 14px; }

/* ─── SIDEBAR LAYOUT ─────────────────────────────────────────────── */
.sd-layout { display: flex; min-height: 100vh; }
.sd-sidebar { width: 220px; height: 100vh; position: fixed; left: 0; top: 0; background: var(--color-bg-surface); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; transition: width 0.22s ease; z-index: 200; overflow: hidden; }
.sd-sidebar.collapsed { width: 64px; }
.sd-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; height: 60px; border-bottom: 1px solid var(--color-border); flex-shrink: 0; gap: 8px; }
.sd-logo-wrap { display: flex; align-items: center; overflow: hidden; flex: 1; min-width: 0; }
.sd-logo-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--color-brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.sd-logo-img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; flex-shrink: 0; }
.sd-logo-name { font-size: 15px; font-weight: 700; margin-left: 10px; white-space: nowrap; transition: opacity 0.22s, width 0.22s; overflow: hidden; }
.sd-sidebar.collapsed .sd-logo-name { opacity: 0; width: 0; margin-left: 0; }
.sd-toggle-btn { background: none; border: 1px solid var(--color-border); border-radius: 6px; width: 26px; height: 26px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--color-text-secondary); }
.sd-toggle-btn .material-symbols-outlined { font-size: 16px; }
.sd-sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0; scrollbar-width: none; }
.sd-sidebar-nav::-webkit-scrollbar { display: none; }
.sd-nav-group { margin-bottom: 4px; }
.sd-nav-group-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-muted); padding: 8px 20px 4px; white-space: nowrap; transition: opacity 0.22s; }
.sd-sidebar.collapsed .sd-nav-group-label { opacity: 0; }
.sd-nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin: 1px 8px; border-radius: 8px; color: var(--color-text-secondary); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; transition: background 0.15s, color 0.15s; }
.sd-nav-link:hover { background: var(--color-bg-raised); color: var(--color-text-primary); }
.sd-nav-link.active { background: var(--color-brand-muted); color: var(--color-brand); }
.sd-nav-link .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }
.sd-sidebar.collapsed .sd-nav-link .sd-link-label { opacity: 0; }
.sd-sidebar.collapsed #sdUserGreeting { opacity: 0; }
.sd-sidebar-search { display: flex; align-items: center; gap: 8px; margin: 2px 10px 6px; padding: 7px 10px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg-raised); flex-shrink: 0; }
.sd-sidebar-search .material-symbols-outlined { font-size: 17px; color: var(--color-text-muted); flex-shrink: 0; }
.sd-sidebar-search input { border: none; background: none; outline: none; font-family: inherit; font-size: 13px; color: var(--color-text-primary); width: 100%; min-width: 0; }
.sd-sidebar-search input::placeholder { color: var(--color-text-muted); }
.sd-sidebar.collapsed .sd-sidebar-search { display: none; }
.sd-main { margin-left: 220px; flex: 1; padding: 28px 24px; transition: margin-left 0.22s ease; }
.sd-main.shifted { margin-left: 64px; }

/* ─── TOASTS ──────────────────────────────────────────────────────── */
/* Fixed to the viewport (not the scrolling page content) so a toast fired
   while the admin is scrolled down/up/middle is still visible. */
#toastContainer { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.mytoast { min-width: 240px; max-width: 360px; padding: 12px 16px; border-radius: 10px; color: #fff; font-size: 13.5px; font-weight: 500; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: sdToastIn 0.25s ease, sdToastOut 0.3s ease 3s forwards; pointer-events: auto; }
.mytoast.success { background: var(--color-success); }
.mytoast.error   { background: var(--color-danger); }
.mytoast.warning { background: var(--color-warning); }
.mytoast.info    { background: var(--color-brand); }
@keyframes sdToastIn  { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes sdToastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(24px); } }
