/* Custom CSS Design System - CustodiaGuard Dashboard */

:root {
  /* Colors */
  --bg-primary: #0a0c10;
  --bg-secondary: #121620;
  --bg-panel: rgba(18, 22, 32, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 242, 254, 0.15);
  
  --color-cyan: #00f2fe;
  --color-purple: #9d4edd;
  --color-green: #390099; /* Deep purple/blue */
  --color-neon-green: #39ff14;
  --color-neon-orange: #ff9f1c;
  --color-neon-red: #ff3838;
  --color-text-primary: #f8f9fa;
  --color-text-secondary: #a0aec0;
  --color-text-muted: #4a5568;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--color-text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header styling */
.app-header {
  height: 70px;
  background-color: rgba(10, 12, 16, 0.9);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  text-shadow: 0 0 10px var(--color-cyan);
}

.logo-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #00f2fe 0%, #4facfe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text span {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

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

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.connected .status-dot {
  background-color: var(--color-neon-green);
  box-shadow: 0 0 8px var(--color-neon-green);
}

.disconnected .status-dot {
  background-color: var(--color-neon-red);
  box-shadow: 0 0 8px var(--color-neon-red);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
}

.user-role {
  font-size: 10px;
  color: var(--color-cyan);
  font-weight: 500;
  text-transform: uppercase;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 16px;
  transition: color 0.2s, transform 0.2s;
}

.btn-logout:hover {
  color: var(--color-neon-red);
  transform: translateX(2px);
}

/* Main Workspace Grid */
.app-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px;
  background-color: var(--bg-primary);
  height: calc(100vh - 70px);
}

/* Panel Design (Glassmorphism) */
.panel {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.panel:hover {
  border-color: rgba(0, 242, 254, 0.25);
  box-shadow: 0 8px 32px 0 rgba(0, 242, 254, 0.05);
}

.panel-header {
  padding: 16px 20px;
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-icon {
  font-size: 18px;
}

.panel-title h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-primary);
}

.panel-content {
  flex: 1;
  padding: 20px;
  position: relative;
}

.scrollable {
  overflow-y: auto;
}

/* CRT Screen Effect for Terminal */
.terminal-wrapper {
  padding: 0;
  background-color: #030508;
}

.crt-screen {
  width: 100%;
  height: 100%;
  padding: 24px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.crt-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
  z-index: 2;
}

.terminal-dots .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 6px;
}

.dot.red { background-color: var(--color-neon-red); }
.dot.yellow { background-color: var(--color-neon-orange); }
.dot.green { background-color: var(--color-neon-green); }

.terminal-body {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-cyan);
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.7);
  overflow-y: auto;
  padding-bottom: 20px;
  z-index: 1;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}
.terminal-body::-webkit-scrollbar-thumb {
  background-color: rgba(0, 242, 254, 0.2);
  border-radius: 4px;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 15px;
  margin-top: 10px;
  z-index: 1;
}

.terminal-input-line .prompt {
  color: var(--color-neon-green);
  text-shadow: 0 0 5px rgba(57, 255, 20, 0.7);
  font-weight: 700;
}

#terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  caret-color: var(--color-cyan);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
}

/* Inspectors Right Column Stack */
.inspectors-column {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 20px;
  overflow: hidden;
}

/* Tab controls */
.db-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--color-text-secondary);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary);
}

.tab-btn.active {
  background-color: rgba(0, 242, 254, 0.1);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.tab-content {
  display: none;
  height: 100%;
}

.tab-content.active {
  display: block;
}

/* SQL Tables Styling */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.15);
}

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

th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--color-text-secondary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Animations for database updates */
@keyframes row-update {
  0% {
    background-color: rgba(0, 242, 254, 0.3);
    box-shadow: 0 0 15px var(--color-cyan);
  }
  100% {
    background-color: transparent;
  }
}

.row-updated {
  animation: row-update 1.5s ease-out;
}

/* Blockchain Visualizer Styling */
.block-height-wrapper {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-neon-green);
  background-color: rgba(57, 255, 20, 0.05);
  border: 1px solid rgba(57, 255, 20, 0.2);
  padding: 4px 10px;
  border-radius: 4px;
}

.ledger-section {
  margin-bottom: 20px;
}

.ledger-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

/* Wallets layout */
.wallets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.wallet-card {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.wallet-card:hover {
  background-color: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.wallet-icon {
  font-size: 20px;
}

.wallet-info {
  display: flex;
  flex-direction: column;
}

.wallet-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.wallet-address {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-balance {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-cyan);
}

/* Active PDA Card */
.pda-state-card {
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-color);
  padding: 16px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pda-state-card.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.03) 0%, rgba(157, 78, 221, 0.03) 100%);
  border: 1px solid rgba(0, 242, 254, 0.3);
  box-shadow: inset 0 0 15px rgba(0, 242, 254, 0.05);
  display: block;
}

.pda-placeholder {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
}

.pda-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pda-row:last-child {
  border-bottom: none;
}

.pda-label {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.pda-val {
  font-family: var(--font-mono);
  color: var(--color-text-primary);
}

.pda-val.highlight {
  color: var(--color-cyan);
  font-weight: 700;
}

/* Transaction history */
.tx-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  animation: slide-in 0.3s ease-out;
}

@keyframes slide-in {
  0% { transform: translateY(5px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.tx-sig {
  color: var(--color-text-secondary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.tx-sig:hover {
  color: var(--color-cyan);
}

.tx-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.tx-badge.success {
  background-color: rgba(57, 255, 20, 0.1);
  color: var(--color-neon-green);
  border: 1px solid rgba(57, 255, 20, 0.2);
}

.tx-row-empty {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 10px 0;
}

/* Badges */
.badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 10px;
}

.badge-active {
  background-color: rgba(57, 255, 20, 0.1);
  color: var(--color-neon-green);
}

.badge-inactive {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
