/**
 * GSOUR Platform - WPBAT Design System Adaptation
 * Light theme with blue color scheme
 * Based on WPBAT Performance Lite v1.0 Design System
 */

/* ============================================
   Design Tokens - WPBAT Light Theme Adaptation
   ============================================ */
:root {
  /* Backgrounds - Light Theme */
  --c-bg: #f8fafc;
  --c-surface: #ffffff;
  --c-card: #ffffff;
  --c-card-hi: #f1f5f9;

  /* Borders */
  --c-border: #e2e8f0;
  --c-border-l: rgba(226, 232, 240, 0.6);

  /* Brand Blue */
  --c-blue: #007fff;
  --c-blue-b: #0056b3;
  --c-blue-glow: rgba(0, 127, 255, 0.15);
  --c-blue-dim: rgba(0, 127, 255, 0.08);
  --c-blue-mid: rgba(0, 127, 255, 0.12);

  /* Text - Light Theme */
  --c-text: #1e293b;
  --c-text-2: #64748b;
  --c-text-3: #94a3b8;

  /* Semantic Colors - Light Theme */
  --c-green: #10b981;
  --c-green-d: rgba(16, 185, 129, 0.10);
  --c-orange: #f59e0b;
  --c-orange-d: rgba(245, 158, 11, 0.10);
  --c-red: #ef4444;
  --c-red-d: rgba(239, 68, 68, 0.10);

  /* Geometry */
  --r: 8px;
  --r-sm: 5px;
  --r-xs: 3px;
  --r-md: 6px;
  --r-lg: 12px;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* Typography Scale */
  --font-ui: 'Sora', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --text-xs: 0.65rem;
  --text-sm: 0.8rem;
  --text-base: 0.84rem;
  --text-lg: 0.875rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.25rem;
  --text-3xl: 1.45rem;
  --text-4xl: 1.85rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-blue: 0 0 16px var(--c-blue-glow);
}

/* ============================================
   Base Styles
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--c-text);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code, .mono {
  font-family: var(--font-mono) !important;
}

/* ============================================
   Layout Components
   ============================================ */
.app-container {
  display: flex;
  min-height: 100vh;
  background: var(--c-bg);
}

.sidebar {
  width: 260px;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--c-border);
}

.sidebar-brand {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--c-blue);
  text-decoration: none;
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0;
}

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

.nav-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-3);
  padding: 0 var(--space-4) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--c-text);
  text-decoration: none;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  font-weight: 500;
}

.nav-item:hover {
  background-color: var(--c-card-hi);
  color: var(--c-text);
}

.nav-item.active {
  background-color: var(--c-blue-dim);
  color: var(--c-blue);
  border-left-color: var(--c-blue);
}

.nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.page-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: var(--space-6) var(--space-8);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--space-1);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--c-text-2);
}

.page-content {
  padding: var(--space-8);
  max-width: 1400px;
}

/* ============================================
   Cards & Containers - WPBAT Pattern
   ============================================ */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
  overflow: visible;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--c-border);
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--r) var(--r) 0 0;
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-4) calc(var(--space-5) * -1);
  padding: var(--space-4) var(--space-5);
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-text);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-title svg {
  width: 15px;
  height: 15px;
  fill: var(--c-blue);
}

.card-body {
  padding: 0;
}

/* ============================================
   Tabs - WPBAT Pattern
   ============================================ */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 0;
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-text-2);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.tab:hover {
  color: var(--c-blue);
  background: var(--c-blue-dim);
}

.tab.active {
  color: var(--c-blue);
  border-bottom-color: var(--c-blue);
  background: var(--c-blue-dim);
}

/* Project Card Hover Effect */
.project-card:hover {
  border-color: var(--c-blue);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* ============================================
   Buttons - WPBAT Pattern
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.btn-primary {
  background: var(--c-blue);
  color: #ffffff;
  border-color: var(--c-blue);
}

.btn-primary:hover {
  background: var(--c-blue-b);
  box-shadow: var(--shadow-blue);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--c-text);
  border-color: var(--c-border);
}

.btn-secondary:hover {
  background: var(--c-card-hi);
  color: var(--c-text);
  border-color: var(--c-text-2);
}

.btn-danger {
  background: var(--c-red-d);
  color: var(--c-red);
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: var(--c-red);
  color: #ffffff;
}

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

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   Forms - WPBAT Pattern
   ============================================ */
.form-group {
  margin-bottom: var(--space-4);
}

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

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px var(--c-blue-dim);
}

.form-textarea {
  font-family: var(--font-mono) !important;
  resize: vertical;
  line-height: 1.65;
}

/* ============================================
   Tables - WPBAT Pattern
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-surface);
}

.data-table thead {
  background-color: rgba(0, 0, 0, 0.03);
  border-bottom: 2px solid var(--c-border);
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-3);
}

.data-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--c-border-l);
  font-size: var(--text-base);
  color: var(--c-text);
  vertical-align: middle;
}

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

.data-table tbody tr:hover td {
  background-color: var(--c-blue-dim);
}

.data-table td code {
  background: rgba(0, 0, 0, 0.1);
  color: var(--c-blue);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--r-xs);
  font-size: var(--text-sm);
  font-family: var(--font-mono) !important;
  border: 1px solid var(--c-blue-mid);
}

.data-table td a.wpbat-action-link {
  color: var(--c-blue);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--c-blue-mid);
  border-radius: var(--r-xs);
  background: var(--c-blue-dim);
  transition: all 0.15s;
}

.data-table td a.wpbat-action-link:hover {
  background: var(--c-blue);
  color: #ffffff;
}

/* ============================================
   Status Badges - WPBAT Pattern
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--r-xs);
  white-space: nowrap;
}

.badge-success {
  background: var(--c-green-d);
  color: var(--c-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background: var(--c-orange-d);
  color: var(--c-orange);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-error {
  background: var(--c-red-d);
  color: var(--c-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
  background: var(--c-blue-dim);
  color: var(--c-blue);
  border: 1px solid var(--c-blue-mid);
}

.badge-grey {
  background: rgba(148, 163, 184, 0.12);
  color: var(--c-text-3);
  border: 1px solid var(--c-border);
}

/* ============================================
   Stats Cards - WPBAT Pattern
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--c-blue);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-blue-dim);
  border-radius: var(--r-lg);
  color: var(--c-blue);
  flex-shrink: 0;
}

.stat-icon svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.5;
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--c-text);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text-2);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.stat-change {
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: var(--space-1);
}

.stat-change.positive {
  color: var(--c-green);
}

.stat-change.negative {
  color: var(--c-red);
}

/* Responsive stat cards */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* ============================================
   Utilities - WPBAT Pattern
   ============================================ */
.text-muted {
  color: var(--c-text-2);
}

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

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.grid {
  display: grid;
  gap: var(--space-6);
}

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

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

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-4 {
  gap: var(--space-4);
}

/* WPBAT Animations */
@keyframes wpbat-spin {
  to {
    transform: rotate(360deg);
  }
}

.wpbat-spin {
  animation: wpbat-spin 1s linear infinite;
}
