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

:root {
  --bg-color: #080a10;
  --panel-bg: rgba(17, 24, 39, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.25);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.05) 0%, transparent 40%);
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(8, 10, 16, 0.8);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.logo-section h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-cyan), #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-section span {
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-left: 1px solid var(--border-color);
  padding-left: 0.5rem;
}

.status-badges {
  display: flex;
  gap: 0.75rem;
}

.badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.badge.success .dot { background-color: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }
.badge.warning .dot { background-color: var(--accent-gold); box-shadow: 0 0 8px var(--accent-gold); }
.badge.danger .dot { background-color: var(--accent-rose); box-shadow: 0 0 8px var(--accent-rose); }
.badge.info .dot { background-color: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }

/* Main Grid Layout */
main {
  flex: 1;
  display: grid;
  grid-template-columns: 350px 1fr;
  padding: 1.5rem;
  gap: 1.5rem;
  height: calc(100vh - 70px);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Ledger Panel (Left) */
.ledger-container {
  height: 100%;
}

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

.panel-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.receipt-count {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.ledger-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.ledger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.ledger-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.ledger-item .sno {
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  color: var(--text-muted);
  font-size: 0.85rem;
  width: 45px;
}

.ledger-item .amount {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.ledger-item .delete-btn {
  background: transparent;
  border: none;
  color: var(--accent-rose);
  cursor: pointer;
  opacity: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.ledger-item:hover .delete-btn {
  opacity: 0.7;
}

.ledger-item .delete-btn:hover {
  opacity: 1;
  background: rgba(244, 63, 94, 0.1);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  gap: 1rem;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
  opacity: 0.3;
}

/* Control & Display Panel (Right) */
.workspace-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
}

.metrics-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.metric-card {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 160px;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  filter: blur(50px);
  z-index: 0;
}

.metric-card.grand-total::after {
  background: var(--accent-gold-glow);
}

.metric-card.sub-total::after {
  background: var(--accent-emerald-glow);
}

.metric-card * {
  z-index: 1;
}

.metric-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.metric-value {
  font-family: 'Outfit', sans-serif;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
}

.grand-total .metric-value {
  color: var(--accent-gold);
}

.sub-total .metric-value {
  color: var(--accent-emerald);
}

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

/* Voice Console (Center Area) */
.voice-console {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  position: relative;
}

/* Voice Activity Pulse & Mic Button */
.mic-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.mic-halo {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--accent-cyan-glow);
  transform: scale(1);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 0;
}

.mic-wrapper.recording .mic-halo {
  animation: ripple 1.8s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
  opacity: 1;
}

@keyframes ripple {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.mic-btn {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, var(--accent-cyan));
  border: none;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(6, 182, 212, 0.35);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mic-btn svg {
  width: 38px;
  height: 38px;
  fill: #fff;
  transition: all 0.2s ease;
}

.mic-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(6, 182, 212, 0.5);
}

.mic-btn:active {
  transform: scale(0.95);
}

.mic-wrapper.recording .mic-btn {
  background: linear-gradient(135deg, #e11d48, var(--accent-rose));
  box-shadow: 0 10px 25px rgba(244, 63, 94, 0.35);
}

.mic-wrapper.disabled .mic-btn {
  background: #27272a;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

.mic-status-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--text-main);
  text-align: center;
}

/* VAD Volume Ring / Indicator */
.vad-visualizer {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 35px;
  margin-top: 0.5rem;
}

.vad-bar {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--border-color);
  transition: height 0.05s ease, background-color 0.2s ease;
}

.mic-wrapper.recording ~ .vad-visualizer .vad-bar {
  background-color: var(--accent-cyan);
}

/* Live Logger / Output Display */
.live-output {
  width: 100%;
  max-width: 500px;
  min-height: 80px;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.heard-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.heard-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-main);
}

.heard-parsed {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Manual & Control Buttons Row */
.action-buttons-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 0 2rem 2rem 2rem;
}

.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 0.5rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  transition: stroke 0.2s ease;
}

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

.btn:hover svg {
  stroke: var(--text-main);
}

.btn.primary {
  border-color: rgba(6, 182, 212, 0.3);
}
.btn.primary:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--accent-cyan);
}
.btn.primary:hover svg {
  stroke: var(--accent-cyan);
}

/* Modals & Overlays */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 6, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  display: none; /* JS triggers flex */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  text-align: center;
}

.overlay.active {
  display: flex;
}

.overlay-card {
  max-width: 420px;
  padding: 2.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* Progress bar inside loading overlay */
.progress-container {
  width: 100%;
  margin-top: 1rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), #3b82f6);
  border-radius: 3px;
  transition: width 0.1s ease;
}

.overlay-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
}

.overlay-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.overlay .btn-large {
  padding: 0.85rem 2rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(14, 165, 233, 0.2);
  transition: all 0.2s ease;
}

.overlay .btn-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(14, 165, 233, 0.35);
}

/* Book Complete Glow styling */
.completion-glow {
  text-shadow: 0 0 15px var(--accent-gold-glow);
  color: var(--accent-gold);
}

.completion-total {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  margin: 0.5rem 0;
}

/* Language selection style */
.language-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.language-selector select {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
}

.language-selector select option {
  background: var(--bg-color);
  color: var(--text-main);
}

/* Mobile responsive adjustments */
@media (max-width: 900px) {
  body {
    overflow: auto;
  }
  main {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .ledger-container {
    height: 400px;
  }
  .metrics-row {
    grid-template-columns: 1fr;
  }
}
