/* ==========================================================
   NHNW Shared Design Tokens — variables.css
   Import this file first on every page.
   ========================================================== */

/* ── Font ── */
@import url("https://fonts.cdnfonts.com/css/inter");

/* ── Design Tokens (Light Mode) ── */
:root {
  /* Backgrounds */
  --bg:        #ffffff;
  --surface:   #f9f9f9;
  --surface-2: #f2f2f2;

  /* Text */
  --text:      #111111;
  --text-muted:#555555;
  --text-light:#888888;

  /* Accent / brand (black on light) */
  --accent:    #000000;
  --accent-fg: #ffffff;   /* text on --accent bg */

  /* Borders & radius */
  --border:    #e0e0e0;
  --border-2:  #cccccc;
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  /* Status colours (subtle, works on both modes) */
  --color-success:    #16a34a;
  --color-success-bg: #f0fdf4;
  --color-warning:    #b45309;
  --color-warning-bg: #fffbeb;
  --color-danger:     #dc2626;
  --color-danger-bg:  #fef2f2;
  --color-info:       #0369a1;
  --color-info-bg:    #f0f9ff;

  /* Grays */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Spacing */
  --pad: 24px;
  --gutter: 16px;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-size-sm:  0.875rem;
  --font-size-base:1rem;
  --font-size-lg:  1.125rem;
  --font-size-xl:  1.25rem;
  --font-size-2xl: 1.5rem;

  /* Transition */
  --transition: 150ms ease;
}

/* ── Dark Mode ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #111111;
    --surface:   #1c1c1c;
    --surface-2: #252525;

    --text:      #f0f0f0;
    --text-muted:#aaaaaa;
    --text-light:#777777;

    --accent:    #ffffff;
    --accent-fg: #000000;

    --border:    #2e2e2e;
    --border-2:  #3a3a3a;

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

    --color-success:    #4ade80;
    --color-success-bg: #052e16;
    --color-warning:    #fbbf24;
    --color-warning-bg: #1c1200;
    --color-danger:     #f87171;
    --color-danger-bg:  #1c0000;
    --color-info:       #38bdf8;
    --color-info-bg:    #0c1a28;

    --gray-50:  #1a1a1a;
    --gray-100: #222222;
    --gray-200: #2d2d2d;
    --gray-300: #3a3a3a;
    --gray-400: #525252;
    --gray-500: #737373;
    --gray-600: #a3a3a3;
    --gray-700: #d4d4d4;
    --gray-800: #e5e5e5;
    --gray-900: #f5f5f5;
  }
}

/* ── Global Reset ── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: #111111;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img, video { max-width: 100%; height: auto; display: block; }

/* ── Shared Utilities ── */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.06);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
  text-decoration: none;
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.btn:focus-visible {
  outline: 3px solid rgba(0,0,0,0.18);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
  box-shadow: none;
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Loading state */
.btn-loading {
  pointer-events: none;
  opacity: 0.65;
  position: relative;
}
.btn-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: nhnw-spin 0.7s linear infinite;
  margin-left: 8px;
}
@keyframes nhnw-spin { to { transform: rotate(360deg); } }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--pad);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-success  { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning  { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger   { background: var(--color-danger-bg);  color: var(--color-danger);  }
.badge-info     { background: var(--color-info-bg);    color: var(--color-info);    }
.badge-neutral  { background: var(--surface-2);        color: var(--text-muted);    }

/* Form elements */
.field-error {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--color-danger);
}
.input-error {
  border-color: var(--color-danger) !important;
  outline-color: var(--color-danger) !important;
}

/* Capacity bar */
.capacity-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.capacity-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
  background: var(--accent);
}
.capacity-fill.cap-warning { background: var(--color-warning); }
.capacity-fill.cap-danger  { background: var(--color-danger);  }

/* ── Toast Notifications ── */
#toast-root {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
  width: calc(100vw - 40px);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  pointer-events: auto;
  animation: nhnw-toast-in 0.22s ease forwards;
  font-size: var(--font-size-sm);
  line-height: 1.45;
  word-break: break-word;
}
.toast.toast-exit {
  animation: nhnw-toast-out 0.22s ease forwards;
}
.toast-icon { flex-shrink: 0; font-size: 1.1rem; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 700; margin-bottom: 2px; }
.toast-msg   { color: var(--text-muted); }

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error   { border-left: 4px solid var(--color-danger);  }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info    { border-left: 4px solid var(--color-info);    }

@keyframes nhnw-toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0);    }
}
@keyframes nhnw-toast-out {
  from { opacity: 1; transform: translateX(0);    }
  to   { opacity: 0; transform: translateX(24px); }
}

/* ── Password Strength Meter ── */
.pw-strength-wrap { margin-top: 8px; }
.pw-strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.pw-strength-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}
.pw-rules { display: flex; flex-wrap: wrap; gap: 6px; }
.pw-rule {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}
.pw-rule.ok {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: transparent;
}

/* ── Notification Bell ── */
.notif-trigger {
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.notif-badge {
  position: absolute;
  top: 0; right: 0;
  background: var(--color-danger);
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  max-height: 400px;
  overflow-y: auto;
}
.notif-dropdown.open { display: block; }
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--surface); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { font-weight: 600; }
.notif-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: var(--font-size-sm); }

/* ── Print ── */
@media print {
  .no-print, .actions, button, .btn { display: none !important; }
  body { background: #fff !important; color: #000 !important; padding: 0 !important; }
}
