/* ============================================================
   FragranceDB — main.css
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #ffffff;
  --surface:   #f5f5f5;
  --surface2:  #eeeeee;
  --border:    #e0e0e0;
  --text:      #0a0a0a;
  --muted:     #6b6b6b;
  --accent:    #3a3a3a;
  --header-h:  52px;
  --footer-h:  64px;
  --role-admin:  #e53e3e;
  --role-editor: #d69e2e;
  --role-viewer: #38a169;
  --note-head:   #e53e3e;
  --note-heart:  #d69e2e;
  --note-base:   #38a169;
  --note-free:   #3b82f6;
}

[data-theme="dark"] {
  --bg:      #0d0d0d;
  --surface: #1a1a1a;
  --surface2:#222222;
  --border:  #2a2a2a;
  --text:    #f0f0f0;
  --muted:   #888888;
  --accent:  #c0c0c0;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s, color 0.25s;
}

/* ── HEADER ──────────────────────────────────────────────── */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-h); background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px;
  transition: background 0.25s, border-color 0.25s;
}
.header-left  { width: 25%; display: flex; align-items: center; }
.header-center{ flex: 1; display: flex; align-items: center; justify-content: center; }
.header-right { width: 25%; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

.header-logo { text-decoration: none; display: flex; align-items: center; }
.header-logo img { height: 22px; width: auto; }
#logo-dark { display: none; }
[data-theme="dark"] #logo-light { display: none; }
[data-theme="dark"] #logo-dark  { display: block; }

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 500; letter-spacing: 0.2em;
  color: var(--muted); text-transform: uppercase;
  border: 1px solid var(--border); padding: 3px 10px; border-radius: 2px;
}

.icon-btn {
  width: 36px; height: 36px; border: none; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; color: var(--muted);
  transition: background 0.15s, color 0.15s; position: relative;
  text-decoration: none; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn svg  { width: 18px; height: 18px; stroke-width: 1.5; }
.icon-divider  { width: 1px; height: 20px; background: var(--border); }
.role-dot-h {
  position: absolute; bottom: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--bg);
}

/* ── CONTENT ─────────────────────────────────────────────── */
.content {
  margin-top: var(--header-h);
  margin-bottom: var(--footer-h);
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

.content-centered {
  display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px;
}

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: var(--footer-h); background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex; align-items: stretch;
  transition: background 0.25s, border-color 0.25s;
}
.nav-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; border: none; background: transparent;
  cursor: pointer; color: var(--muted);
  transition: background 0.15s, color 0.15s;
  padding: 6px 2px; position: relative;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { color: var(--text); }
.nav-item.active::before {
  content: ''; position: absolute;
  top: 0; left: 16%; right: 16%;
  height: 2px; background: var(--text); border-radius: 0 0 2px 2px;
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.5; flex-shrink: 0; }
.nav-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase;
  line-height: 1; white-space: nowrap;
}
.nav-item + .nav-item { border-left: 1px solid var(--border); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-card { width: 100%; max-width: 480px; }

.form-title {
  font-size: 16px; font-weight: 600;
  letter-spacing: 0.06em; margin-bottom: 6px;
}
.form-subtitle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 28px;
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
}
.field input, .field select, .field textarea {
  font-family: 'IBM Plex Sans', sans-serif; font-size: 13px;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 2px;
  background: var(--bg); color: var(--text); outline: none;
  transition: border-color 0.15s; width: 100%;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }

.btn-primary {
  width: 100%; height: 40px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  border: none; background: var(--text); color: var(--bg);
  cursor: pointer; border-radius: 2px; margin-bottom: 12px;
  transition: opacity 0.15s;
}
.btn-primary:hover   { opacity: 0.85; }
.btn-primary:disabled{ opacity: 0.3; cursor: not-allowed; }

.btn-toggle {
  display: block; width: 100%; background: none; border: none;
  cursor: pointer; font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em; color: var(--muted);
  text-align: center; padding: 6px 0; transition: color 0.15s;
  text-decoration: none;
}
.btn-toggle:hover { color: var(--text); }

.btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em;
  height: 34px; padding: 0 16px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer; border-radius: 2px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s; text-decoration: none;
}
.btn:hover  { background: var(--surface); color: var(--text); }
.btn.primary{ background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { opacity: 0.85; }
.btn.danger { color: var(--role-admin); border-color: var(--role-admin); }
.btn.danger:hover { background: var(--role-admin); color: #fff; }
.btn svg    { width: 12px; height: 12px; stroke-width: 1.5; }

/* ── NOTICES ─────────────────────────────────────────────── */
.form-notice {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em;
  padding: 8px 12px; border-radius: 2px; margin-bottom: 14px;
}
.form-notice.info    { background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.form-notice.error   { background: #fef2f2; border: 1px solid #fecaca; color: var(--role-admin); }
.form-notice.success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--role-viewer); }
[data-theme="dark"] .form-notice.error   { background: #2d1515; border-color: #7f1d1d; }
[data-theme="dark"] .form-notice.success { background: #1a2e23; border-color: #14532d; }

/* ── ROLE OPTIONS ────────────────────────────────────────── */
.role-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.role-option {
  border: 1px solid var(--border); border-radius: 2px;
  padding: 10px 12px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex; flex-direction: column; gap: 4px;
}
.role-option:hover    { background: var(--surface); }
.role-option.selected { border-color: var(--text); background: var(--surface); }
.role-option input[type="radio"] { display: none; }
.role-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.role-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.role-dot.viewer { background: var(--role-viewer); }
.role-dot.editor { background: var(--role-editor); }
.role-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ── COLLAPSIBLE ─────────────────────────────────────────── */
.collapsible { border: 1px solid var(--border); border-radius: 2px; margin-bottom: 10px; overflow: hidden; }
.collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer; background: var(--surface);
  transition: background 0.15s; user-select: none;
}
.collapsible-header:hover { background: var(--surface2); }
.collapsible-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text);
}
.collapsible-icon { width: 14px; height: 14px; color: var(--muted); transition: transform 0.2s; flex-shrink: 0; }
.collapsible.open .collapsible-icon { transform: rotate(180deg); }
.collapsible-body {
  display: none; max-height: 180px; overflow-y: auto;
  padding: 12px; font-size: 12px; line-height: 1.6;
  color: var(--muted); border-top: 1px solid var(--border);
}
.collapsible.open .collapsible-body { display: block; }

/* ── CHECKBOX ────────────────────────────────────────────── */
.checkbox-field {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 14px; cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
  width: 15px; height: 15px; min-width: 15px;
  border: 1.5px solid var(--border); border-radius: 2px;
  background: var(--bg); cursor: pointer; appearance: none;
  position: relative; margin-top: 2px;
  transition: background 0.15s, border-color 0.15s;
}
.checkbox-field input[type="checkbox"]:checked {
  background: var(--text); border-color: var(--text);
}
.checkbox-field input[type="checkbox"]:checked::after {
  content: ''; position: absolute; inset: 0;
  background: var(--bg);
  clip-path: polygon(20% 50%, 40% 70%, 80% 25%, 85% 30%, 40% 80%, 15% 55%);
}
.checkbox-label { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ── SETTINGS BLOCKS ─────────────────────────────────────── */
.settings-block { margin-bottom: 32px; }
.block-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.block-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text);
}

/* ── NOTE CHIPS ──────────────────────────────────────────── */
.note-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 2px; white-space: nowrap;
}
.note-chip.head  { background: #fef2f2; color: var(--note-head);  border: 1px solid #fecaca; }
.note-chip.heart { background: #fefce8; color: var(--note-heart); border: 1px solid #fde68a; }
.note-chip.base  { background: #f0fdf4; color: var(--note-base);  border: 1px solid #bbf7d0; }
.note-chip.free  { background: #eff6ff; color: var(--note-free);  border: 1px solid #bfdbfe; }
[data-theme="dark"] .note-chip.head  { background: #2d1515; color: #fc8181; border-color: #7f1d1d; }
[data-theme="dark"] .note-chip.heart { background: #2d2510; color: #f6d860; border-color: #78350f; }
[data-theme="dark"] .note-chip.base  { background: #1a2e23; color: #68d391; border-color: #14532d; }
[data-theme="dark"] .note-chip.free  { background: #172554; color: #93c5fd; border-color: #1e3a8a; }

/* ── UTILS ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.muted  { color: var(--muted); }
.mono   { font-family: 'IBM Plex Mono', monospace; }

/* ── 404 ─────────────────────────────────────────────────── */
.page-404 {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
  gap: 16px; text-align: center; color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
}
.page-404 h1 { font-size: 48px; font-weight: 600; color: var(--text); }
.page-404 p  { font-size: 11px; letter-spacing: 0.1em; }
