/* ═══════════════════════════════════════════════════════════
   FilePortal – Główny arkusz stylów
   Motyw: Dark glassmorphism + neonowe akcenty
   ═══════════════════════════════════════════════════════════ */

/* ── Zmienne ── */
:root {
  --bg:           #080c14;
  --bg-card:      rgba(12, 18, 32, 0.72);
  --border:       rgba(100, 140, 255, 0.18);
  --border-focus: rgba(100, 180, 255, 0.6);
  --accent:       #4fa3ff;
  --accent-2:     #7c5cff;
  --accent-3:     #00e5c0;
  --text-primary: #e8edf8;
  --text-secondary: #8898bb;
  --text-muted:   #4a5870;
  --success:      #00e5c0;
  --error:        #ff4a6e;
  --warning:      #ffb347;
  --dot-active:   #4fa3ff;
  --dot-inactive: rgba(100, 140, 255, 0.18);
  --radius:       18px;
  --radius-sm:    10px;
  --blur:         20px;
  --transition:   0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* ── Animowane tło ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: float 18s ease-in-out infinite alternate;
}
.orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #3a6cff 0%, transparent 70%);
  top: -120px; left: -140px;
  animation-duration: 20s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #7c5cff 0%, transparent 70%);
  bottom: -100px; right: -100px;
  animation-duration: 25s;
  animation-delay: -6s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #00e5c0 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 30s;
  animation-delay: -12s;
}
@keyframes float {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(30px, -20px) scale(1.05); }
  100% { transform: translate(-20px, 30px) scale(0.95); }
}
.orb-3 {
  animation-name: float3;
}
@keyframes float3 {
  0%   { transform: translate(-50%, -50%) scale(1); }
  50%  { transform: translate(calc(-50% + 20px), calc(-50% + 15px)) scale(1.08); }
  100% { transform: translate(calc(-50% - 15px), calc(-50% - 20px)) scale(0.92); }
}

/* ── Layout ── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* ── Karta główna ── */
.card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255,255,255,0.04) inset;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

/* ── Nagłówek karty ── */
.card-header {
  padding: 40px 36px 28px;
  text-align: center;
  background: linear-gradient(180deg, rgba(79, 163, 255, 0.06) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}
.org-header {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 24px;
  margin: 0 auto 24px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: max-content;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
  margin-bottom: 16px;
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(79,163,255,0.15);
}
.org-logo {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
.org-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  max-width: 100%;
  text-align: center;
}
.card-title {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #e8edf8 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ── Treść karty ── */
.card-body {
  padding: 32px 36px 36px;
}
.card-body.hidden {
  display: none;
}

/* ── Formularz ── */
.honeypot-wrap {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
  tab-index: -1;
}
.input-group { margin-bottom: 24px; }
.input-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.input-wrap {
  position: relative;
}
.code-input {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  caret-color: var(--accent);
}
.code-input::placeholder {
  color: var(--text-muted);
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  text-transform: none;
}
.code-input:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(100,140,255,0.35);
}
.code-input:focus {
  background: rgba(79,163,255,0.06);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79,163,255,0.12), 0 0 16px rgba(79,163,255,0.08);
}
.code-input.input-error {
  border-color: var(--error) !important;
  background: rgba(255, 74, 110, 0.06) !important;
  box-shadow: 0 0 0 3px rgba(255,74,110,0.12) !important;
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ── Licznik prób ── */
.attempts-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.attempts-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.attempt-dots {
  display: flex;
  gap: 6px;
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--dot-inactive);
  border: 1px solid rgba(100,140,255,0.2);
  transition: background var(--transition), box-shadow var(--transition), transform 0.3s ease;
}
.dot.active {
  background: var(--dot-active);
  box-shadow: 0 0 8px rgba(79,163,255,0.7);
}
.dot.warn {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(255,179,71,0.7);
}
.dot.danger {
  background: var(--error);
  box-shadow: 0 0 8px rgba(255,74,110,0.7);
}

/* ── Komunikat błędu ── */
.field-error {
  min-height: 20px;
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity var(--transition);
}

/* ── Przycisk ── */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px rgba(79,163,255,0.35);
  text-decoration: none;
}
.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn-submit:hover::before { opacity: 1; }
.btn-submit:hover {
  box-shadow: 0 6px 28px rgba(79,163,255,0.5);
  transform: translateY(-1px);
}
.btn-submit:active {
  transform: translateY(1px);
  box-shadow: 0 2px 12px rgba(79,163,255,0.3);
}
.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-submit.loading .btn-text { opacity: 0; }
.btn-submit.loading .btn-spinner { opacity: 1; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(79,163,255,0.15);
  margin-top: 16px;
}
.btn-outline:hover {
  background: rgba(79,163,255,0.1);
  box-shadow: 0 4px 20px rgba(79,163,255,0.3);
}

/* ── Spinner ── */
.btn-spinner {
  position: absolute;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  opacity: 0;
  transition: opacity var(--transition);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Sekcja sukces ── */
#section-success { text-align: center; }
.success-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,229,192,0.15) 0%, rgba(79,163,255,0.15) 100%);
  border: 1px solid rgba(0,229,192,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 30px rgba(0,229,192,0.25);
  animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.success-icon svg {
  width: 32px; height: 32px;
  color: var(--success);
  stroke-dasharray: 50;
  stroke-dashoffset: 50;
  animation: draw-check 0.4s 0.2s ease forwards;
}
@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}
.success-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 10px;
}
.success-msg {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
}
.success-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ── Sekcja blokada ── */
#section-locked { text-align: center; }
.lock-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,74,110,0.1);
  border: 1px solid rgba(255,74,110,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 24px rgba(255,74,110,0.15);
  animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.lock-icon svg { width: 30px; height: 30px; color: var(--error); }
.lock-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--error);
  margin-bottom: 10px;
}
.lock-msg {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}
.countdown-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(255,74,110,0.08);
  border: 1px solid rgba(255,74,110,0.2);
  border-radius: 30px;
}
.countdown-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.countdown {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--error);
  letter-spacing: 0.05em;
  min-width: 50px;
  text-align: center;
}

/* ── Sekcja niedostępność ── */
#section-unavailable { text-align: center; }
.warn-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,179,71,0.1);
  border: 1px solid rgba(255,179,71,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.warn-icon svg { width: 30px; height: 30px; color: var(--warning); }
.warn-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 10px;
}
.warn-msg {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Stopka ── */
.portal-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.03em;
}

/* ── Responsywność ── */
@media (max-width: 480px) {
  .card-header { padding: 28px 24px 20px; }
  .card-body   { padding: 24px 24px 28px; }
  .card-title  { font-size: 1.3rem; }
}

/* ── Tryb jasny (Light Theme) ── */
[data-theme="light"] {
  --bg:           #f0f4f8;
  --bg-card:      rgba(255, 255, 255, 0.85);
  --border:       rgba(0, 0, 0, 0.1);
  --border-focus: rgba(79, 163, 255, 0.6);
  --accent:       #0056b3;
  --accent-2:     #4c33c4;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted:   #718096;
  --dot-active:   #0056b3;
  --dot-inactive: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .orb { opacity: 0.3; }
[data-theme="light"] .card-title {
  background: linear-gradient(135deg, #1a202c 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="light"] .org-header {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .logo-wrap {
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 0 16px rgba(0,86,179,0.1);
}
[data-theme="light"] .code-input {
  background: rgba(0,0,0,0.02);
}
[data-theme="light"] .code-input:hover {
  background: rgba(0,0,0,0.04);
}
[data-theme="light"] .code-input:focus {
  background: rgba(0,86,179,0.04);
  box-shadow: 0 0 0 3px rgba(0,86,179,0.1), 0 0 16px rgba(0,86,179,0.08);
}
[data-theme="light"] .card {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255,255,255,0.8) inset;
}
[data-theme="light"] .btn-submit::before {
  background: rgba(0,0,0,0.08);
}
[data-theme="light"] .card-header {
  background: linear-gradient(180deg, rgba(0, 86, 179, 0.04) 0%, transparent 100%);
}

/* ── Przełącznik motywu ── */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
  z-index: 100;
  backdrop-filter: blur(5px);
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
  border-color: var(--accent);
}
.theme-toggle:active {
  transform: scale(0.95);
}
.theme-toggle .moon-icon {
  display: none;
}
[data-theme="light"] .theme-toggle .sun-icon {
  display: none;
}
[data-theme="light"] .theme-toggle .moon-icon {
  display: block;
}
[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
}
