/* WATTxSecret — Dark theme with gold accents */

:root {
  --gold: #E8D44D;
  --gold-dim: #E8D44D99;
  --gold-glow: #E8D44D33;
  --gold-hover: #F0DC5A;
  --bg: #0D1117;
  --bg-alt: #0A0E14;
  --surface: #161B22;
  --surface-hover: #1C2230;
  --text: #E6EDF3;
  --text-muted: #8B949E;
  --text-dim: #6E7681;
  --border: #21262D;
  --error: #F85149;
  --error-bg: rgba(248, 81, 73, 0.1);
  --success: #3FB950;
  --warning: #D29922;
  --warning-bg: rgba(210, 153, 34, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--gold-hover);
}

/* App Container */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.logo-link:hover {
  color: var(--text);
}

/* Logo + lightning wrapper */
.logo-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.logo-wrap .logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 6px var(--gold-glow));
}

.lightning-canvas {
  position: absolute;
  inset: -28px;
  width: calc(100% + 56px);
  height: calc(100% + 56px);
  pointer-events: none;
}

.bolt {
  fill: none;
  stroke: #E8D44D;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.bolt.flash {
  animation: bolt-flash 0.12s ease-out forwards;
}

@keyframes bolt-flash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gold {
  color: var(--gold);
}

.tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Warning Banner */
.warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--warning);
}

.warning-icon {
  font-size: 1.1rem;
}

/* Panel */
.panel {
  flex: 1;
}

.panel h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text);
}

/* Form Container */
.form-container {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* Textarea */
.textarea-wrapper {
  position: relative;
  margin-bottom: 1.25rem;
}

#messageInput {
  width: 100%;
  min-height: 160px;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#messageInput::placeholder {
  color: var(--text-muted);
}

#messageInput:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.char-counter {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

.char-counter.near-limit {
  color: var(--warning);
}

.char-counter.at-limit {
  color: var(--error);
}

/* Controls — Sliders */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.slider-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-value {
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  min-width: 4.5rem;
}

/* Custom Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--gold);
  border-radius: 50%;
  border: 2px solid var(--surface);
  cursor: pointer;
  box-shadow: 0 0 4px var(--gold-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 8px var(--gold-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--gold);
  border-radius: 50%;
  border: 2px solid var(--surface);
  cursor: pointer;
  box-shadow: 0 0 4px var(--gold-glow);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}

/* Actions */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
}

.template-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.template-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gold-hover);
  box-shadow: 0 0 12px var(--gold-glow);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-icon {
  font-size: 1rem;
}

/* Select */
select {
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color var(--transition);
}

select:focus {
  outline: none;
  border-color: var(--gold);
}

/* Result */
.result {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.result h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--gold);
}

.result-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.link-row {
  display: flex;
  gap: 0.5rem;
}

.link-row input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.8rem;
  outline: none;
}

.link-row input:focus {
  border-color: var(--gold);
}

.btn-copy {
  white-space: nowrap;
}

.copy-feedback {
  font-size: 0.8rem;
  color: var(--success);
  margin-top: 0.5rem;
}

.expiry-info {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Decrypt View */
.loading {
  text-align: center;
  padding: 3rem 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.message-display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  text-align: center;
}

#decryptSuccess {
  text-align: center;
}

#decryptSuccess .message-display {
  text-align: left;
}

/* Error State */
#decryptError {
  text-align: center;
  padding: 2rem 1rem;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error-message {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

#decryptError h2 {
  color: var(--error);
}

/* Footer */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-note {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .app {
    padding: 1.5rem 1rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .form-container {
    padding: 1.25rem;
  }

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

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-row {
    justify-content: stretch;
  }

  .btn-row .btn {
    flex: 1;
    justify-content: center;
  }

  .template-row {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 1rem 0.75rem;
  }

  header h1 {
    font-size: 1.25rem;
  }

  .logo-wrap {
    width: 48px;
    height: 48px;
  }

  .logo {
    width: 36px;
    height: 36px;
  }

  .lightning-canvas {
    inset: -20px;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
  }

  .panel h2 {
    font-size: 1.1rem;
  }

  .form-container {
    padding: 1rem;
    border-width: 1px;
  }

  #messageInput {
    min-height: 120px;
    font-size: 0.85rem;
  }

  .link-row {
    flex-direction: column;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }

  .slider-value {
    min-width: 3.5rem;
    font-size: 0.8rem;
  }
}
