/* LibSignal Portfolio Showcase & Cryptographic Inspector Stylesheet */

:root {
  --bg-dark: #070a12;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --bg-hover: rgba(30, 41, 59, 0.8);
  --accent-cyan: #00f2fe;
  --accent-emerald: #00ff87;
  --accent-purple: #c084fc;
  --accent-amber: #fbbf24;
  --accent-rose: #f43f5e;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --focus-ring: #00f2fe;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Accessibility: Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--accent-cyan);
  color: #000;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  border-radius: 0.5rem;
  z-index: 9999;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid #ffffff;
}

/* WCAG 2.1 AA Focus Rings */
:focus-visible {
  outline: 3px solid var(--focus-ring) !important;
  outline-offset: 3px !important;
  border-radius: 4px;
}

/* Background Dynamic Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* Container */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header & Banner */
header.header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 900;
  font-size: 1.5rem;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.4);
}

.title-area h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-area p {
  font-size: 0.875rem;
  color: var(--accent-cyan);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #00b4d8);
  color: #040914;
  font-weight: 700;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.5);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--bg-card-border);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--accent-cyan);
}

.btn-outline {
  background: transparent;
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

.btn-outline:hover {
  background: rgba(0, 255, 135, 0.1);
}

/* Audio Toggle Button */
.audio-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--bg-card-border);
  color: var(--text-secondary);
  padding: 0.6rem;
  border-radius: 0.6rem;
  cursor: pointer;
}

.audio-btn.active {
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(0, 255, 135, 0.3);
}

/* Main Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

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

/* Cards & Glassmorphism */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  position: relative;
}

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

.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-title svg {
  color: var(--accent-cyan);
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.badge-cyan { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); border: 1px solid rgba(0, 242, 254, 0.3); }
.badge-emerald { background: rgba(0, 255, 135, 0.15); color: var(--accent-emerald); border: 1px solid rgba(0, 255, 135, 0.3); }
.badge-purple { background: rgba(192, 132, 252, 0.15); color: var(--accent-purple); border: 1px solid rgba(192, 132, 252, 0.3); }

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--bg-card-border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

/* Ratchet Visualizer Container */
.ratchet-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
  background: rgba(3, 7, 18, 0.6);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .ratchet-stage {
    grid-template-columns: 1fr;
  }
}

.party-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--bg-card-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.party-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #000;
}

.avatar-alice { background: var(--accent-cyan); box-shadow: 0 0 12px rgba(0, 242, 254, 0.4); }
.avatar-bob { background: var(--accent-emerald); box-shadow: 0 0 12px rgba(0, 255, 135, 0.4); }

.party-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.key-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.key-item {
  background: rgba(2, 6, 23, 0.8);
  padding: 0.5rem 0.75rem;
  border-radius: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.key-label {
  color: var(--text-muted);
}

.key-value {
  color: var(--accent-cyan);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* Ratchet Pipe Animation */
.pipe-channel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
}

.packet-anim {
  width: 100px;
  height: 4px;
  background: var(--bg-card-border);
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}

.packet-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 100%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  border-radius: 2px;
  animation: travel 1.5s infinite linear;
}

@keyframes travel {
  0% { left: -30%; }
  100% { left: 100%; }
}

/* Playground Form & Input */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input, .form-textarea {
  width: 100%;
  background: rgba(3, 7, 18, 0.8);
  border: 1px solid var(--bg-card-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--accent-cyan);
}

/* Console Output & ARIA Live Log */
.console-box {
  background: #030712;
  border: 1px solid var(--bg-card-border);
  border-radius: 0.75rem;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  height: 260px;
  overflow-y: auto;
  color: #a7f3d0;
}

.console-line {
  margin-bottom: 0.4rem;
  display: flex;
  gap: 0.5rem;
}

.console-ts {
  color: var(--text-muted);
}

.console-info { color: var(--accent-cyan); }
.console-success { color: var(--accent-emerald); }
.console-warn { color: var(--accent-amber); }
.console-error { color: var(--accent-rose); }

/* Telemetry Canvas */
#telemetry-canvas {
  width: 100%;
  height: 160px;
  background: rgba(3, 7, 18, 0.8);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Hotkey Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #0f172a;
  border: 1px solid var(--accent-cyan);
  border-radius: 1rem;
  max-width: 520px;
  width: 90%;
  padding: 1.75rem;
  box-shadow: 0 0 32px rgba(0, 242, 254, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.hotkey-row {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

kbd {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  box-shadow: 0 2px 0 #0f172a;
}

/* Footer */
footer.footer-bar {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--bg-card-border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}
