/* DEWLINE - Dark Monitoring Station Theme */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2234;
  --bg-input: #0f1629;
  --border: #2a3548;
  --border-focus: #4a90d9;
  --text-primary: #ffffff;
  --text-secondary: #d0d5dd;
  --text-muted: #a0a8b8;
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --yellow: #eab308;
  --yellow-bg: rgba(234, 179, 8, 0.1);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --font-mono: 'Share Tech Mono', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Logo */
.logo {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  color: var(--text-primary);
  text-decoration: none;
}
.logo:hover { color: var(--blue); }

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  list-style: none;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active { color: var(--blue); }

/* Container */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.container-wide {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

/* Typography */
h1, h2, h3 {
  font-family: var(--font-body);
  font-weight: 600;
}
.page-title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}
.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}
.section-title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}
.form-input::placeholder { color: var(--text-muted); }
.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Password field with Show toggle */
.password-wrapper {
  position: relative;
}
.password-wrapper .form-input {
  padding-right: 4rem;
}
.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-body);
}
.password-toggle:hover { color: var(--text-secondary); }

/* Select */
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-body);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}
.form-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover { background: #2563eb; }
.btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}
.btn-danger:hover {
  background: var(--red-bg);
}
.btn-block { width: 100%; }

/* Checkbox & Radio */
.checkbox-group, .radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.checkbox-label, .radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.checkbox-label input, .radio-label input {
  accent-color: var(--blue);
  width: 1rem;
  height: 1rem;
}

/* Links */
a.link {
  color: var(--blue);
  text-decoration: none;
}
a.link:hover { text-decoration: underline; }

/* Text utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-small { font-size: 0.8rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* Status dots */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
}
.status-red { background: var(--red); }
.status-blue { background: var(--blue); }
.status-yellow { background: var(--yellow); }
.status-green { background: var(--green); }

/* Dashboard Table */
.holdings-table {
  width: 100%;
  border-collapse: collapse;
}
.holdings-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.holdings-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}
.holdings-table tr:last-child td { border-bottom: none; }
.holdings-table .ticker-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.holdings-table .status-cell { color: var(--text-secondary); }
.holdings-table .clickable-row { cursor: pointer; }
.holdings-table .clickable-row:hover { background: rgba(255,255,255,0.03); }

/* Status text colors */
.status-text-red { color: var(--red); }
.status-text-blue { color: var(--blue); }
.status-text-yellow { color: var(--yellow); }
.status-text-green { color: var(--green); }

/* Summary bar */
.summary-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}
.summary-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-secondary);
}
.summary-count {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding: 1rem 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Research popup */
.research-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.research-overlay.active { display: flex; }
.research-popup {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
}
.research-popup h3 {
  font-family: var(--font-mono);
  margin-bottom: 1rem;
}
.research-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.research-links a {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9375rem;
}
.research-links a:hover { text-decoration: underline; }

/* Ticker list (edit holdings / change portfolio) */
.ticker-list {
  display: flex;
  flex-direction: column;
}
.ticker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}
.ticker-row:last-child { border-bottom: none; }
.ticker-name {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  letter-spacing: 0.05em;
}
.ticker-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-body);
}
.ticker-delete:hover { color: var(--red); }

/* Add ticker row */
.add-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}
.add-row .form-input { flex: 1; }

/* Error/success messages */
.msg-error {
  color: var(--red);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}
.msg-success {
  color: var(--green);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}
.hidden { display: none !important; }

/* Home page specific */
.home-hero {
  text-align: center;
  padding: 3rem 0 2rem;
}
.home-hero .logo {
  font-size: 2.5rem;
}
.home-section {
  margin-bottom: 2rem;
}
.home-section h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.home-section p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

/* Auth page centering */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}
.auth-page .logo {
  margin-bottom: 2rem;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
}

/* Textarea */
textarea.form-input {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* Info box */
.info-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}