/* ==========================================
   TRADE TAX PRO: Premium UI Design System
   ========================================== */

/* Import Outfit & Inter Fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, sans-serif;

  /* HSL Color Palette - Obsidian & Neon Green Emerald */
  --bg-main: #090a0f;
  --bg-surface: rgba(17, 20, 32, 0.7);
  --bg-surface-glow: rgba(16, 185, 129, 0.03);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(16, 185, 129, 0.2);
  
  --primary: #10b981; /* Neon Emerald */
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.15);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent-blue: #3b82f6;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.5);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 24px rgba(16, 185, 129, 0.15);

  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
}

/* Base Resets & Reset Scrollbars */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Typography Rules */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Main Container Layout */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar Styling */
aside {
  background: rgba(10, 11, 18, 0.95);
  border-right: 1px solid var(--border-color);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(20px);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent-blue));
  width: 42px;
  height: 42px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-display);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-display);
  background: linear-gradient(to right, #ffffff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tagline {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.1em;
  display: block;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--border-radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.nav-item:hover, .nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.nav-item.active {
  background: var(--primary-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary);
}

.nav-icon {
  font-size: 1.2rem;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.cpa-badge {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Main Dashboard Area */
main {
  padding: 3rem;
  overflow-y: auto;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
}

.header-title h1 {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #ffffff, #d1d5db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Ingestion Controls Block */
.ingestion-panel {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
  align-items: stretch;
}

/* Frosted glass cards */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  backdrop-filter: blur(16px);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  background: rgba(10, 11, 18, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.02);
  box-shadow: var(--shadow-glow);
}

.upload-icon {
  font-size: 3rem;
  color: var(--primary);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.drop-zone h3 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.drop-zone p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-file-select {
  background: var(--primary-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary);
  padding: 0.65rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: var(--transition-smooth);
}

.btn-file-select:hover {
  background: var(--primary);
  color: #fff;
}

/* Console Logger Panel */
.console-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.console-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.active {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.console-body {
  background: #040508;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #a7f3d0; /* Soft green terminal text */
  flex-grow: 1;
  overflow-y: auto;
  max-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.console-line {
  line-height: 1.4;
  opacity: 0.9;
}

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

.console-line.success {
  color: var(--primary);
  font-weight: 600;
}

.console-line.warning {
  color: var(--accent-orange);
}

/* Output Display Area */
.output-section {
  display: none; /* Controlled by JS */
  margin-top: 1rem;
  animation: fadeIn 0.5s ease-out;
}

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

.section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-divider h2 {
  font-size: 1.5rem;
  white-space: nowrap;
}

.line {
  height: 1px;
  background: var(--border-color);
  width: 100%;
}

.output-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

/* CPA Screen Map Card Styling */
.screen-map-card {
  padding: 2.25rem;
}

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

.map-title-block h3 {
  font-size: 1.35rem;
}

.map-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drake-badge {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--primary);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Map Table styling */
.map-table-container {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.map-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.map-table th {
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
}

.map-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.map-table tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

.field-code {
  font-family: 'Courier New', Courier, monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}

.field-value {
  color: #fff;
  font-weight: 600;
}

/* Custom In-Table Verify Checkbox */
.cpa-check {
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.cpa-check:hover, .cpa-check.checked {
  border-color: var(--primary);
}

.cpa-check.checked {
  background: var(--primary);
}

.cpa-check.checked::after {
  content: "✓";
  color: #000;
  font-weight: 900;
  font-size: 0.75rem;
}

/* Integrity Audits Card */
.audits-card {
  padding: 2.25rem;
}

.audit-item {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--border-radius-md);
  margin-bottom: 1rem;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.01);
}

.audit-item.pass {
  background: rgba(16, 185, 129, 0.03);
  border-color: rgba(16, 185, 129, 0.1);
}

.audit-item.warn {
  background: rgba(245, 158, 11, 0.03);
  border-color: rgba(245, 158, 11, 0.1);
}

.audit-icon {
  font-size: 1.25rem;
}

.audit-item.pass .audit-icon { color: var(--primary); }
.audit-item.warn .audit-icon { color: var(--accent-orange); }

.audit-content h4 {
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.audit-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Ingestion Bundles Downloads */
.download-block {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.download-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.btn-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-premium {
  background: var(--primary);
  border: none;
  color: #000;
  font-weight: 700;
  padding: 0.85rem 1.75rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.btn-premium:hover {
  background: #34d399;
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  padding: 0.85rem 1.75rem;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Responsiveness Rules */
@media (max-width: 1200px) {
  .ingestion-panel {
    grid-template-columns: 1fr;
  }
  .output-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  aside {
    display: none; /* Hide sidebar on mobile for prototype */
  }
}
