/* ========================================
   GOLF STATS TERMINAL - Retro CRT Style
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
  --bg-color: #0a0a0a;
  --text-color: #00ff41;
  --text-dim: #00aa2a;
  --text-bright: #00ff88;
  --danger-color: #ff3333;
  --warning-color: #ffaa00;
  --box-border: #00ff41;
  --btn-bg: #001a00;
  --btn-hover: #003300;
  --btn-active: #004400;
  --glow: 0 0 10px #00ff41, 0 0 20px #00ff4166;
  --glow-strong: 0 0 10px #00ff41, 0 0 20px #00ff41, 0 0 40px #00ff4166;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'VT323', monospace;
  font-size: 18px;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.4;
}

/* CRT Effect Container */
.crt {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.crt::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
  z-index: 100;
}

/* Scanlines */
.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 99;
}

/* Terminal Container */
.terminal {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* Header */
.terminal-header {
  text-align: center;
  margin-bottom: 16px;
}

.ascii-title {
  font-size: 18px;
  padding: 16px 16px;
  border: 1px solid var(--text-color);
  text-shadow: var(--glow);
  display: block;
}

/* Quote */
.quote-container {
  padding: 12px 0;
  min-height: 80px;
  text-transform: uppercase;
}

.quote-text {
  font-size: 16px;
  color: var(--text-color);
  line-height: 18px;
}

.quote-text::after {
  content: '█';
  animation: blink 1s step-start infinite;
  margin-left: 2px;
}

.quote-text.done::after {
  display: none;
}

.quote-author {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.quote-author.visible {
  opacity: 1;
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
  gap: 24px;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

/* Terminal Box */
.terminal-box {
  display: flex;
  flex-direction: column;
}

.box-header {
  font-size: 14px;
  color: var(--text-dim);
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.box-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--box-border);
}

.box-content {
  padding: 8px 0;
}

/* Button Grid */
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quality-grid {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Retro Buttons */
.retro-btn {
  font-family: 'VT323', monospace;
  font-size: 20px;
  padding: 12px 8px;
  background: var(--btn-bg);
  color: var(--text-color);
  border: 1px solid var(--text-color);
  cursor: pointer;
  transition: all 0.1s;
  text-transform: uppercase;
  position: relative;
}

.retro-btn:hover {
  background: var(--btn-hover);
  text-shadow: var(--glow);
}

.retro-btn:active,
.retro-btn.selected {
  background: var(--btn-active);
  box-shadow: var(--glow), inset 0 0 10px rgba(0, 255, 65, 0.3);
  text-shadow: var(--glow-strong);
}

.retro-btn .key {
  font-size: 14px;
  opacity: 0.6;
  display: block;
  margin-bottom: 2px;
}

/* Type buttons colors */
.type-btn[data-type="depart"].selected { border-color: #00ffff; color: #00ffff; }
.type-btn[data-type="fairway"].selected { border-color: #00ff00; color: #00ff00; }
.type-btn[data-type="approche"].selected { border-color: #ffff00; color: #ffff00; }
.type-btn[data-type="chip"].selected { border-color: #ff8800; color: #ff8800; }

/* Quality buttons */
.quality-btn.bon { border-color: var(--text-color); }
.quality-btn.ok { border-color: var(--warning-color); color: var(--warning-color); }
.quality-btn.nul { border-color: var(--danger-color); color: var(--danger-color); }

.quality-btn.bon:active { box-shadow: 0 0 15px #00ff41; }
.quality-btn.ok:active { box-shadow: 0 0 15px #ffaa00; }
.quality-btn.nul:active { box-shadow: 0 0 15px #ff3333; }

/* Action buttons */
.action-btn {
  flex: 1;
}

.action-btn.danger {
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.action-btn.danger:hover {
  background: #220000;
}

.status-box {
}

.mini-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0;
}

/* Terminal Actions */
.terminal-actions {
  display: flex;
  gap: 8px;
}

/* Status Box */
.status-box .box-content {
  font-size: 16px;
}

.status-line {
  margin: 4px 0;
}

.prompt {
  color: var(--text-bright);
  margin-right: 4px;
}

/* Stats Container */
.stats-container .box-content {
  flex: 1;
  overflow-y: auto;
}

.stat-type {
  margin-bottom: 16px;
}

.stat-type-name {
  font-size: 16px;
  color: var(--text-bright);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.stat-bar {
  display: flex;
  align-items: center;
  margin: 4px 0;
  font-size: 14px;
}

.stat-label {
  width: 40px;
}

.stat-bar-container {
  flex: 1;
  height: 12px;
  background: var(--btn-bg);
  margin: 0 8px;
  border: 1px solid var(--text-dim);
}

.stat-bar-fill {
  height: 100%;
  transition: width 0.3s;
}

.stat-bar-fill.bon { background: var(--text-color); }
.stat-bar-fill.ok { background: var(--warning-color); }
.stat-bar-fill.nul { background: var(--danger-color); }

.stat-percent {
  width: 45px;
  text-align: right;
}

/* Footer */
.terminal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  font-size: 16px;
  color: var(--text-dim);
}

.blink {
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.footer-text {
  text-transform: uppercase;
}

/* Feedback Animation */
@keyframes flash {
  0% { background: var(--text-color); }
  100% { background: transparent; }
}

.flash {
  animation: flash 0.2s ease-out;
}

/* Toast notifications */
.toast {
  position: fixed;
  display: flex;
  white-space: nowrap;
  justify-content: center;
  align-items: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-color);
  border: 2px solid var(--text-color);
  padding: 20px 30px;
  font-size: 20px;
  text-shadow: var(--glow-strong);
  box-shadow: var(--glow), 0 0 50px rgba(0, 255, 65, 0.5);
  z-index: 1000;
  animation: toastIn 0.1s ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Confirm dialog */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.confirm-box {
  background: var(--bg-color);
  border: 2px solid var(--danger-color);
  padding: 20px;
  max-width: 340px;
  text-align: center;
}

.confirm-box p {
  margin-bottom: 16px;
  font-size: 18px;
}

.confirm-buttons {
  display: flex;
  gap: 10px;
}

.confirm-buttons .retro-btn {
  flex: 1;
}

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

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--text-dim);
  border: 1px solid var(--text-color);
}

/* No selection on buttons */
button {
  user-select: none;
  -webkit-user-select: none;
}

/* Accessibility - reduced motion */
@media (prefers-reduced-motion: reduce) {
  .scanlines,
  .crt::before {
    display: none;
  }

  .blink {
    animation: none;
  }

  * {
    transition: none !important;
    animation-duration: 0.01ms !important;
  }
}
