/* main.css — Variables, reset, layout, typography */

:root {
  --bg:        #0f0f0f;
  --bg-card:   #161616;
  --bg-input:  #111111;
  --bg-hover:  #1e1e1e;
  --border:    #2a2a2a;
  --txt:       #e2ddd8;
  --muted:     #888880;
  --acc:       #c13d1c;
  --acc-h:     #e04820;
  --purple:    #7b1fa2;
  --purple-h:  #9c27b0;
  --green:     #27ae60;
  --danger:    #c0392b;
  --radius:    0.45rem;
  --shadow:    0 2px 12px rgba(0,0,0,0.6);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-h); }
ul, ol { list-style: none; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ---- Layout ---- */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .logo img { height: 36px; }
.site-header .logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--txt);
  letter-spacing: 0.02em;
}

nav.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
nav.main-nav a {
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  transition: color 0.15s, background 0.15s;
}
nav.main-nav a:hover,
nav.main-nav a.active {
  color: var(--txt);
  background: var(--bg-hover);
}

.site-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
}

.site-main.wide {
  max-width: 1100px;
}

.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1rem;
}

/* ---- Typography ---- */
h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
p  { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }
small, .text-sm { font-size: 0.82rem; }
.text-muted { color: var(--muted); }
.text-acc   { color: var(--acc); }
.text-green { color: var(--green); }
.text-danger{ color: var(--danger); }

/* ---- Flash messages ---- */
.flash-list { margin-bottom: 1.25rem; }
.flash {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  border-left: 3px solid;
}
.flash.info    { background: rgba(123,31,162,0.12); border-color: var(--purple); }
.flash.success { background: rgba(39,174,96,0.12);  border-color: var(--green); }
.flash.error,
.flash.danger  { background: rgba(192,57,43,0.12);  border-color: var(--danger); }
.flash.warning { background: rgba(193,61,28,0.12);  border-color: var(--acc); }

/* ---- Utility ---- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ---- Mobile ----
   Below this width the header nav no longer fits on one line (it has
   6+ links plus name/logout), so it wraps onto its own row and scrolls
   horizontally instead of overflowing or squashing illegibly. Page
   padding is also tightened since 1.5rem a side eats a lot of a phone
   screen. */
@media (max-width: 640px) {
  .site-header {
    height: auto;
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
    row-gap: 0.4rem;
  }
  .site-header .logo {
    flex: 1 0 100%;
  }
  nav.main-nav {
    flex: 1 0 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  nav.main-nav a {
    flex-shrink: 0;
  }

  .site-main {
    padding: 1.25rem 1rem;
  }

  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.1rem; }
}
