/* ====== MOBILE-FIRST (domyślnie <1024px) ====== */

:root{
  --bg:#0b1e3f;
  --text: #f5f6f7;
  --brand-blue: #6fb7ff;
  --gold: #f4b400;
  --input-bg:#143268;
  --border-color:#3a4c6e;
  --muted:#b9c3d9;
  --header-height:80px;
  --footer-height:120px;
}

/* Reset / baza */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
  display:flex;
  flex-direction:column;
}

/* Widoczny focus (a11y) */
:focus-visible{
  outline:2px solid var(--gold);
  outline-offset:2px;
}
header .menu-toggle:focus-visible,
.header-logo:focus-visible{ outline-offset:4px }

/* ====== HEADER 80 px (w tym border 1 px) ====== */
header{
  position:fixed;
  top:0; left:0; width:100%;
  height:var(--header-height);
  background:var(--input-bg);
  border-bottom:1px solid var(--border-color);
  z-index:1000;
  padding:0;
}

/* Elementy przyklejone do krawędzi headera */
.header-logo,
.menu-toggle{
  position:absolute; top:0;
  height:var(--header-height);
  display:flex; align-items:center;
  background:none; border:0; padding:0;
}
.header-logo{ left:0 }
.menu-toggle{ right:0; cursor:pointer }

/* Obrazy w headerze – dokładnie 80 px */
.header-logo img,
.menu-toggle img{
  height:var(--header-height);
  width:auto;
  display:block;
}

/* ====== TREŚĆ POD HEADEREM ====== */
.main-content{
  padding-top: calc(var(--header-height) + 20px);
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  padding-bottom: 1rem;
}

/* Kontener sekcji */
.container{
  width:90%;
  max-width:500px;
  margin:0.5rem auto;
  text-align:center;
}

/* ====== TYPO – nagłówki i podtytuły rejestracji ====== */
.auth-title{
  color:var(--brand-blue);
  font-size:clamp(2.1rem, 8vw, 2.6rem);
  font-weight:800;
  margin:0 0 .6rem 0;
  letter-spacing:4px;
}

.auth-subtitle{
  margin:.1rem 0 0 0;
  font-size:clamp(1.5rem, 4.5vw, 1.8rem);
  line-height:1.2;
  color:var(--text);
}
.auth-subtitle .light-prefix{ font-weight:400; opacity:.95 }
.auth-subtitle strong{ font-weight:800; color:var(--text) }

.auth-free{
  margin:.25rem 0 0 0;
  font-size:clamp(1.9rem, 6vw, 2.7rem);
  color:var(--gold);
  font-weight:800;
}

/* ====== FORM / INPUTS ====== */
.auth-form{ margin-top:2.1rem; text-align:left }

.form-group{ margin-bottom:1.25rem }

.highlight{
  font-weight: bold;
}

.highlight-secondary{
  font-weight: bold;
  color: var(--gold);
}

label{
  display:block;
  margin-bottom:.5rem;
  font-weight:600;
  opacity:.9;
  font-size:1.05rem;
  color:#dbe4ff;
}

input[type="email"],
input[type="password"],
input[type="text"]{
  width:100%;
  padding:.9rem 1rem;
  background:var(--input-bg);
  border:1px solid var(--border-color);
  border-radius:6px;
  color:var(--text);
  font-size:1.05rem;
}

/* Autofill – spójne kolory */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ====== PRZYCISKI GLOBALNE ====== */
button{
  width:100%;
  padding:1.05rem 1rem;
  background:var(--gold);
  color:var(--bg);
  border:0; border-radius:8px;
  font-size:1.15rem;
  font-weight:800;
  cursor:pointer;
  transition:opacity .2s, transform .03s ease;
  margin-top:.9rem;
}
button:hover{ opacity:.92 }
button:active{ transform:translateY(1px) }

/* Reset TYLKO dla przycisku w headerze */
header .menu-toggle{
  width:auto; min-width:0; margin:0; flex:0 0 auto;
  padding:0;
  background:none; border:0;
}

/* "Masz już konto…?" */
.auth-meta{
  margin:1rem 0 0 0;
  font-size:1.05rem;
  color:#d3dbef;
  margin-bottom: 1.4rem;
}
.auth-meta a{ color:var(--gold); text-decoration:none; font-weight:700 }
.auth-meta a:hover{ text-decoration:underline }

/* ====== MENU MOBILNE ====== */
.mobile-menu{
  position:fixed;
  top:var(--header-height); left:0;
  width:100%;
  background:var(--input-bg);
  border-bottom:1px solid var(--border-color);
  z-index:999;
  visibility:hidden;
  transform:translateY(-100%);
  transition:transform .3s ease, visibility .3s ease;
  will-change:transform;
  pointer-events:none;
}
.mobile-menu.is-open{
  visibility:visible;
  transform:translateY(0);
  pointer-events:auto;
}
.mobile-menu ul{ list-style:none; margin:0; padding:0 }
.mobile-menu ul li a{
  display:block;
  padding:1.2rem 1.5rem;
  color:var(--text);
  font-size:1.1rem;
  border-top:1px solid var(--border-color);
  text-decoration:none;
}
.mobile-menu ul li:first-child a{ border-top:none }
.mobile-menu ul li a:hover{ background:rgba(255,255,255,.04) }

@media (prefers-reduced-motion:reduce){
  .mobile-menu{ transition:none; will-change:auto }
}

body.menu-open { overflow: hidden; }

.backdrop{
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4);
  display: none;
  z-index: 900;
}
body.menu-open .backdrop{ display: block; }

/* ====== STOPKA ====== */
footer{
  height:var(--footer-height);
  background:var(--input-bg);
  border-top:1px solid var(--border-color);
  color:#cfd7ea;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.95rem;
  margin-top:auto;
  padding:0;
}

/* ====== LINKI OGÓLNE ====== */
a{ color:var(--gold); text-decoration:none; font-weight:600 }
a:hover{ text-decoration:underline }

/* ====== PASSWORD TOGGLE ====== */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  padding-right: 3rem;
}

.toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.2s ease, opacity 0.2s ease;
  width: auto;
  min-width: 0;
  margin: 0;
  flex: 0 0 auto;
}

.toggle-password:hover {
  color: var(--text);
  opacity: 1;
  transform: translateY(-50%);
}

.toggle-password:active {
  transform: translateY(-50%);
}

.toggle-password svg {
  width: 24px;
  height: 24px;
  display: block;
}

.toggle-password:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ====== BŁĘDY WALIDACJI ====== */
.input-error {
  border-color: #ff6b6b !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.input-error:focus {
  border-color: #ff6b6b !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}

/* ========================================
   MENU DESKTOP - BAZOWE (ukryj na mobile)
   ======================================== */

.desktop-menu {
  display: none;
}

/* Saldo tokenów w headerze - ukryj domyślnie (mobile) */
.header-token-balance {
  display: none;
}

/* ========================================
   PANEL UŻYTKOWNIKA - BAZOWE (mobile-first)
   ======================================== */

.dashboard-tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dashboard-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--bg);
  border: 2px solid;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
  text-align: center;
  min-height: 180px;
}

.tile-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.tile-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: block;
}

.tile-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  display: block;
}

.tile-primary {
  border-color: var(--gold);
}

.tile-primary .tile-title {
  color: var(--gold);
}

.tile-primary:hover {
  background: rgba(244, 180, 0, 0.1);
  box-shadow: 0 8px 16px rgba(244, 180, 0, 0.2);
}

.tile-primary:hover .tile-icon {
  transform: none;
}

.tile-primary:hover .tile-title,
.tile-primary:hover .tile-subtitle {
  transform: translateY(-4px);
}

.tile-secondary {
  border-color: var(--brand-blue);
}

.tile-secondary .tile-title {
  color: var(--brand-blue);
}

.tile-secondary:hover {
  background: rgba(111, 183, 255, 0.1);
  box-shadow: 0 8px 16px rgba(111, 183, 255, 0.2);
}

.tile-secondary:hover .tile-icon {
  transform: none;
}

.tile-secondary:hover .tile-title,
.tile-secondary:hover .tile-subtitle {
  transform: translateY(-4px);
}

.tile-tertiary {
  border-color: var(--border-color);
}

.tile-tertiary .tile-title {
  color: var(--text);
}

.tile-tertiary:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 16px rgba(58, 76, 110, 0.3);
}

.tile-tertiary:hover .tile-icon {
  transform: none;
}

.tile-tertiary:hover .tile-title {
  color: var(--gold);
  transform: translateY(-4px);
}

.tile-tertiary:hover .tile-subtitle {
  transform: translateY(-4px);
}

.tile-tokens {
  background: linear-gradient(135deg, #1a3a5c 0%, #143268 100%);
  border-color: var(--brand-blue);
  cursor: default;
}

.tile-tokens .tile-title {
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.token-balance {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 1rem;
  line-height: 1;
}

.tile-button {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background: var(--gold);
  color: var(--bg);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  margin-top: auto;
}

.tile-button:hover {
  background: #ffbd00;
  transform: translateY(-2px);
}

.tokens-info {
  background: rgba(111, 183, 255, 0.1);
  border: 1px solid var(--brand-blue);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: left;
}

.tokens-info h3 {
  margin: 0 0 1.25rem 0;
  font-size: 1.3rem;
  color: var(--brand-blue);
}

.tokens-info ul {
  margin: 0;
  padding-left: 1.75rem;
  color: var(--muted);
  line-height: 1.9;
  list-style-type: disc;
}

.tokens-info li {
  margin-bottom: 0.5rem;
}

.tokens-info li strong {
  color: var(--text);
  font-weight: 700;
}

.tokens-info a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}

.tokens-info a:hover {
  text-decoration: underline;
}

/* Kafelki - bez podkreśleń */
.dashboard-tile,
.dashboard-tile *,
.dashboard-tile:hover,
.dashboard-tile:hover * {
  text-decoration: none !important;
}

.reg-separator {
  border: none;
  height: 1px;
  background-color: var(--brand-blue);
  margin: 0 0 1.5rem 0;
  max-width: 1500px;
}

/* ========================================
   TABLET (768px - 1023px)
   ======================================== */

@media (min-width: 768px) and (max-width: 1023px) {
  /* Panel - 2 kolumny */
  .dashboard-tiles {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .dashboard-tile {
    padding: 2rem 1.5rem;
    min-height: 200px;
  }
  
  .tile-icon {
    font-size: 3.5rem;
  }
  
  .tile-title {
    font-size: 1.2rem;
  }
  
  .token-balance {
    font-size: 3rem;
  }
  
  .tokens-info {
    padding: 2rem;
  }
}

/* ========================================
   DESKTOP (1024px - 1279px)
   ======================================== */

@media (min-width: 1024px) and (max-width: 1279px) {
  /* MENU DESKTOP */
  .menu-toggle {
    display: none !important;
  }
  
  .mobile-menu {
    display: none !important;
  }
  
  .backdrop {
    display: none !important;
  }
  
  /* Header - bez paddingu (logo przy brzegu) */
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    gap: 0;
  }
  
  .header-logo {
    position: static;
    margin: 0;
    flex-shrink: 0;
  }
  
  /* Saldo tokenów w headerze - pokaż (po prawej) */
  .header-token-balance {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 1rem;
    white-space: nowrap;
    font-size: 1.3rem;
    order: 10;
  }
  
  .header-token-balance .icon {
    font-size: 2.1rem;
	margin-bottom: 10px;
  }
  
  .header-token-balance .balance {
    color: var(--brand-blue);
    font-weight: 800;
  }
  
  nav.desktop-menu {
    display: block;
    margin-left: auto;
    order: 5;
  }
  
  nav.desktop-menu > ul {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  
  nav.desktop-menu li {
    margin: 0;
  }
  
  nav.desktop-menu a {
    display: block;
    padding: 0.75rem 1.15rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  
  nav.desktop-menu a:hover {
    color: var(--gold);
    border-bottom-color: var(--gold);
  }
  
  nav.desktop-menu a.logout-link {
    color: #ff6b6b;
  }
  
  nav.desktop-menu a.logout-link:hover {
    color: #ff4444;
    border-bottom-color: #ff4444;
  }
  
  nav.desktop-menu a.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
  }
  
  /* Panel - 2 kolumny */
  .dashboard-tiles {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
  }
  
  .dashboard-tile {
    padding: 2rem 1.5rem;
    min-height: 200px;
  }
  
  .tile-icon {
    font-size: 3.5rem;
  }
  
  .tile-title {
    font-size: 1.2rem;
  }
  
  .token-balance {
    font-size: 3rem;
  }
  
  .tokens-info {
    padding: 2rem;
  }
}

/* ========================================
   LARGE DESKTOP (≥1280px)
   ======================================== */

@media (min-width: 1280px) {
  /* MENU DESKTOP */
  .menu-toggle {
    display: none !important;
  }
  
  .mobile-menu {
    display: none !important;
  }
  
  .backdrop {
    display: none !important;
  }
  
  /* Header - bez paddingu (logo przy brzegu) */
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    gap: 0;
  }
  
  .header-logo {
    position: static;
    margin: 0;
    flex-shrink: 0;
  }
  
  /* Saldo tokenów w headerze - pokaż (po prawej) */
  .header-token-balance {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 1rem;
    white-space: nowrap;
    font-size: 1.3rem;
    order: 10;
  }
  
  .header-token-balance .icon {
    font-size: 2.1rem;
	margin-bottom: 10px;
  }
  
  .header-token-balance .balance {
    color: var(--brand-blue);
    font-weight: 800;
  }
  
  nav.desktop-menu {
    display: block;
    margin-left: auto;
    order: 5;
  }
  
  nav.desktop-menu > ul {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  
  nav.desktop-menu li {
    margin: 0;
  }
  
  nav.desktop-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  
  nav.desktop-menu a:hover {
    color: var(--gold);
    border-bottom-color: var(--gold);
  }
  
  nav.desktop-menu a.logout-link {
    color: #ff6b6b;
  }
  
  nav.desktop-menu a.logout-link:hover {
    color: #ff4444;
    border-bottom-color: #ff4444;
  }
  
  nav.desktop-menu a.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
  }
  
  /* Panel - 4 kolumny */
  .dashboard-tiles {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
  }
  
  .dashboard-tile {
    padding: 2rem 1.5rem;
    min-height: 200px;
  }
  
  .tile-icon {
    font-size: 3.5rem;
  }
  
  .tile-title {
    font-size: 1.2rem;
  }
  
  .token-balance {
    font-size: 3rem;
  }
  
  .tokens-info {
    padding: 2rem;
  }
}

/* ========================================
   EXTRA LARGE DESKTOP (≥1440px)
   ======================================== */

@media (min-width: 1440px) {
  /* Dodaj padding tylko na bardzo dużych ekranach */
  header {
    padding: 0 2rem;
  }
  
  nav.desktop-menu a {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

/* ========================================
   LOADING SPINNER + DISABLED BUTTON
   ======================================== */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(11, 30, 63, 0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

@keyframes spinner-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

button.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

button.loading:hover {
  opacity: 0.7;
  transform: none;
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

button:disabled:hover {
  opacity: 0.7;
  transform: none;
}

/* ========================================
   STRONA GENERUJ - HEADER
   ======================================== */

.page-header-wrapper {
  margin-bottom: 2rem;
  text-align: center;
}

.page-header-titles h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2.2rem;
  color: var(--brand-blue);
}

.page-header-titles p {
  margin: 0;
  font-size: 1.3rem;
  color: var(--muted);
}

/* Licznik znaków w textarea */
.char-counter {
  display: block;
  font-size: 0.85rem;
  color: #8896b0;
  text-align: right;
  margin-top: 0.25rem;
}

/* Checkboxy zgód prawnych */
.checkbox-group {
  margin: 1.5rem 0;
  text-align: left;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--gold);
}

.checkbox-label input[type="checkbox"].input-error {
  outline: 2px solid #ff6b6b;
}

.checkbox-text {
  flex: 1;
}

.checkbox-group .error-message {
  color: #ff6b6b;
  font-size: 0.9rem;
  display: block;
  margin-top: 0.5rem;
  margin-left: 2rem;
}

/* Focus state dla accessibility */
.checkbox-label input[type="checkbox"]:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
