/* ============================================
   Saturn Airdrop Calculator - Styles
   Theme: Deep space / Saturn rings
   ============================================ */

/* ----- CSS Variables ----- */
:root {
  --bg-deep: #f4f6f8;
  --bg-mid: #eceff3;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: #f3f6f9;
  --border-card: #dee5ed;
  --border-input: #cdd7e3;
  --border-input-focus: rgba(255, 81, 0, 0.45);

  --gold: #ff5100;
  --gold-dim: #e24800;
  --gold-glow: rgba(255, 81, 0, 0.2);
  --accent-blue: #1f2a37;
  --accent-green: #009393;
  --accent-purple: #ff7f45;

  --text-primary: #1d2630;
  --text-secondary: #5d6a78;
  --text-muted: #8c96a3;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 12px 32px rgba(17, 24, 39, 0.08);
  --shadow-glow: 0 0 0 3px rgba(255, 81, 0, 0.09);

  --font-body: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-med: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

body.modal-open {
  overflow: hidden;
}

/* ----- Background ----- */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(0, 147, 147, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(255, 81, 0, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(31, 42, 55, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
  pointer-events: none;
}

#particleCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.18;
}

/* ----- Layout ----- */
.app-container {
  position: relative;
  z-index: 2;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ----- Header ----- */
#appHeader {
  margin-bottom: 32px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.logo {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gold);
  opacity: 0.6;
  animation: pulseRing 3s ease-in-out infinite;
}

.logo-ring::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -6px;
  right: -6px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: rotate(-20deg);
  opacity: 0.5;
}

@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 0.9; }
}

.logo-text {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
  z-index: 1;
}

.header-titles h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, #111827 0%, #3a4756 52%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.live-badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.live-badge {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 122px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 81, 0, 0.28);
  background: rgba(255, 81, 0, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.live-label {
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1.1;
}

.live-value {
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

/* ----- Buttons ----- */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.btn-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold-dim);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-pill.btn-accent {
  border-color: rgba(255, 81, 0, 0.35);
  background: rgba(255, 81, 0, 0.08);
}

.btn-pill.btn-accent:hover {
  background: rgba(255, 81, 0, 0.14);
}

.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1.5px dashed rgba(240, 185, 11, 0.25);
  background: transparent;
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 12px;
}

.btn-add:hover {
  border-color: var(--gold);
  background: rgba(240, 185, 11, 0.06);
  box-shadow: inset 0 0 20px rgba(240, 185, 11, 0.05);
}

.btn-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 80, 80, 0.1);
  color: rgba(255, 80, 80, 0.6);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-remove:hover {
  background: rgba(255, 80, 80, 0.2);
  color: #ff5050;
  transform: scale(1.1);
}

.btn-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ----- Cards ----- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-med);
}

.card:hover {
  border-color: rgba(255, 81, 0, 0.2);
  box-shadow: var(--shadow-card), 0 0 30px rgba(255, 81, 0, 0.06);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-title svg {
  color: var(--gold);
  flex-shrink: 0;
}

/* ----- Input Cards Grid ----- */
.input-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

/* ----- Form Fields ----- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
  outline: none;
}

.field input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
}

.field input:focus,
.field select:focus {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.1);
}

.field input:hover,
.field select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.field select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field select option {
  background: #ffffff;
  color: var(--text-primary);
}

.field-hint {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Remove spinner for number inputs */
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input[type="number"] {
  -moz-appearance: textfield;
}

/* Date input */
.field input[type="date"] {
  font-family: var(--font-body);
  cursor: pointer;
}
.field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* ----- Section Divider ----- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 185, 11, 0.2), transparent);
}

.section-divider span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ----- Positions ----- */
.position-item {
  border: 1px solid #e4eaf2;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  background: #fafcff;
  transition: all var(--transition-fast);
}

.position-item:hover {
  background: #f3f7fb;
  border-color: #d8e2ed;
}

.position-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.position-index {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(240, 185, 11, 0.1);
  padding: 2px 10px;
  border-radius: 20px;
}

.position-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.position-fields .field {
  margin-bottom: 0;
}

.position-fields .field-readonly {
  grid-column: 1 / -1;
}

.daily-points-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(240, 185, 11, 0.05);
  border: 1px solid rgba(240, 185, 11, 0.1);
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.daily-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--gold);
}

.daily-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.positions-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 81, 0, 0.06);
  border: 1px solid rgba(255, 81, 0, 0.2);
}

.positions-total span:first-child {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.total-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold);
}

/* ----- Info Boxes ----- */
.info-box {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 147, 147, 0.06);
  border: 1px solid rgba(0, 147, 147, 0.16);
  margin-top: 16px;
}

.info-box svg {
  color: var(--accent-green);
  flex-shrink: 0;
  margin-top: 2px;
}

.info-box p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.info-box.info-formula {
  background: rgba(255, 81, 0, 0.06);
  border-color: rgba(255, 81, 0, 0.14);
}

.info-box.info-formula svg {
  color: var(--gold);
}

/* ----- Days Remaining ----- */
.days-remaining-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 212, 170, 0.06);
  border: 1px solid rgba(0, 212, 170, 0.15);
  margin-bottom: 16px;
}

.days-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.days-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent-green);
}

/* ----- Result Cards Grid ----- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 32px;
  align-items: stretch;
}

.card-result {
  text-align: left;
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  grid-column: span 1;
}

.card-result::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity var(--transition-med);
}

.card-result:hover::before {
  opacity: 1;
}

.result-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.result-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-primary);
  word-break: break-word;
}

.result-big {
  font-size: 1.6rem;
}

.result-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.card-highlight {
  border-color: rgba(31, 42, 55, 0.22);
  background: linear-gradient(135deg, rgba(31, 42, 55, 0.06), var(--bg-card));
}

.card-highlight .result-value {
  color: var(--accent-blue);
}

.card-highlight-gold {
  border-color: rgba(255, 81, 0, 0.25);
  background: linear-gradient(135deg, rgba(255, 81, 0, 0.08), var(--bg-card));
}

.card-highlight-gold .result-value {
  color: var(--gold);
}

.card-yt {
  border-color: rgba(0, 147, 147, 0.22);
  background: linear-gradient(135deg, rgba(0, 147, 147, 0.08), var(--bg-card));
}

.card-yt .result-value {
  color: var(--accent-green);
}

.card-kpi {
  border-color: rgba(255, 81, 0, 0.22);
  background: linear-gradient(135deg, rgba(255, 81, 0, 0.06), var(--bg-card));
}

.card-kpi .result-value {
  color: var(--gold);
}

.card-ytroi {
  border-color: rgba(0, 147, 147, 0.2);
  background: linear-gradient(135deg, rgba(0, 147, 147, 0.06), var(--bg-card));
}

.card-ytroi .result-value {
  color: var(--accent-green);
}

/* ----- Modal ----- */
#multiplierModal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

#multiplierModal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-med);
}

#multiplierModal.active .modal-content {
  transform: translateY(0) scale(1);
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
}

/* ----- Multiplier Table ----- */
.multiplier-table {
  width: 100%;
  border-collapse: collapse;
}

.multiplier-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.multiplier-table td {
  padding: 10px 12px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.multiplier-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.multiplier-table td:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.multiplier-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold) !important;
  text-align: right;
}

/* ----- Footer ----- */
#appFooter {
  text-align: center;
  padding: 24px 20px;
  margin-top: 24px;
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.footer-credit {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.footer-credit a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-credit a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ----- Responsive ----- */
@media (max-width: 1100px) {
  .input-grid {
    grid-template-columns: 1fr 1fr;
  }
  .input-grid > .card:nth-child(3) {
    grid-column: 1 / -1;
  }
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 16px 12px 40px;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .live-badges {
    width: 100%;
    justify-content: flex-start;
  }

  .live-badge {
    min-width: 0;
    flex: 1 1 150px;
  }

  .header-titles h1 {
    font-size: 1.2rem;
  }

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

  .input-grid > .card:nth-child(3) {
    grid-column: auto;
  }

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

  .card-result {
    grid-column: span 1;
  }

  .position-fields {
    grid-template-columns: 1fr;
  }

  .result-value {
    font-size: 1.1rem;
  }

  .result-big {
    font-size: 1.3rem;
  }
}

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

/* ----- Animations ----- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeInUp 0.5s ease-out both;
}

.input-grid .card:nth-child(1) { animation-delay: 0.05s; }
.input-grid .card:nth-child(2) { animation-delay: 0.1s; }
.input-grid .card:nth-child(3) { animation-delay: 0.15s; }

.result-grid .card:nth-child(1) { animation-delay: 0.2s; }
.result-grid .card:nth-child(2) { animation-delay: 0.25s; }
.result-grid .card:nth-child(3) { animation-delay: 0.3s; }
.result-grid .card:nth-child(4) { animation-delay: 0.35s; }
.result-grid .card:nth-child(5) { animation-delay: 0.4s; }
.result-grid .card:nth-child(6) { animation-delay: 0.45s; }

/* Selection */
::selection {
  background: rgba(255, 81, 0, 0.22);
  color: #1d2630;
}
