/* ==========================================================================
   PROJECT ECONOMY - DUAL MODE NEOMORPHIC & BLACK MARKET STYLESHEET
   Architect: Sanchar Koirala
   ========================================================================== */

:root {
  --bg-color: #0c1017;
  --panel-bg: rgba(20, 26, 36, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --neo-shadow-out: 6px 6px 14px rgba(0, 0, 0, 0.7), -4px -4px 10px rgba(255, 255, 255, 0.03);
  --neo-shadow-in: inset 3px 3px 7px rgba(0, 0, 0, 0.8), inset -2px -2px 5px rgba(255, 255, 255, 0.04);
  
  --text-main: #e2e8f0;
  --text-muted: #8a99ad;
  
  --gold: #f39c12;
  --emerald: #2ecc71;
  --danger: #e74c3c;
  --info: #3498db;
  --warning: #e67e22;
}

/* BLACK MARKET OVERRIDE THEME */
body.black-market-mode {
  --bg-color: #080305;
  --panel-bg: rgba(24, 12, 16, 0.9);
  --glass-border: rgba(231, 76, 60, 0.2);
  --gold: #e74c3c;
  --info: #9b59b6;
  background-image: radial-gradient(circle at 10% 10%, rgba(231, 76, 60, 0.08) 0%, transparent 40%),
                    radial-gradient(circle at 90% 90%, rgba(155, 89, 182, 0.08) 0%, transparent 40%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.4s ease, background-image 0.4s ease;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: #1e2634;
  border-radius: 4px;
}

.gold-text { color: var(--gold) !important; }
.danger-text { color: var(--danger) !important; }
.info-text { color: var(--info) !important; }
.warning-text { color: var(--warning) !important; }
.clean-cash-text { color: var(--emerald) !important; }
.muted { color: var(--text-muted); font-size: 0.85rem; }
.hidden { display: none !important; }
.w-100 { width: 100%; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mb-10 { margin-bottom: 10px; }

/* Realtime Clock */
.clock-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: #0e121a;
  box-shadow: var(--neo-shadow-in);
}
.clock-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  background: rgba(18, 24, 34, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-message.fade-out {
  opacity: 0;
  transform: translateX(30px);
}

.toast-success { border-left: 4px solid var(--emerald); }
.toast-danger { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--gold); }
.toast-info { border-left: 4px solid var(--info); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Glassmorphic Cards & Panels */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--neo-shadow-out);
  border-radius: 16px;
  padding: 20px;
}

.neo-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sub-panel {
  background: rgba(14, 18, 26, 0.6);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.preview-badge {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.rate-tag {
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(46, 204, 113, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.sub-stat-ticker {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}

/* Inputs & Buttons */
.neo-input {
  background: #0f141d;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--neo-shadow-in);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 10px;
  outline: none;
  font-size: 0.92rem;
  width: 100%;
}
.neo-input:focus {
  border-color: var(--gold);
}

.neo-button {
  background: #1a222f;
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  box-shadow: var(--neo-shadow-out);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.neo-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.75);
}
.neo-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.primary-btn { background: linear-gradient(135deg, #2980b9, #1f618d); }
.success-btn { background: linear-gradient(135deg, #27ae60, #1e8449); }
.danger-btn { background: linear-gradient(135deg, #c0392b, #922b21); }
.warning-btn { background: linear-gradient(135deg, #e67e22, #d35400); }
.secondary-btn { background: #242d3c; }

/* Progress Bar Track & Custom Color Fills */
.progress-bar-track {
  width: 100%;
  height: 8px;
  background: #0e121a;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--neo-shadow-in);
}
.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--emerald));
  transition: width 1s linear;
}
.progress-bar-fill.info-fill {
  background: linear-gradient(90deg, #2980b9, #3498db);
}
.progress-bar-fill.danger-fill {
  background: linear-gradient(90deg, #c0392b, #e74c3c);
}
.progress-bar-fill.warning-fill {
  background: linear-gradient(90deg, #d35400, #f39c12);
}

/* Dark Web Chat Room Box */
.darkweb-chat-box {
  height: 280px;
  overflow-y: auto;
  background: #060204;
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--neo-shadow-in);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.chat-msg {
  background: rgba(231, 76, 60, 0.08);
  border-left: 3px solid var(--danger);
  padding: 6px 10px;
  border-radius: 6px;
}
.chat-user {
  color: var(--gold);
  font-weight: 700;
  margin-right: 6px;
}
.chat-time {
  color: var(--text-muted);
  font-size: 0.7rem;
  float: right;
}

/* Layout Grid */
.action-bar-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.factories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.factory-card {
  background: rgba(14, 18, 26, 0.7);
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--neo-shadow-out);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-group-sm {
  display: flex;
  gap: 6px;
}
.btn-group-sm .neo-button {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.8rem;
}

/* Modals & Auth */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 16, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.auth-logo-icon {
  font-size: 2.8rem;
  color: var(--gold);
  margin-bottom: 8px;
}
.auth-tabs {
  display: flex;
  margin: 18px 0;
  background: #0e121a;
  padding: 4px;
  border-radius: 10px;
  box-shadow: var(--neo-shadow-in);
}
.auth-tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}
.auth-tab-btn.active {
  background: #1a222f;
  color: var(--gold);
  box-shadow: var(--neo-shadow-out);
}
.auth-error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px;
  gap: 16px;
  max-width: 1450px;
  margin: 0 auto;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  flex-wrap: wrap;
  gap: 15px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-favicon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.brand-title h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 1px;
}
.owner-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.global-ticker {
  display: flex;
  gap: 18px;
  background: #0e121a;
  padding: 8px 18px;
  border-radius: 30px;
  box-shadow: var(--neo-shadow-in);
  flex-wrap: wrap;
}
.ticker-item {
  font-size: 0.85rem;
  display: flex;
  gap: 6px;
}

.user-badge-container {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  border-radius: 30px;
}
.badge-admin {
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
}
.icon-btn {
  padding: 10px 12px;
  border-radius: 50%;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.span-full { grid-column: span 3; }
.span-2 { grid-column: span 2; }
.span-1 { grid-column: span 1; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px;
}
.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.financial-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.stat-card {
  background: #0e121a;
  padding: 14px;
  border-radius: 12px;
  box-shadow: var(--neo-shadow-in);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.input-row {
  display: flex;
  gap: 8px;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.table-responsive {
  overflow-x: auto;
}
.neo-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.neo-table th, .neo-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.9rem;
}
.neo-table th {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.current-user-row {
  background: rgba(243, 156, 18, 0.08);
}

.danger-border {
  border-color: var(--danger) !important;
}

@media (max-width: 1024px) {
  .dashboard-grid, .grid-3col, .grid-2col, .action-bar-layout { grid-template-columns: 1fr; }
  .span-full, .span-2, .span-1 { grid-column: span 1; }
  .top-nav { flex-direction: column; align-items: stretch; }
}