/* =========================================
   RESET I BAZA
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, var(--bg-body) 60%);
  background-repeat: no-repeat;
}

/* =========================================
   UKŁAD STRONY (LAYOUT)
   ========================================= */
.page {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* =========================================
   KARTA LOGOWANIA
   ========================================= */
.card {
  width: 100%;
  max-width: 420px;
  /* Nadajemy konkretny kolor tła, aby karta nie była przezroczysta */
  background-color: var(--bg-card);
  border-radius: var(--radius-login);
  box-shadow: var(--shadow);
  padding: 40px 30px;
  position: relative;
}

/* --- Nagłówek Karty --- */
.card__header {
  text-align: center;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  flex-direction: column; /* Logo nad tytułem */
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

/* Stylizacja logo */
.logo-login {
  width: 64px; /* Powiększone logo jak na screenie */
  height: 64px;
  object-fit: contain;
  background: rgba(255,255,255,0.03);
  padding: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.brand__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
}

.card__subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
}

/* =========================================
   FORMULARZ
   ========================================= */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

/* --- Pola Input --- */
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  background-color: var(--bg-input); /* Bardzo ciemne tło inputa */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-login);
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none; /* Reset domyślnych styli przeglądarki */
}

input::placeholder {
  color: #475569; /* Ciemny szary, mało kontrastowy */
}

/* Stan aktywny inputa */
input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

/* --- Input z przyciskiem (Hasło) --- */
.input-with-action {
  position: relative; /* Zmieniamy na relative, aby przycisk był wewnątrz */
  display: flex;
}

.input-with-action input {
  padding-right: 50px; /* Miejsce na przycisk oka */
}

/* Przycisk "Oko" - teraz wewnątrz inputa wizualnie */
.btn-ghost {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
}

.btn-ghost:hover {
  color: var(--text-main);
  background-color: rgba(255,255,255,0.05);
}

.btn-ghost svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- Przycisk Logowania --- */
.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--radius-login);
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  margin-top: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  background-color: #312e81; /* Ciemniejszy fiolet dla disabled */
  color: #818cf8;
  cursor: not-allowed;
  box-shadow: none;
}

/* =========================================
   STOPKA I INFO
   ========================================= */
.legal {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 20px;
  line-height: 1.4;
  opacity: 0.7;
}

.page__footer {
  margin-top: 40px;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.5;
}

/* =========================================
   ALERT BŁĘDU
   ========================================= */
#errorBox[hidden] {
  display: none !important;
}

.alert-error {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: 14px 24px;
  border-radius: var(--radius-login);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideDownFade 0.4s ease-out forwards;
}

@keyframes slideDownFade {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.alert-error__icon {
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.alert-error__close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  margin-left: auto;
  padding: 4px;
  opacity: 0.7;
  outline: none;
}

.alert-error__close:hover {
  opacity: 1;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-lang-selector {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  /* ZMIANA: Mniejszy odstęp poziomy (z 1rem na 0.6rem) */
  gap: 0.8rem 0.6rem; 
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.lang-btn {
  background: none;
  border: 2px solid transparent;
  cursor: pointer;
  /* ZMIANA: Mniejszy padding (z 4px na 3px), aby odzyskać cenne piksele */
  padding: 4px; 
  border-radius: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  opacity: 0.5;
}

.lang-btn:hover {
  opacity: 1;
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
}

.lang-btn.active {
  opacity: 1;
  border-color: var(--primary-color);
  background: rgba(67, 56, 202, 0.15); /* Subtelne podświetlenie tła */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.flag-img {
  width: 26px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

/* Domyślnie ukrywamy kartę logowania */
.card {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

/* Klasa, którą dodamy przez JS, gdy tłumaczenia będą gotowe */
.lang-ready .card {
  opacity: 1;
}

/* --- Styl przycisku rejestracji pod formularzem --- */
.register-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.btn-secondary-outline {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-secondary-outline:hover {
    background: rgba(67, 56, 202, 0.05);
    border-color: var(--primary-color);
}

/* --- Style Modala Rejestracji --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-body-scroll {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-body-scroll .fill-reg-info {
    color: var(--text-muted); 
    margin-bottom: 20px; 
    font-size: 0.9em;
}

.form-reg-section {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px;
}

.checkbox-section {
    margin-top: 20px; 
    padding: 12px; 
    background: rgba(99, 102, 241, 0.05); 
    border-radius: 6px;
}

.checkbox-section .interested {
    display: flex; 
    align-items: center; 
    gap: 10px; 
    margin-bottom: 8px; 
    cursor: pointer; 
    font-size: 0.9em;
}

.checkbox-section .want-live {
    display: flex; 
    align-items: center; 
    gap: 10px; 
    cursor: pointer; 
    font-size: 0.9em;
}

.desired_features {
    margin: 20px 0 12px 0; 
    font-size: 0.95em; 
    color: var(--primary-color);
}

.desired-features-checkboxes {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
    font-size: 0.85em;
}

.feature-checkbox {
    display: flex; 
    align-items: flex-start; 
    gap: 8px; 
    cursor: pointer;
}

.form__group.other-notes {
    margin-top: 15px;
}

.other-notes-text-area {
    width: 100%; 
    border-radius: 4px; 
    background: var(--bg-input); 
    color: var(--text-main); 
    border: 1px solid var(--border-color); 
    padding: 8px;
}

.success-title {
    color: var(--text-main); 
    margin-bottom: 15px; 
    font-size: 1.5rem;
}

.success-msg {
    color: var(--text-muted); 
    line-height: 1.6; 
    margin-bottom: 30px;
}

.btn-primary.register-ok {
    width: 100%; 
    max-width: 200px; 
    margin: 0 auto; 
    height: 45px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}

.modal-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Grid formularza */
.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 500px) {
    .modal-form-grid { grid-template-columns: 1fr; }
}

/* Style pól input w modalu */
.modal-body-scroll .form__group {
    margin-bottom: 15px;
}

.modal-body-scroll label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-body-scroll input[type="text"],
.modal-body-scroll input[type="email"],
.modal-body-scroll select,
.modal-body-scroll textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    color: var(--text-main);
    font-family: inherit;
}

/* Checkboxy */
.checkbox-group {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.check-label input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Scrollbar dla modala */
.modal-body-scroll::-webkit-scrollbar {
    width: 6px;
}
.modal-body-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* --- Poprawiona stopka modala - Idealne wyrównanie --- */
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end; /* Przesunięcie do prawej */
    align-items: center;      /* Środkowanie w pionie */
    gap: 20px;                 /* Odstęp między przyciskami */
    background: transparent;
}

.modal-btn-cancel {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0;                /* Usuwamy padding, który mógł przesuwać tekst */
    margin: 0;                 /* Usuwamy wszelkie marginesy */
    transition: color 0.2s ease;
    line-height: 1;            /* Reset wysokości linii */
    display: flex;             /* Flex wewnątrz, by łatwiej kontrolować pozycję tekstu */
    align-items: center;
    position: relative !important;
    top: 0 !important;
}

.modal-btn-cancel:hover {
    color: var(--text-main);
}

/* Styl dla przycisku głównego wewnątrz stopki */
.modal-footer .btn-primary {
    margin: 0 !important;      /* Usuwamy marginesy, które często są dodawane do przycisków */
    height: 42px;              /* Stała wysokość dla pewności */
    padding: 0 25px;           /* Padding boczny */
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 150px;
}

/* --- Stylizacja i Animacja Modala Sukcesu --- */
.success-modal-box {
    max-width: 450px;
    text-align: center;
    padding: 40px 30px;
    background: var(--bg-card);
}

.success-animation {
    margin: 0 auto 20px;
    width: 80px;
    height: 80px;
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #10b981; /* Zielony kolor z Twojego systemu */
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #fff;
    stroke-miterlimit: 10;
    margin: 10% auto;
    box-shadow: inset 0px 0px 0px #10b981;
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

.register-section .register-info {
    color: var(--text-muted); 
    font-size: 0.85rem; 
    margin-bottom: 12px;
}



@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}
@keyframes scale {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}
@keyframes fill {
    100% { box-shadow: inset 0px 0px 0px 40px #10b981; }
}