/* ============================================
   AZURE TRANSLATOR DASHBOARD - MAIN STYLES
   Cyber-Dark Theme with 3D Elements
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Rajdhani:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap");

/* ── CSS VARIABLES ── */
:root {
  --bg-void: #020408;
  --bg-deep: #040c14;
  --bg-panel: #061018;
  --bg-card: #0a1a28;
  --bg-hover: #0d2035;

  --neon-cyan: #00f5ff;
  --neon-blue: #0080ff;
  --neon-purple: #8b00ff;
  --neon-pink: #ff0080;
  --neon-green: #00ff88;
  --neon-gold: #ffd700;
  --neon-orange: #ff6600;

  --text-primary: #e0f4ff;
  --text-secondary: #7ab8d4;
  --text-muted: #3a6a84;
  --text-accent: #00f5ff;

  --border-dim: rgba(0, 245, 255, 0.1);
  --border-glow: rgba(0, 245, 255, 0.4);
  --border-bright: rgba(0, 245, 255, 0.8);

  --shadow-cyan: 0 0 20px rgba(0, 245, 255, 0.3);
  --shadow-blue: 0 0 20px rgba(0, 128, 255, 0.3);
  --shadow-deep: 0 20px 60px rgba(0, 0, 0, 0.8);

  --font-display: "Orbitron", monospace;
  --font-body: "Rajdhani", sans-serif;
  --font-mono: "Share Tech Mono", monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── RESET & BASE ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 3px;
  box-shadow: 0 0 6px var(--neon-cyan);
}

/* ── CANVAS BACKGROUND ── */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── LAYOUT WRAPPER ── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(2, 4, 8, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-dim);
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-cyan);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 35px rgba(0, 245, 255, 0.8), 0 0 60px rgba(0, 128, 255, 0.4);
  }
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  text-shadow: 0 0 15px rgba(0, 245, 255, 0.6);
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.header-stats {
  display: flex;
  gap: 2rem;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
  transition: var(--transition);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.control-btn {
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.control-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: var(--shadow-cyan);
  transform: translateY(-2px);
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ── METRIC CARDS ROW ── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
  opacity: 0.8;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -30%;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
  opacity: 0.06;
  border-radius: 50%;
  transition: var(--transition-slow);
}

.metric-card:hover {
  border-color: var(--accent-color);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 245, 255, 0.1);
}

.metric-card:hover::after {
  opacity: 0.12;
  transform: scale(1.3);
}

.metric-card[data-accent="cyan"] {
  --accent-color: var(--neon-cyan);
}
.metric-card[data-accent="blue"] {
  --accent-color: var(--neon-blue);
}
.metric-card[data-accent="green"] {
  --accent-color: var(--neon-green);
}
.metric-card[data-accent="gold"] {
  --accent-color: var(--neon-gold);
}

.metric-icon {
  font-size: 2rem;
  margin-bottom: 0.8rem;
  filter: drop-shadow(0 0 8px var(--accent-color));
}

.metric-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent-color);
  text-shadow: 0 0 15px rgba(0, 245, 255, 0.5);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.metric-title {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.metric-trend {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--neon-green);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── TRANSLATOR SECTION ── */
.translator-section {
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-xl);
  overflow: visible !important;
  position: relative;
  min-height: 400px;
}

.translator-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 245, 255, 0.02) 0%,
    transparent 50%,
    rgba(0, 128, 255, 0.02) 100%
  );
  pointer-events: none;
}

.translator-pane {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.pane-header {
  padding: 1.2rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-deep);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  min-width: 180px;
  position: relative;
}

.lang-selector:hover {
  border-color: var(--neon-cyan);
  box-shadow: var(--shadow-cyan);
}

.lang-flag {
  font-size: 1.2rem;
}

.lang-name {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  flex: 1;
}

.lang-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
}

.lang-dropdown {
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  width: 220px;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 999999;
  display: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), var(--shadow-cyan);
  pointer-events: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.lang-dropdown::-webkit-scrollbar {
  width: 6px;
}
.lang-dropdown::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
}
.lang-dropdown::-webkit-scrollbar-thumb {
  background: var(--neon-cyan);
  border-radius: 6px;
}

.lang-dropdown.open {
  display: block;
  animation: dropDown 0.2s ease;
}

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

.lang-option {
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-secondary);
  pointer-events: auto;
  user-select: none;
  position: relative;
  z-index: 2;
}

.lang-option:hover {
  background: rgba(0, 245, 255, 0.08);
  color: var(--neon-cyan);
}

.lang-option.active {
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.05);
}

.pane-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

.action-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
}

.text-area-wrapper {
  flex: 1;
  position: relative;
}

textarea.translator-input {
  width: 100%;
  height: 100%;
  min-height: 280px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  padding: 1.5rem;
  resize: none;
  caret-color: var(--neon-cyan);
}

textarea.translator-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.output-text {
  padding: 1.5rem;
  min-height: 280px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
  position: relative;
}

.output-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.char-counter {
  position: absolute;
  bottom: 1rem;
  right: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.char-counter.warning {
  color: var(--neon-orange);
}
.char-counter.danger {
  color: var(--neon-pink);
}

/* ── TRANSLATOR MIDDLE ── */
.translator-middle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--border-dim);
  border-right: 1px solid var(--border-dim);
  background: rgba(0, 0, 0, 0.2);
  gap: 1rem;
  padding: 1rem 0;
}

.swap-btn {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  border: none;
  border-radius: 50%;
  color: var(--bg-void);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
  box-shadow: var(--shadow-cyan);
}

.swap-btn:hover {
  transform: rotate(180deg) scale(1.1);
  box-shadow: 0 0 30px rgba(0, 245, 255, 0.6);
}

.translate-btn {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
  box-shadow: 0 0 20px rgba(139, 0, 255, 0.4);
}

.translate-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(139, 0, 255, 0.7);
}

.translate-btn.loading {
  animation: spinPulse 0.8s linear infinite;
}

@keyframes spinPulse {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ── BOTTOM ROW ── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ── PANEL BASE ── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: var(--transition);
}

.panel:hover {
  border-color: rgba(0, 245, 255, 0.2);
}

.panel-header {
  padding: 1.2rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.4);
}

.panel-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.3);
  padding: 3px 8px;
  border-radius: 20px;
}

.panel-body {
  padding: 1.2rem 1.5rem;
}

/* ── HISTORY LIST ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  background: var(--bg-deep);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.8rem;
  align-items: center;
}

.history-item:hover {
  border-color: var(--neon-cyan);
  background: var(--bg-hover);
  transform: translateX(4px);
}

.history-langs {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neon-cyan);
  letter-spacing: 1px;
}

.history-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── LANG STATS ── */
.lang-stats {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.lang-stat-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.lang-stat-flag {
  font-size: 1.2rem;
  width: 26px;
  text-align: center;
}

.lang-stat-info {
  flex: 1;
}

.lang-stat-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.lang-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.lang-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-blue));
  border-radius: 2px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(0, 245, 255, 0.4);
}

.lang-stat-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neon-cyan);
  min-width: 35px;
  text-align: right;
}

/* ── CONFIDENCE METER ── */
.confidence-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  border-top: 1px solid var(--border-dim);
  background: rgba(0, 0, 0, 0.2);
}

.confidence-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.confidence-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
  border-radius: 3px;
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.confidence-value {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon-green);
  min-width: 40px;
  text-align: right;
}

/* ── DETECTED LANG ── */
.detected-lang {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--neon-gold);
  padding: 0 1.5rem 0.8rem;
  opacity: 0;
  transition: var(--transition);
}

.detected-lang.visible {
  opacity: 1;
}

.detected-dot {
  width: 6px;
  height: 6px;
  background: var(--neon-gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon-gold);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ── STATUS BAR ── */
.status-bar {
  height: 36px;
  background: rgba(0, 0, 0, 0.5);
  border-top: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 2rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
  animation: blink 2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--neon-pink);
  box-shadow: 0 0 6px var(--neon-pink);
}

/* ── NOTIFICATION TOAST ── */
.toast-container {
  position: fixed;
  top: 90px;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-cyan), var(--shadow-deep);
  animation: slideIn 0.3s ease;
  min-width: 280px;
}

.toast.success {
  border-color: rgba(0, 255, 136, 0.5);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.toast.error {
  border-color: rgba(255, 0, 128, 0.5);
  box-shadow: 0 0 20px rgba(255, 0, 128, 0.2);
}

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

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .translator-section {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .translator-middle {
    flex-direction: row;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border-dim);
    border-bottom: 1px solid var(--border-dim);
    padding: 0.8rem 2rem;
  }

  .bottom-row {
    grid-template-columns: 1fr;
  }

  .header-stats {
    display: none;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .main-content {
    padding: 1rem;
  }

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

  .metric-number {
    font-size: 1.7rem;
  }
}