/* WOT Publishing Ledger - Stewardship & Accountability System */
/* Premium Design System - Slate & Gold */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  font-family: "Inter", "SF Pro Display", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Premium Color Palette - Slate & Gold */
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-text: #1a1d21;
  --color-muted: #5c6370;
  --color-border: #e1e4e8;

  /* Brand Colors - Deep Slate */
  --color-brand: #2d3748;
  --color-brand-dark: #1a202c;
  --color-brand-light: #4a5568;

  /* Accent - Warm Gold */
  --color-accent: #d4a574;
  --color-accent-dark: #b8956a;
  --color-accent-light: #e8c9a8;

  /* Semantic Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  /* Premium Gradients */
  --gradient-brand: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
  --gradient-accent: linear-gradient(135deg, #d4a574 0%, #e8c9a8 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  --gradient-info: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);

  /* Premium Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);

  /* Border Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Typography */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  background-color: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

body {
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-base);
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ==========================================
   APP LAYOUT
   ========================================== */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar__header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sidebar__logo {
  width: 40px;
  height: 40px;
  background: var(--color-brand);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-weight: 700;
  font-size: var(--text-lg);
}

.sidebar__logo svg {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

.sidebar__title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.sidebar__subtitle {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.sidebar__nav {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
}

.nav-section {
  margin-bottom: var(--space-lg);
}

.nav-section__title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-sm) var(--space-md);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(45, 55, 72, 0.06);
}

.nav-item--active {
  background: rgba(45, 55, 72, 0.1);
  color: var(--color-brand);
}

.nav-item__icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
}

.nav-item__badge {
  margin-left: auto;
  background: var(--color-error);
  color: white;
  font-size: var(--text-xs);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.sidebar__footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
}

.user-info__avatar {
  width: 36px;
  height: 36px;
  background: var(--color-brand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-weight: 600;
  font-size: var(--text-sm);
}

.user-info__details {
  flex: 1;
}

.user-info__name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.user-info__role {
  font-size: var(--text-xs);
  color: var(--color-muted);
  text-transform: capitalize;
}

/* Main Content */
.main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.main__header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 249, 250, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main__title {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.main__actions {
  display: flex;
  gap: var(--space-sm);
}

.main__content {
  padding: var(--space-xl);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 500;
  font-size: var(--text-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-brand);
  color: white;
}

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

.btn--accent {
  background: var(--color-accent);
  color: var(--color-brand-dark);
}

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

.btn--success {
  background: var(--color-success);
  color: white;
}

.btn--danger {
  background: var(--color-error);
  color: white;
}

.btn--ghost {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text);
}

.btn--ghost:hover {
  background: rgba(0, 0, 0, 0.08);
}

.btn--sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--text-xs);
}

.btn--lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-base);
}

/* ==========================================
   STATS CARDS
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--color-border);
}

.stat-card__label {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-xs);
}

.stat-card__value {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-brand);
}

.stat-card--warning .stat-card__value {
  color: var(--color-warning);
}

.stat-card--success .stat-card__value {
  color: var(--color-success);
}

.stat-card--danger .stat-card__value {
  color: var(--color-error);
}

.stat-card--accent .stat-card__value {
  color: var(--color-accent-dark);
}

/* ==========================================
   DATA TABLE
   ========================================== */
.data-table-container {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

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

.data-table th,
.data-table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  background: var(--color-bg);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-muted);
}

.data-table tr:hover td {
  background: rgba(45, 55, 72, 0.02);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* ==========================================
   BADGES
   ========================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.badge--success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
}

.badge--warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.badge--danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.badge--info {
  background: rgba(45, 55, 72, 0.1);
  color: var(--color-brand);
}

.badge--muted {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-muted);
}

.badge--accent {
  background: rgba(212, 165, 116, 0.15);
  color: var(--color-accent-dark);
}

/* ==========================================
   FORMS
   ========================================== */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  transition: all 0.2s;
  background: var(--color-surface);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.form-grid--full {
  grid-column: span 2;
}

/* Form Hints - Helper text below inputs */
.form-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-top: var(--space-xs);
  line-height: 1.4;
}

/* Tooltip on inputs via title attribute - browser native */
.form-input[title],
.form-select[title],
.form-textarea[title] {
  cursor: help;
}

/* Placeholder styling */
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-muted);
  opacity: 0.6;
  font-style: italic;
}

/* ==========================================
   MODAL
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 33, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal--lg {
  max-width: 800px;
}

.modal__header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__title {
  font-size: var(--text-xl);
  font-weight: 600;
}

.modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  color: var(--color-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.modal__close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text);
}

.modal__body {
  padding: var(--space-lg);
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal__footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ==========================================
   CARDS
   ========================================== */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.card__header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.card__body {
  padding: var(--space-lg);
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--color-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.empty-state__description {
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-brand);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 150%;
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.15) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

.login-page::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 60%;
  height: 80%;
  background: linear-gradient(135deg, transparent 40%, rgba(212, 165, 116, 0.1) 100%);
  border-radius: 50%;
  pointer-events: none;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}

.login-card__header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-card__logo {
  width: 72px;
  height: 72px;
  background: var(--color-brand);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.login-card__logo svg {
  width: 40px;
  height: 40px;
  color: var(--color-accent);
}

.login-card__title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
}

.login-card__subtitle {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--space-xs);
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.alert--success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.alert--warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}

.alert--danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-error);
}

.alert--info {
  background: rgba(45, 55, 72, 0.08);
  border: 1px solid rgba(45, 55, 72, 0.15);
  color: var(--color-brand);
}

/* ==========================================
   TABS
   ========================================== */
.tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xl);
}

.tab {
  padding: var(--space-md) var(--space-lg);
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--color-text);
}

.tab--active {
  color: var(--color-brand);
  border-bottom-color: var(--color-brand);
}

/* ==========================================
   SEARCH & FILTER
   ========================================== */
.search-bar {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  padding-left: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  background: var(--color-surface);
}

.search-input input:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(45, 55, 72, 0.1);
}

.search-input::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%235c6370'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
  background-size: contain;
}

.filter-select {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  background: var(--color-surface);
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-brand);
}

/* ==========================================
   CURRENCY DISPLAY
   ========================================== */
.currency {
  font-family: "SF Mono", "Consolas", monospace;
  font-weight: 600;
}

.currency--positive {
  color: var(--color-success);
}

.currency--negative {
  color: var(--color-error);
}

/* ==========================================
   LOADING
   ========================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideIn 0.3s ease;
}

.toast--success { border-left: 4px solid var(--color-success); }
.toast--error { border-left: 4px solid var(--color-error); }
.toast--warning { border-left: 4px solid var(--color-warning); }
.toast--info { border-left: 4px solid var(--color-brand); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================
   HIDDEN UTILITY
   ========================================== */
.hidden {
  display: none !important;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid--full {
    grid-column: span 1;
  }

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

  .login-card {
    margin: var(--space-md);
  }
}
