/* ================================
   DEMETRA - Trading Journal
   Calm Light Theme with Teal Accent
   ================================ */

:root {
  /* Calm Light Theme */
  --bg-primary: #fafafa;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #eeeeee;
  --bg-hover: #e8e8e8;
  --bg-card: #ffffff;

  /* Teal Accent */
  --accent: #0891b2;
  --accent-hover: #0e7490;
  --accent-light: #06b6d4;
  --accent-glow: rgba(8, 145, 178, 0.15);

  /* Text Colors */
  --text: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;

  /* Semantic Colors */
  --profit: #059669;
  --profit-bg: rgba(5, 150, 105, 0.08);
  --loss: #dc2626;
  --loss-bg: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);

  /* Borders & Shadows */
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08);
  --glow-accent: 0 0 0 3px var(--accent-glow);

  /* Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Consolas', monospace;
}

/* ================================
   BASE STYLES
   ================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ================================
   TYPOGRAPHY
   ================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
}

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

code {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

strong {
  font-weight: 600;
}

/* ================================
   LAYOUT
   ================================ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.page-header h1 {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-header p {
  color: var(--text-secondary);
  margin: 0;
}

.dashboard-filters {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.dashboard-filters .form-select {
  width: auto;
  min-width: 200px;
}

@media (max-width: 640px) {
  .page-header-content {
    flex-direction: column;
  }

  .dashboard-filters {
    width: 100%;
  }

  .dashboard-filters .form-select {
    width: 100%;
  }
}

/* Grid Systems */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 968px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 1rem;
  }

  h1 { font-size: 1.75rem; }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ================================
   NAVIGATION
   ================================ */

.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0;
}

.navbar-brand span {
  color: var(--accent);
}

.navbar-brand:hover {
  color: var(--text);
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  align-items: center;
}

.navbar-nav a {
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  font-weight: 500;
}

.navbar-nav a:hover {
  background: var(--bg-secondary);
  color: var(--text);
  text-decoration: none;
}

.navbar-nav a.active {
  background: var(--accent-glow);
  color: var(--accent);
}

@media (max-width: 768px) {
  .navbar-content {
    flex-direction: column;
    height: auto;
    padding: 1rem 2rem;
    gap: 1rem;
  }

  .navbar-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
}

/* ================================
   CARDS
   ================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.3s ease;
  animation: fadeIn 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

/* KPI Cards */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.3s ease;
  animation: fadeIn 0.3s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.kpi-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.kpi-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.kpi-value.profit {
  color: var(--profit);
}

.kpi-value.loss {
  color: var(--loss);
}

@media (max-width: 640px) {
  .kpi-value {
    font-size: 1.5rem;
  }
}

/* ================================
   FORMS
   ================================ */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 500;
  font-size: 0.875rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow-accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* ================================
   BUTTONS
   ================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-danger {
  background: var(--loss-bg);
  color: var(--loss);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.15);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ================================
   TABLES
   ================================ */

.table-container {
  overflow-x: auto;
  padding: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-secondary);
}

th {
  text-align: left;
  padding: 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: var(--bg-secondary);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ================================
   BADGES
   ================================ */

.badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-buy {
  background: var(--profit-bg);
  color: var(--profit);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-sell {
  background: var(--loss-bg);
  color: var(--loss);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.badge-active {
  background: var(--profit-bg);
  color: var(--profit);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-inactive {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ================================
   ALERTS
   ================================ */

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border-left: 4px solid;
  animation: fadeIn 0.3s ease;
}

.alert-success {
  background: var(--profit-bg);
  border-left-color: var(--profit);
  color: var(--profit);
}

.alert-error {
  background: var(--loss-bg);
  border-left-color: var(--loss);
  color: var(--loss);
}

.alert-warning {
  background: var(--warning-bg);
  border-left-color: var(--warning);
  color: var(--warning);
}

/* ================================
   TOKEN DISPLAY
   ================================ */

.token-display {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  word-break: break-all;
  margin: 1rem 0;
  color: var(--text-secondary);
}

/* ================================
   AUTH PAGES
   ================================ */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  border: 1px solid var(--border);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.auth-logo h1 span {
  color: var(--accent);
}

.auth-logo p {
  color: var(--text-muted);
  margin: 0;
}

/* ================================
   CHARTS
   ================================ */

.chart-container {
  position: relative;
  height: 300px;
  padding: 1rem;
}

/* ================================
   FILTERS
   ================================ */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.filters .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

/* ================================
   PAGINATION
   ================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pagination .btn {
  padding: 0.5rem 1rem;
}

/* ================================
   EMPTY STATE
   ================================ */

.empty-state {
  padding: 3rem 2rem;
  text-align: center;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
  margin: 0;
}

/* ================================
   TEXT UTILITIES
   ================================ */

.text-profit {
  color: var(--profit);
  font-weight: 600;
}

.text-loss {
  color: var(--loss);
  font-weight: 600;
}

.text-muted {
  color: var(--text-muted);
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* ================================
   SPACING UTILITIES
   ================================ */

.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; }

/* ================================
   ANIMATIONS
   ================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================================
   SCROLLBAR
   ================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
