/**
 * SnoflexAI - Base Styles
 * Common CSS variables, reset, typography, layout and components
 * Version: 1
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
  --bg: #020617;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: rgba(148, 163, 184, 0.75);
  --primary: #38bdf8;
  --card-bg: rgba(15, 23, 42, 0.62);
  --card-border: rgba(255, 255, 255, 0.10);
  --radius: 12px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow: 0 20px 60px rgba(0,0,0,0.35);
}

/* ========================================
   Reset & Base
   ======================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  scroll-behavior: smooth;
  min-height: 100%;
}

/* ========================================
   Background Canvas
   ======================================== */
#canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* ========================================
   Layout
   ======================================== */
.page {
  position: relative;
  z-index: 1;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========================================
   Typography
   ======================================== */
h1, h2 {
  font-weight: 200;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin: 0;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; color: var(--text-main); margin-bottom: 2rem; }

h3 {
  margin: 0 0 10px;
  font-weight: 200;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 14px;
  color: var(--text-main);
}

p { color: var(--text-muted); line-height: 1.8; }

/* ========================================
   Header & Navigation
   ======================================== */
header {
  padding: 40px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 15px; }

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: color 0.3s;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--primary); }

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-main);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  cursor: pointer;
}
.menu-toggle svg { width: 20px; height: 20px; }

@media (max-width: 860px) {
  .menu-toggle { display: grid; place-items: center; }
  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 280px;
    background: rgba(2, 6, 23, 0.98);
    backdrop-filter: blur(12px);
    border-left: 1px solid rgba(255,255,255,0.12);
    flex-direction: column;
    justify-content: center;
    gap: 26px;
    padding: 24px;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 20;
  }
  .nav-links.active { transform: translateX(0); }
  .nav-links a { font-size: 14px; }
  .nav-links .btn-header {
    width: 100%;
    text-align: center;
    padding: 14px 20px;
    font-size: 12px;
  }
  .nav-links .pill {
    display: none !important;
  }
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: blur(8px);
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .card { padding: 28px; }
}

/* Auth cards (login/signup) */
.card-auth {
  margin: 60px auto 40px;
}

@media (max-width: 768px) {
  .card-auth {
    margin: 10px auto 30px;
  }
}

/* ========================================
   Forms
   ======================================== */
.form-group { margin-bottom: 20px; }

.form-row {
  display: flex;
  gap: 20px;
}

.form-row > .form-group {
  flex: 1;
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

input, select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 12px;
  color: white;
  border-radius: 4px;
  font-family: inherit;
}

/* Ensure native selects render in dark mode */
select {
  color-scheme: dark;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}
select option {
  background-color: var(--bg);
  color: var(--text-main);
}

input:focus, select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.10);
}

input:disabled, select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="file"] { display: none; }

/* ========================================
   Buttons
   ======================================== */
.btn {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--text-main);
  background: transparent;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 200;
  border-radius: 6px;
}

.btn:hover:not(:disabled) {
  background: var(--text-main);
  color: var(--bg);
}

.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-header {
  width: auto;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 2px;
  line-height: 1;
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--text-main);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 6px;
  font-family: inherit;
  text-transform: uppercase;
}
.btn-header:hover {
  background: var(--text-main);
  color: var(--bg);
}

/* ========================================
   Status Messages
   ======================================== */
.status {
  margin-top: 15px;
  font-size: 13px;
  padding: 10px;
  border-radius: 4px;
  text-align: center;
}

.status.hidden { display: none; }
.status.ok { color: #4ade80; border: 1px solid #4ade80; background: rgba(74, 222, 128, 0.06); }
.status.danger { color: #f87171; border: 1px solid #f87171; background: rgba(248, 113, 113, 0.06); }

/* ========================================
   Pill
   ======================================== */
.pill {
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

/* ========================================
   Dropbox (File Upload)
   ======================================== */
.dropbox {
  border: 1px dashed var(--text-muted);
  padding: 40px;
  text-align: center;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(255,255,255,0.02);
  user-select: none;
}

.dropbox:hover,
.dropbox.dragover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.05);
}

/* ========================================
   Utilities
   ======================================== */
.hr { height: 1px; background: rgba(255,255,255,0.10); margin: 28px 0; }
.lead { font-size: 15px; color: var(--text-main); margin-top: 0; }
.text-gradient { color: var(--primary); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* ========================================
   Footer
   ======================================== */
footer {
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 1px;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}
footer a:hover {
  color: var(--primary);
}

/* ========================================
   Responsive Typography
   ======================================== */
@media (max-width: 768px) {
  h2 { font-size: 1.2rem; }
  .card > div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}
