/* ==========================================================================
   USSD & IVR TELECOM SUITE - DESIGN SYSTEM & STYLES
   ========================================================================== */

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

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.4);
  
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --phone-body: #1e2530;
  --phone-bezel: #151a22;
  --phone-screen-bg: #0d1b2a;
  --lcd-text: #64dfdf;
  --lcd-glow: rgba(100, 223, 223, 0.25);

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --shadow-subtle: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-phone: 42px;
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

header {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 20px;
  font-weight: 600;
  margin-left: 6px;
}

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

.caller-select-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.85rem;
}

.caller-select-box select {
  background: transparent;
  color: var(--text-primary);
  border: none;
  outline: none;
  font-size: 0.85rem;
  cursor: pointer;
}

.caller-select-box select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-active);
}

/* ==========================================================================
   MAIN LAYOUT (2 COLUMNS: PHONE SIMULATOR & TELEMETRY INSPECTOR)
   ========================================================================== */

main {
  flex: 1;
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 2rem;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 1100px) {
  main {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* ==========================================================================
   FEATURE PHONE SIMULATOR (RETRO GSM PHONE)
   ========================================================================== */

.phone-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-wrapper {
  width: 380px;
  background: linear-gradient(145deg, #2a3442, #18202c);
  border: 3px solid #3b4859;
  border-radius: var(--radius-phone);
  padding: 24px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 0, 0, 0.5);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.speaker-grille {
  width: 60px;
  height: 6px;
  background: #111;
  border-radius: 3px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}

/* SCREEN AREA */
.screen-bezel {
  width: 100%;
  height: 290px;
  background: #0f141d;
  border-radius: 16px;
  padding: 10px;
  border: 2px solid #232b38;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9);
}

.screen {
  width: 100%;
  height: 100%;
  background: var(--phone-screen-bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(100, 223, 223, 0.2);
  box-shadow: inset 0 0 15px var(--lcd-glow);
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  font-size: 0.65rem;
  color: var(--lcd-text);
  border-bottom: 1px solid rgba(100, 223, 223, 0.15);
  background: rgba(0, 0, 0, 0.3);
  font-family: 'JetBrains Mono', monospace;
}

/* Idle Wallpaper Screen */
.screen-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
}

.idle-clock {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

.idle-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.idle-dial-preview {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(100, 223, 223, 0.4);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 1.1rem;
  color: var(--lcd-text);
  font-family: 'JetBrains Mono', monospace;
  min-height: 38px;
  width: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 2px;
}

/* USSD FLASH POPUP MODAL (Inside Phone Screen) */
.ussd-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 27, 42, 0.96);
  backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  padding: 10px;
  z-index: 10;
  animation: fadeIn 0.15s ease-out;
}

.ussd-modal.active {
  display: flex;
}

.ussd-modal-header {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(100, 223, 223, 0.3);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.ussd-message-body {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  line-height: 1.35;
  color: #e2e8f0;
  white-space: pre-wrap;
  overflow-y: auto;
  padding-right: 4px;
}

.ussd-input-group {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ussd-input {
  width: 100%;
  background: #060b13;
  border: 1px solid var(--accent-cyan);
  border-radius: 4px;
  color: #fff;
  padding: 6px 8px;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

.ussd-actions {
  display: flex;
  gap: 6px;
}

.ussd-btn {
  flex: 1;
  padding: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.ussd-btn-send {
  background: var(--accent-cyan);
  color: #061524;
}

.ussd-btn-cancel {
  background: #334155;
  color: #e2e8f0;
}

/* IVR VOICE CALL ACTIVE SCREEN */
.ivr-call-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, #1b2838, #0a101d);
  display: none;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 14px 10px;
  z-index: 10;
  animation: fadeIn 0.2s ease-out;
}

.ivr-call-screen.active {
  display: flex;
}

.ivr-caller-info {
  text-align: center;
}

.ivr-caller-title {
  font-size: 0.75rem;
  color: var(--accent-emerald);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ivr-caller-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.ivr-call-timer {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

/* Waveform Animation */
.audio-visualizer {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  margin: 10px 0;
}

.audio-bar {
  width: 4px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.audio-bar.animating {
  animation: wave 0.8s infinite ease-in-out alternate;
}

.audio-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-bar:nth-child(4) { animation-delay: 0.3s; }
.audio-bar:nth-child(5) { animation-delay: 0.4s; }
.audio-bar:nth-child(6) { animation-delay: 0.2s; }
.audio-bar:nth-child(7) { animation-delay: 0.1s; }

@keyframes wave {
  0% { height: 6px; }
  100% { height: 32px; }
}

.ivr-live-speech-subtitle {
  font-size: 0.75rem;
  color: #cbd5e1;
  text-align: center;
  padding: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  max-height: 70px;
  overflow-y: auto;
  line-height: 1.3;
}

/* KEYPAD */
.keypad {
  width: 100%;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Navigation & Call Row */
.soft-keys-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}

.soft-btn {
  background: #232b38;
  border: 1px solid #3b4859;
  color: #94a3b8;
  height: 28px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.call-keys-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 10px;
}

.btn-call {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
  transition: transform 0.1s;
}

.btn-end {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  border: none;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(244, 63, 94, 0.3);
  transition: transform 0.1s;
}

.btn-nav-center {
  background: #232b38;
  border: 1px solid #3b4859;
  color: #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-call:active, .btn-end:active, .btn-key:active {
  transform: scale(0.95);
}

/* Number Grid */
.number-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.btn-key {
  background: linear-gradient(180deg, #2b3545, #1d2532);
  border: 1px solid #3d4a5d;
  border-radius: 8px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #f8fafc;
  box-shadow: 0 3px 6px rgba(0,0,0,0.5);
  transition: all 0.1s ease;
  user-select: none;
}

.btn-key:hover {
  background: linear-gradient(180deg, #354154, #242e3e);
  border-color: #52637a;
}

.key-num {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.key-letters {
  font-size: 0.55rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-top: 1px;
}

/* Quick Action Shortcuts below phone */
.quick-shortcuts {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.quick-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.quick-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-indigo);
  color: #fff;
}

/* ==========================================================================
   RIGHT PANEL: TELEMETRY & PACKET INSPECTOR
   ========================================================================== */

.inspector-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
}

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

.inspector-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--accent-indigo);
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

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

/* Live Packet Log View */
.code-container {
  background: #080c14;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #38bdf8;
  overflow-x: auto;
  min-height: 240px;
  max-height: 380px;
  white-space: pre-wrap;
  line-height: 1.45;
}

/* Session History Feed */
.history-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.history-action {
  font-weight: 700;
  color: var(--accent-cyan);
}

.history-time {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* User & Points Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
