/* ==========================================================================
   Oil Price Dashboard - Stylesheet
   Designed with premium dark financial aesthetics, smooth transitions, and responsiveness.
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-primary);
  
  /* Constant colors */
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.15);
  --color-red: #ef4444;
  --color-red-glow: rgba(239, 68, 68, 0.15);
  --color-orange: #f59e0b;
  --color-purple: #8b5cf6;
  --color-teal: #14b8a6;
  
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
}

:root[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-surface: #121824;
  --bg-surface-elevated: #1e2638;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-focus: rgba(59, 130, 246, 0.5);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --btn-primary-bg: #3b82f6;
  --btn-primary-text: #ffffff;
  --btn-primary-hover: #2563eb;
  
  --btn-secondary-bg: #1e2638;
  --btn-secondary-text: #e2e8f0;
  --btn-secondary-hover: #2d3748;

  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --glass-bg: rgba(18, 24, 36, 0.8);
  --glass-blur: blur(12px);
}

:root[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-focus: rgba(37, 99, 235, 0.5);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --btn-primary-bg: #2563eb;
  --btn-primary-text: #ffffff;
  --btn-primary-hover: #1d4ed8;
  
  --btn-secondary-bg: #e2e8f0;
  --btn-secondary-text: #1f2937;
  --btn-secondary-hover: #cbd5e1;

  --card-shadow: 0 10px 30px -10px rgba(100, 116, 139, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-blur: blur(12px);
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
}

a {
  color: var(--btn-primary-bg);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Security Dev Warning Banner */
.dev-warning-banner {
  background-color: #7f1d1d;
  color: #fca5a5;
  text-align: center;
  padding: 10px 20px;
  font-size: 13px;
  border-bottom: 1px solid #991b1b;
  position: relative;
  z-index: 100;
  font-family: var(--font-primary);
}
.dev-warning-banner strong {
  color: #fff;
}

.demo-warning-banner {
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  margin-bottom: 24px;
  font-size: 14px;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}

/* Spinner Loaders */
.initial-loading-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg-app);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s;
}
.initial-loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}
.spinner-container {
  text-align: center;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--btn-primary-bg);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loading-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 24px;
  margin-bottom: 8px;
}
.loading-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Layout Framework */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  font-size: 28px;
}
.nav-brand h1 {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.status-label {
  color: var(--text-muted);
}
.status-badge {
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 12px;
}
.status-connected {
  background-color: var(--color-green-glow);
  color: var(--color-green);
}
.status-demo {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--color-orange);
}
.status-disconnected {
  background-color: var(--color-red-glow);
  color: var(--color-red);
}
.refreshed-time {
  font-size: 13px;
  color: var(--text-secondary);
}

.main-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px;
}

/* API Setup Welcomer */
.welcome-setup {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}
.welcome-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 48px;
  border-radius: var(--border-radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--card-shadow);
}
.welcome-card h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 26px;
  margin-bottom: 12px;
}
.welcome-desc {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 15px;
}

/* Inputs & Form Groups */
.form-group {
  margin-bottom: 24px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.input-password-wrapper {
  display: flex;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  transition: var(--transition-smooth);
}
.input-password-wrapper:focus-within {
  border-color: var(--btn-primary-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.input-password-wrapper input,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"] {
  flex-grow: 1;
  background: none;
  border: none;
  outline: none;
  padding: 14px 18px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
}
.form-group input[type="text"],
.form-group input[type="number"] {
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-md);
  width: 100%;
}
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
  border-color: var(--btn-primary-bg);
  outline: none;
}
.btn-input-addon {
  background-color: transparent !important;
  border: none !important;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 18px;
  font-weight: 600;
  font-size: 14px;
}
.btn-input-addon:hover {
  color: var(--text-primary);
}
.form-help {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.setup-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Button Components */
.btn {
  font-family: var(--font-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-smooth);
}
.btn-icon {
  padding: 10px 14px;
}
.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}
.btn-primary:hover {
  background-color: var(--btn-primary-hover);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
}
.btn-secondary:hover {
  background-color: var(--btn-secondary-hover);
}
.btn-secondary.active {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}
.btn-outline {
  border-color: var(--border-color);
  background-color: transparent;
  color: var(--text-primary);
}
.btn-outline:hover {
  background-color: var(--btn-secondary-bg);
}
.btn-danger {
  background-color: var(--color-red);
  color: #fff;
}
.btn-danger:hover {
  background-color: #dc2626;
}
.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--border-radius-sm);
}
.btn-link {
  background: none;
  border: none;
  color: var(--btn-primary-bg);
  text-decoration: underline;
  cursor: pointer;
  font-weight: inherit;
  font-size: inherit;
  padding: 0;
}
.btn-link:hover {
  color: var(--btn-primary-hover);
}

/* Summary Grid Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.summary-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--card-shadow);
}
.card-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.card-value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 28px;
}
.card-value-small {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  margin-top: 4px;
}
.highlight-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Filter Control Layout */
.filter-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin-bottom: 32px;
  box-shadow: var(--card-shadow);
}
.filter-row {
  display: grid;
  grid-template-columns: 2fr repeat(5, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.filter-group select,
.filter-group input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
}
.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--btn-primary-bg);
}

/* Section Title Headers */
.section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 20px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Commodity Spot Rate Cards */
.commodity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}
.commodity-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--card-shadow);
}
.commodity-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.4);
}
.card-failed {
  border-color: rgba(239, 68, 68, 0.3);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-crude { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-gas { background-color: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.badge-fuel { background-color: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.badge-drilling { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-metal { background-color: rgba(234, 179, 8, 0.15); color: #facc15; }
.badge-carbon { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-other { background-color: rgba(100, 116, 139, 0.15); color: #94a3b8; }
.badge-success { background-color: var(--color-green-glow); color: var(--color-green); }
.badge-danger { background-color: var(--color-red-glow); color: var(--color-red); }
.badge-neutral { background-color: rgba(100, 116, 139, 0.2); color: var(--text-secondary); }
.badge-demo { background-color: rgba(245, 158, 11, 0.2); color: var(--color-orange); }

.btn-fav {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  width: 24px;
  height: 24px;
}
.btn-fav:hover {
  color: var(--color-red);
}
.btn-fav.active {
  color: var(--color-red);
}

.card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 2px;
}
.card-code {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.card-price-row {
  margin-bottom: 4px;
}
.price-val {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 26px;
}
.price-unit {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.card-change-row {
  margin-bottom: 20px;
}
.change-val {
  font-size: 14px;
  font-weight: 600;
}

.card-details {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.detail-row .lbl {
  color: var(--text-muted);
}
.detail-row .val {
  color: var(--text-secondary);
  font-weight: 500;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.btn-card-action {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 1px solid var(--border-color);
  padding: 8px 4px;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition-smooth);
}
.btn-card-action:hover {
  background-color: var(--btn-secondary-hover);
  border-color: var(--text-muted);
}

/* Skeletons screens styles */
.skeleton .skeleton-line {
  background: linear-gradient(90deg, var(--bg-surface-elevated) 25%, var(--border-color) 50%, var(--bg-surface-elevated) 75%);
  background-size: 200% 100%;
  animation: loading-skeleton 1.5s infinite;
  border-radius: 4px;
}
.skeleton .skeleton-line.title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}
.skeleton .skeleton-line.price {
  height: 32px;
  width: 40%;
  margin-bottom: 24px;
}
.skeleton .skeleton-line.detail {
  height: 14px;
  margin-bottom: 8px;
}
.skeleton .skeleton-row {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.skeleton .skeleton-btn {
  height: 30px;
  flex: 1;
  background-color: var(--bg-surface-elevated);
  border-radius: 4px;
}
@keyframes loading-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Chart Canvas Section */
.chart-section-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  margin-bottom: 48px;
  box-shadow: var(--card-shadow);
}
.chart-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}
.chart-controls select {
  padding: 8px 12px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--border-radius-sm);
  outline: none;
  font-family: var(--font-primary);
  font-size: 14px;
}
.btn-group {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}
.btn-group .btn {
  border-radius: 0;
  border: none;
  padding: 8px 16px;
}
.btn-group .btn:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

.custom-range-row {
  display: flex;
  gap: 16px;
  align-items: center;
  background-color: var(--bg-surface-elevated);
  padding: 16px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 20px;
}
.date-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.date-group input {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.chart-frame {
  position: relative;
  height: 350px;
  width: 100%;
  margin-bottom: 24px;
}
.canvas-wrapper {
  position: absolute;
  inset: 0;
}
.chart-loader,
.chart-empty {
  position: absolute;
  inset: 0;
  z-index: 10;
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.empty-state {
  text-align: center;
  max-width: 350px;
}
.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
}
.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  margin-bottom: 6px;
}
.empty-state p {
  color: var(--text-secondary);
  font-size: 13px;
}

.chart-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}
.chart-stat-box {
  display: flex;
  flex-direction: column;
}
.stat-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.stat-val {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
}

/* Data Table Grid Section */
.table-section-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  margin-bottom: 48px;
  box-shadow: var(--card-shadow);
}
.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.table-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.table-actions input {
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  width: 240px;
}
.table-actions input:focus {
  outline: none;
  border-color: var(--btn-primary-bg);
}

.table-overflow {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 20px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}
.data-table th {
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
}
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.data-table th.sortable:hover {
  color: var(--text-primary);
}
.data-table tr:hover td {
  background-color: var(--bg-surface-elevated);
}
.data-table .text-right {
  text-align: right;
}
.arrow {
  font-size: 10px;
  margin-left: 4px;
  opacity: 0.6;
}

.table-pagination-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rows-select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.rows-select-group select {
  padding: 4px 8px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
}

/* Diagnostic Console Syntax Coloring */
.dev-json-section {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  margin-bottom: 48px;
  box-shadow: var(--card-shadow);
}
.dev-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}
.dev-tabs {
  display: flex;
  gap: 4px;
  background-color: var(--bg-surface-elevated);
  padding: 4px;
  border-radius: var(--border-radius-sm);
}
.dev-tab {
  background: none;
  border: none;
  font-family: var(--font-primary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.dev-tab:hover {
  color: var(--text-primary);
}
.dev-tab.active {
  background-color: var(--bg-app);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dev-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dev-actions {
  display: flex;
  gap: 8px;
}
.json-viewer-box {
  background-color: #0b0f19;
  border-radius: var(--border-radius-md);
  padding: 20px;
  max-height: 400px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.json-viewer-box pre {
  font-family: Consolas, Monaco, "Lucida Console", "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Custom Highlight colors for raw JSON code */
.json-key { color: #f43f5e; font-weight: 600; }
.json-string { color: #10b981; }
.json-number { color: #3b82f6; }
.json-boolean { color: #ec4899; }
.json-null { color: #64748b; font-style: italic; }

/* API Usage Panels */
.api-usage-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}
.usage-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.usage-stat-box {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
}
.usage-stat-box .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 600;
}
.usage-stat-box .value {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}

/* Dialog Modals Framework */
.modal-dialog {
  border: none;
  background-color: transparent;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.modal-dialog.active {
  opacity: 1;
  visibility: visible;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}
.modal-dialog.active .modal-card {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}
.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.modal-footer.space-between {
  justify-content: space-between;
}

.details-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.details-list .detail-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.details-list .detail-label {
  font-weight: 600;
  color: var(--text-secondary);
}
.details-list .detail-value {
  font-family: monospace;
  font-size: 14px;
}

.text-green { color: var(--color-green) !important; }
.text-red { color: var(--color-red) !important; }
.font-mono { font-family: monospace !important; }
.w-full { width: 100% !important; }
.mt-4 { margin-top: 16px !important; }
.hidden { display: none !important; }
.flex { display: flex !important; }
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.uppercase { text-transform: uppercase !important; }

/* Responsive adjustments */
@media (max-width: 1200px) {
  .filter-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .top-nav {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }
  .nav-actions {
    flex-wrap: wrap;
    justify-content: center;
  }
  .filter-row {
    grid-template-columns: 1fr;
  }
  .summary-cards {
    grid-template-columns: 1fr 1fr;
  }
  .col-span-2-md {
    grid-column: span 2;
  }
  .chart-header-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .chart-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .custom-range-row {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-card {
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .dev-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }
  .col-span-2-md {
    grid-column: span 1;
  }
  .commodity-grid {
    grid-template-columns: 1fr;
  }
  .card-actions {
    grid-template-columns: 1fr;
  }
  .dev-tabs {
    flex-direction: column;
    width: 100%;
  }
  .dev-tab {
    text-align: center;
  }
}

/* ==========================================================================
   Authentication Section - Premium Styles
   ========================================================================== */
.auth-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 75vh;
  padding: 20px;
}

.auth-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--card-shadow);
  transition: var(--transition-smooth);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo {
  font-size: 48px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

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

.auth-header h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.auth-tabs {
  display: flex;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-md);
  padding: 4px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  border-radius: calc(var(--border-radius-md) - 2px);
  transition: var(--transition-smooth);
}

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

.auth-tab.active {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-error-msg {
  background-color: var(--color-red-glow);
  color: var(--color-red);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
  margin-bottom: 16px;
  text-align: center;
}

.auth-success-msg {
  background-color: var(--color-green-glow);
  color: var(--color-green);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.2);
  margin-bottom: 16px;
  text-align: center;
}

.demo-credentials-tip {
  margin-top: 20px;
  padding: 12px;
  background-color: rgba(59, 130, 246, 0.05);
  border: 1px dashed rgba(59, 130, 246, 0.15);
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Auth Fade In Animation */
.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

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

/* ==========================================================================
   Navigation Tabs & Widget Builder Styles
   ========================================================================== */
/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-md);
  padding: 4px;
  border: 1px solid var(--border-color);
}
.nav-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: calc(var(--border-radius-md) - 2px);
  transition: var(--transition-smooth);
}
.nav-tab:hover {
  color: var(--text-primary);
}
.nav-tab.active {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

/* Widget Builder Section */
.widget-builder-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}
.widget-builder-header h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}
.widget-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}
.widget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  .widget-grid {
    grid-template-columns: 1fr;
  }
}
.widget-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
}
.widget-panel h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}
.theme-btn-group {
  display: flex;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-md);
  padding: 4px;
  border: 1px solid var(--border-color);
}
.theme-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  border-radius: calc(var(--border-radius-md) - 2px);
  transition: var(--transition-smooth);
}
.theme-btn:hover {
  color: var(--text-primary);
}
.theme-btn.active {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}
.embed-textarea {
  width: 100%;
  padding: 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 12px;
  resize: none;
}
.copy-success-msg {
  background-color: var(--color-green-glow);
  color: var(--color-green);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.2);
  margin-top: 8px;
  text-align: center;
}

/* Widget Preview */
.widget-preview-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--border-radius-md);
  padding: 40px;
  border: 1px dashed var(--border-color);
  min-height: 320px;
}
.widget-preview-card {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}
.widget-preview-card.dark-theme {
  background-color: #0f172a;
  color: #f8fafc;
  border-color: #334155;
}
.widget-preview-card.light-theme {
  background-color: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
}
.widget-preview-header h4 {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
}
.widget-results-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  border-top: 1px solid rgba(226, 232, 240, 0.2);
  padding-top: 16px;
}
.widget-preview-card.light-theme .widget-results-row {
  border-top-color: #e2e8f0;
}
.result-box {
  display: flex;
  flex-direction: column;
}
.result-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 4px;
}
.widget-preview-card.light-theme .result-label {
  color: #64748b;
}
.result-val {
  font-size: 18px;
  font-weight: 700;
}
.result-val.highlight {
  color: #22c55e;
}
.result-unit {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
}

/* ==========================================================================
   Toast Notification System - Premium Styles
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 420px;
  padding: 16px 20px;
  border-radius: var(--border-radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, margin-bottom 0.3s ease, height 0.3s ease;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-message {
  flex-grow: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  margin-left: 4px;
  transition: var(--transition-smooth);
}

.toast-close:hover {
  color: var(--text-primary);
}

/* Toast Color Variants matching design tokens */
.toast-success {
  border-left: 4px solid var(--color-green);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-surface) 100%);
}

.toast-error {
  border-left: 4px solid var(--color-red);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-surface) 100%);
}

.toast-warning {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-surface) 100%);
}

.toast-info {
  border-left: 4px solid var(--btn-primary-bg);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.05) 0%, var(--bg-surface) 100%);
}


