/* public/style.css */

/* ========== THEME TOKENS ========== */
:root {
  --bg-dark: #0e0e0e;
  --bg-mid: #1a1a1a;
  --text-light: #f0f0f0;
  --muted: #b8b8b8;
  --accent: #ff66cc;
  --accent-2: #4fffb0;
  --accent-light: #ff99dd;
  --error: #ff4c4c;
  --success: #66ff99;
  --warning: #ffd166;
  --border: #333;
  --input-bg: #222;
  --input-border: #444;
  --focus-ring: 0 0 0 3px rgba(255, 102, 204, 0.35);
  --font-main: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;

  /* Sizes */
  --radius: 10px;
  --radius-sm: 6px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
}

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== LAYOUT ========== */
header, footer {
  background: var(--bg-mid);
  padding: var(--space-4);
  text-align: center;
  color: var(--accent-light);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-4);
}

/* ========== NAV ========== */
nav {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

nav a:hover { color: var(--accent-light); }

/* ========== FORMS ========== */
label {
  display: block;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="file"],
select,
textarea {
  width: 100%;
  height: 48px; /* consistent height for text inputs */
  padding: 0 var(--space-4);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 1rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

textarea {
  min-height: 120px;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  resize: vertical;
}

/* Placeholder color */
::placeholder { color: #9a9a9a; }

/* Focus state */
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* Fine-grain groups */
.form-group { margin-bottom: var(--space-5); }
.field-help {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: 0.92rem;
}

/* Inline icon inputs (used by password fields) */
.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-right: 44px; /* room for icon */
}

.input-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
  color: #cfcfcf;
}

.input-icon:hover { color: var(--accent-light); }
.input-icon:active { transform: translateY(-50%) scale(0.98); }

/* Legacy password-wrapper compatibility (still works) */
.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  padding-right: 44px;
}
.password-wrapper svg {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  fill: #cfcfcf;
  cursor: pointer;
  transition: fill .15s ease, transform .05s ease;
}
.password-wrapper svg:hover { fill: var(--accent-light); }
.password-wrapper svg:active { transform: translateY(-50%) scale(0.98); }

/* Email input (if type="email" is used) */
input[type="email"] {
  /* same as others due to unified selector above */
}

/* ========== BUTTONS ========== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: var(--space-5);
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, box-shadow .15s ease;
  box-shadow: 0 6px 18px rgba(255, 102, 204, .15);
}

button:hover, .btn:hover { background: var(--accent-light); }
button:active, .btn:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--accent-2);
  box-shadow: 0 6px 18px rgba(79, 255, 176, .15);
}
.btn-secondary:hover { filter: brightness(1.05); }

/* Actions row */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* ========== RANGE & STATS (create.html) ========== */
.stat-block { margin-top: var(--space-4); }
.stat-block label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

input[type="range"] { width: 100%; }

.low { color: var(--error); }
.medium { color: var(--text-light); }
.high { color: var(--success); }

#remaining {
  margin-top: var(--space-3);
  font-weight: 700;
}

/* ========== FEEDBACK / BANNERS / TOASTS ========== */
.banner {
  background: #151515;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.banner.success { border-color: #2c844a; background: #102417; }
.banner.error   { border-color: #7a2e2e; background: #241212; }
.banner.warn    { border-color: #7a6b2e; background: #241f12; }

.form-message {
  margin-top: var(--space-3);
  font-weight: 600;
}
.form-message.error   { color: var(--error); }
.form-message.success { color: var(--success); }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #1f1f1f;
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  z-index: 9999;
}

/* ========== UTILITIES ========== */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-5 { margin-top: var(--space-5) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-5 { margin-bottom: var(--space-5) !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
  body { font-size: 15px; }
  button, .btn { width: 100%; }
  nav { gap: var(--space-3); }
}
