/* ==========================================================================
   DESIGN TOKENS & SYSTEM VARIABLES (EMERALD DARK MODE - CYBER LUXURY)
   ========================================================================== */
:root {
  --font-family: 'Montserrat', sans-serif;

  /* Colors */
  --bg-base: #0B120F;          /* Obsidian-Emerald Black */
  --bg-card: #121E1A;          /* Deep Malachite Green */
  --accent: #00E699;           /* Vibrant Neon Emerald */
  --accent-rgb: 0, 230, 153;
  --accent-hover: #00cc88;
  --accent-glow: rgba(0, 230, 153, 0.15);
  
  --text-primary: #E5F5F0;     /* Mint Tinted Frost */
  --text-secondary: #8FA89F;   /* Muted Sage */
  --text-muted: #5C736A;       /* Slate Sage */
  
  --border-color: rgba(0, 230, 153, 0.15);
  --border-focus: rgba(0, 230, 153, 0.4);
  
  --alert-error: #FF3B3B;      /* Crimson Red */
  --alert-error-bg: rgba(255, 59, 59, 0.08);
  --alert-error-border: rgba(255, 59, 59, 0.25);
  
  --alert-success: #00E699;
  --alert-success-bg: rgba(0, 230, 153, 0.08);
  --alert-success-border: rgba(0, 230, 153, 0.25);

  --btn-accent: #00b3e6;       /* Clean Cyan Accent for Extensions */
  --btn-accent-hover: #0099c2;
  
  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
  position: relative;
}

/* ==========================================================================
   VISUAL EFFECTS (CYBER GLOW MATRIX)
   ========================================================================== */
.cyber-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(0, 230, 153, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 230, 153, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  z-index: 1;
  pointer-events: none;
}

.cyber-glow-orb-1 {
  position: fixed;
  top: -10%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0, 230, 153, 0.04) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}

.cyber-glow-orb-2 {
  position: fixed;
  bottom: -15%;
  left: -5%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(0, 230, 153, 0.03) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 24px;
  z-index: 2;
  position: relative;
  flex: 1;
}

/* ==========================================================================
   CARDS & CONTAINERS
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(0, 230, 153, 0.02);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: rgba(0, 230, 153, 0.28);
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(0, 230, 153, 0.05);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 230, 153, 0.3), rgba(0, 230, 153, 0.1), transparent);
}

/* ==========================================================================
   LOGIN MODULE
   ========================================================================== */
#login-view {
  max-width: 460px;
  margin: 10% auto;
}

.brand-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-logo-img {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(0, 230, 153, 0.3);
  box-shadow: 0 0 20px rgba(0, 230, 153, 0.15);
  object-fit: contain;
  animation: pulse-glow 3s infinite;
}

.brand-logo-img.mini {
  width: 40px;
  height: 40px;
  margin-bottom: 0;
  border-radius: 8px;
}

.brand-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.brand-title span {
  color: var(--accent);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ==========================================================================
   DASHBOARD LAYER
   ========================================================================== */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left h1 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.user-badge {
  background: rgba(0, 230, 153, 0.08);
  border: 1px solid rgba(0, 230, 153, 0.15);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 13px;
  color: var(--text-primary);
  margin-right: 16px;
  display: inline-block;
}

/* METRICS PANEL */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: rgba(18, 30, 26, 0.6);
  border: 1px solid rgba(0, 230, 153, 0.1);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: left;
  transition: all var(--transition-fast);
}

.metric-card:hover {
  border-color: rgba(0, 230, 153, 0.25);
  transform: translateY(-2px);
}

.metric-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus {
  border-color: var(--border-focus);
  background-color: rgba(0, 230, 153, 0.03);
  box-shadow: 0 0 12px rgba(0, 230, 153, 0.08);
}

input::placeholder {
  color: var(--text-muted);
}

/* Radio Group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.radio-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-primary);
}

.radio-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-label {
  position: relative;
  padding-left: 28px;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.radio-container:hover .radio-label {
  color: var(--text-primary);
}

.radio-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.02);
  transition: all var(--transition-fast);
}

.radio-container input:checked ~ .radio-label::before {
  border-color: var(--accent);
  background-color: rgba(0, 230, 153, 0.1);
}

.radio-label::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  transition: transform var(--transition-fast);
}

.radio-container input:checked ~ .radio-label::after {
  transform: translateY(-50%) scale(1);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #00b377 100%);
  color: #030805;
  box-shadow: 0 4px 14px rgba(0, 230, 153, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 230, 153, 0.35);
}

.btn-accent {
  background: linear-gradient(135deg, var(--btn-accent) 0%, #0088b3 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 179, 230, 0.25);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 179, 230, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 4px;
}

/* ==========================================================================
   DASHBOARD GRID & SECTIONS
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

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

.grid-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.section-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Key display box styling */
.key-box {
  margin-top: 24px;
  background-color: rgba(0, 230, 153, 0.04);
  border: 1px dashed rgba(0, 230, 153, 0.3);
  border-radius: 8px;
  padding: 16px;
  animation: slide-up var(--transition-normal);
}

.key-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.key-display-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
}

#generated-key-text {
  font-family: monospace;
  font-size: 13.5px;
  color: var(--accent);
  word-break: break-all;
  font-weight: bold;
}

.key-box-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.4;
}

/* ==========================================================================
   LEDGER SECTION
   ========================================================================== */
.ledger-section {
  margin-bottom: 40px;
}

.ledger-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.ledger-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  max-width: 240px;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.ledger-table th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ledger-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  vertical-align: middle;
}

.ledger-table tr:hover td {
  background-color: rgba(0, 230, 153, 0.015);
}

.ledger-table code {
  font-family: monospace;
  background-color: rgba(255, 255, 255, 0.04);
  padding: 3px 6px;
  border-radius: 4px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* ==========================================================================
   BADGES & LABELS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-emerald {
  background-color: rgba(0, 230, 153, 0.08);
  border: 1px solid rgba(0, 230, 153, 0.18);
  color: var(--accent);
}

.badge-crimson {
  background-color: rgba(255, 59, 59, 0.08);
  border: 1px solid rgba(255, 59, 59, 0.18);
  color: var(--alert-error);
}

.badge-muted {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* Helper text coloring */
.text-emerald { color: var(--accent) !important; }
.text-crimson { color: var(--alert-error) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }

/* ==========================================================================
   ALERTS & NOTIFICATIONS
   ========================================================================== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 16px;
  animation: slide-up var(--transition-fast);
}

.alert.error {
  background-color: var(--alert-error-bg);
  border: 1px solid var(--alert-error-border);
  color: #ffb3b3;
}

.alert.success {
  background-color: var(--alert-success-bg);
  border: 1px solid var(--alert-success-border);
  color: #b3ffd9;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 24px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  margin-top: 40px;
  z-index: 2;
  position: relative;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
.fade-in {
  animation: fade-in-keyframes var(--transition-normal) forwards;
}

.slide-up {
  animation: slide-up var(--transition-normal) forwards;
}

@keyframes fade-in-keyframes {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse-glow {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); text-shadow: 0 0 10px rgba(0, 230, 153, 0.4); }
}
