@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

/* ==========================================================================
   TOKENY I RESET — DESIGN v3 „Azure"
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --brand-dark:   #0A4E93;
    --brand-mid:    #0B5AA8;
    --accent-a:     #0E6BC4;
    --accent-b:     #0B5AA8;
    --accent-soft:  #7A5AF8;
    --accent-grad:  linear-gradient(135deg, #0E6BC4 0%, #0B5AA8 100%);
    --white:        #ffffff;
    --bg:           #F5F7FA;
    --surface:      #ffffff;
    --border:       #E3E8EF;
    --text-primary: #101828;
    --text-muted:   #667085;
    --text-light:   rgba(255, 255, 255, 0.72);
    --input-bg:     #F5F7FA;
    --r-sm:  10px;
    --r-md:  12px;
    --r-lg:  16px;
    --r-xl:  22px;
    --f-display: 'Plus Jakarta Sans', sans-serif;
    --f-body:    'Inter', sans-serif;
    --f-mono:    'JetBrains Mono', monospace;
    --shadow-card: 0 1px 2px rgba(16, 24, 40, .05), 0 12px 36px rgba(16, 24, 40, .08);
    --shadow-btn:  0 8px 24px rgba(14, 107, 196, 0.32);
    --t: 0.2s ease;
}

html { font-size: 16px; }

body {
    font-family: var(--f-body);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   WRAPPER SPLIT-SCREEN
   ========================================================================== */
.auth-wrapper {
    display: grid;
    grid-template-columns: 420px 1fr;
    min-height: 100dvh;
}

/* ==========================================================================
   LEWY PANEL — BRANDING
   ========================================================================== */
.auth-brand {
    position: relative;
    background: var(--brand-dark);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 40px 36px;
}

/* Subtelna poświata gradientu */
.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 20% 15%, rgba(14, 107, 196, 0.30) 0%, transparent 60%),
        radial-gradient(ellipse 60% 45% at 80% 80%, rgba(14, 107, 196, 0.12) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* --- Animowane klocki w tle --- */
.bg-animation {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.cube {
    position: absolute;
    background-image: url('zdj.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgba(14, 107, 196, 0.07);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.94) rotate(0deg);
    transition: opacity 0.7s ease-out, transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --base-rotate: 0deg;
}

.cube.visible {
    opacity: 0.28;
    transform: scale(1) rotate(var(--base-rotate));
    animation: levitation ease-in-out infinite alternate;
}

@keyframes levitation {
    0%   { transform: translateY(-7px) rotate(calc(var(--base-rotate) - 0.7deg)); }
    100% { transform: translateY(7px)  rotate(calc(var(--base-rotate) + 0.7deg)); }
}

/* --- Treść brandowa --- */
.brand-content {
    position: relative;
    z-index: 10;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 56px;
}

.brand-logo-icon {
    width: 42px;
    height: 42px;
    background: var(--accent-grad);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(14, 107, 196, 0.45);
}

.brand-logo-icon svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.brand-logo-name {
    font-family: var(--f-display);
    font-size: 22px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.4px;
}

.brand-headline {
    font-family: var(--f-display);
    font-size: 32px;
    font-weight: 600;
    color: white;
    line-height: 1.22;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}

.brand-headline span {
    color: var(--accent-soft);
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    background-clip: initial;
}

.brand-tagline {
    font-size: 14.5px;
    color: var(--text-light);
    line-height: 1.65;
    margin-bottom: 44px;
}

.brand-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand-features li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: rgba(255, 255, 255, 0.80);
    font-size: 13.5px;
    line-height: 1.55;
}

.feature-icon {
    width: 34px;
    height: 34px;
    background: rgba(14, 107, 196, 0.18);
    border: 1px solid rgba(14, 107, 196, 0.28);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.feature-icon svg {
    width: 16px;
    height: 16px;
    stroke: #9FB0EE;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feature-text strong {
    display: block;
    color: white;
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 13.5px;
}

/* --- Stopka brandowa --- */
.brand-footer {
    position: relative;
    z-index: 10;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.30);
    line-height: 1.5;
}

/* ==========================================================================
   PRAWY PANEL — FORMULARZ
   ========================================================================== */
.auth-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 40px;
    background: var(--bg);
    overflow-y: auto;
}

.form-container {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 44px 40px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

/* ==========================================================================
   ZAKŁADKI (Logowanie / Rejestracja)
   ========================================================================== */
.form-tabs {
    display: flex;
    background: var(--input-bg); border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 5px;
    margin-bottom: 32px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 11px 14px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 10px;
    transition: background var(--t), color var(--t), box-shadow var(--t);
    line-height: 1;
}

.tab-btn.active {
    background: var(--white);
    color: var(--brand-mid);
    box-shadow: 0 2px 8px rgba(13, 9, 32, 0.12);
}

/* ==========================================================================
   NAGŁÓWEK FORMULARZA
   ========================================================================== */
.form-container h2 {
    font-size: 22px !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    text-align: left !important;
    letter-spacing: -0.3px;
    line-height: 1.25 !important;
    margin-bottom: 6px !important;
    margin-top: 0 !important;
}

.form-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 26px;
}

/* ==========================================================================
   POLA FORMULARZA
   ========================================================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 7px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 13px;
    width: 17px;
    height: 17px;
    stroke: #b0b4cc;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
    transition: stroke var(--t);
    flex-shrink: 0;
    z-index: 1;
}

.input-wrap:focus-within .input-icon {
    stroke: var(--accent-a);
}

.input-wrap input,
.form-container input[type="email"],
.form-container input[type="password"],
.form-container input[type="text"] {
    width: 100%;
    height: 46px;
    padding: 0 42px 0 40px;
    border: 1.5px solid var(--border);
    background: var(--input-bg);
    border-radius: var(--r-md);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 400;
    color: var(--text-primary);
    display: block;
    transition: border-color var(--t), background var(--t), box-shadow var(--t);
    outline: none;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 0;
}

.form-container input:not(.input-wrap input) {
    padding: 0 16px;
}

.form-container input::placeholder {
    color: #b8bcd0;
    font-weight: 400;
}

.form-container input:focus {
    border-color: var(--accent-a);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(14, 107, 196, 0.12);
}

/* Przycisk podglądu hasła */
.toggle-pass {
    position: absolute;
    right: 12px;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    transition: background var(--t);
    flex-shrink: 0;
}

.toggle-pass:hover { background: rgba(14, 107, 196, 0.08); }

.toggle-pass svg {
    width: 17px;
    height: 17px;
    stroke: #b0b4cc;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke var(--t);
    pointer-events: none;
}

.toggle-pass:hover svg { stroke: var(--brand-mid); }

/* Pole opcjonalne — bez ikon */
.form-container .input-no-icon {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* ==========================================================================
   OPCJE POD POLEM (link "Zapomniałeś hasła?")
   ========================================================================== */
.form-options {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 22px;
    margin-top: -6px;
}

.form-options a {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-a);
    text-decoration: none;
    transition: color var(--t);
}

.form-options a:hover { color: var(--accent-b); }

/* ==========================================================================
   PRZYCISK SUBMIT
   ========================================================================== */
.submit-btn {
    width: 100%;
    height: 48px;
    border: none;
    background: var(--accent-grad);
    color: white !important;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    border-radius: var(--r-md);
    cursor: pointer;
    letter-spacing: 0.15px;
    box-shadow: var(--shadow-btn);
    transition: opacity var(--t), box-shadow var(--t), transform 0.1s;
    display: block;
    margin-bottom: 0;
}

.submit-btn:hover {
    opacity: 0.90;
    box-shadow: 0 12px 32px rgba(14, 107, 196, 0.46);
}

.submit-btn:active { transform: scale(0.985); }

/* ==========================================================================
   ALERTY
   ========================================================================== */
.alert-error {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
    border-radius: var(--r-sm);
    padding: 12px 15px;
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 18px;
}

.alert-error ul, .alert-error div { margin: 0; }

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-radius: var(--r-sm);
    padding: 12px 15px;
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 18px;
}

/* ==========================================================================
   ODZNAKA ROLI (rejestracja)
   ========================================================================== */
.role-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f2f2fb;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.role-badge svg {
    width: 16px;
    height: 16px;
    stroke: var(--accent-a);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.role-badge strong { color: var(--brand-mid); font-weight: 700; }

/* Link pod formularzem */
.form-back-link {
    text-align: center;
    margin-top: 20px;
}

.form-back-link a {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--t);
}

.form-back-link a:hover { color: var(--brand-mid); }

/* Separator */
.form-sep {
    height: 1px;
    background: var(--border);
    margin: 22px 0;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 960px) {
    .auth-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .auth-brand {
        padding: 28px 28px 24px;
        min-height: auto;
    }

    .brand-logo { margin-bottom: 16px; }

    .brand-headline {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .brand-tagline { display: none; }
    .brand-features { display: none; }
    .brand-footer { display: none; }

    .auth-form-panel {
        padding: 32px 20px 48px;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .form-container {
        padding: 28px 22px;
        border-radius: var(--r-lg);
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Dla bardzo niskich ekranów — rejestracja */
@media (max-height: 700px) {
    .auth-form-panel { padding-top: 20px; padding-bottom: 20px; }
    .form-container { padding: 28px 32px; }
    .form-group { margin-bottom: 12px; }
    .form-container h2 { margin-bottom: 4px !important; }
    .form-subtitle { margin-bottom: 18px; }
}

/* ==========================================================================
   TAŚMA ODPOWIEDZI (OMR) — element sygnaturowy panelu brandowego
   ========================================================================== */
.omr-strip {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    margin-top: 28px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
}

.omr-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.omr-num {
    font-family: var(--f-mono);
    font-size: 10.5px;
    color: #525C6E;
    width: 22px;
    letter-spacing: .08em;
}

.omr-bub {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #3A4150;
    display: grid;
    place-items: center;
    font-family: var(--f-mono);
    font-size: 9.5px;
    color: #596273;
    transition: transform .2s ease;
}

.omr-bub:nth-child(4n + 3) { margin-left: 14px; }

.omr-bub.on {
    background: var(--accent-a);
    border-color: var(--accent-a);
    color: #fff;
}

.omr-strip { animation: omr-glow 6s ease-in-out infinite alternate; }

@keyframes omr-glow {
    from { box-shadow: 0 0 0 rgba(14, 107, 196, 0); }
    to   { box-shadow: 0 0 34px rgba(14, 107, 196, .22); }
}

@media (prefers-reduced-motion: reduce) {
    .omr-strip { animation: none; }
    .cube.visible { animation: none; }
}

/* Formularz: nagłówki i przycisk w duchu v2 */
.form-container h2 {
    font-family: var(--f-display) !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em !important;
}

.submit-btn {
    font-family: var(--f-body);
    font-weight: 600;
    letter-spacing: .01em;
    background: var(--accent-a);
}

.submit-btn:hover {
    background: var(--accent-b);
    opacity: 1;
}

.tab-btn.active {
    color: var(--accent-a);
}

/* ==========================================================================
   v3 „AZURE" — gradient hero zamiast grafitu
   ========================================================================== */
.auth-brand {
    background: linear-gradient(160deg, #0E6BC4 0%, #0A4E93 55%, #7A5AF8 145%);
}

.auth-brand::before {
    background:
        radial-gradient(ellipse 70% 50% at 20% 15%, rgba(255, 255, 255, 0.14) 0%, transparent 60%),
        radial-gradient(ellipse 60% 45% at 80% 80%, rgba(122, 90, 248, 0.35) 0%, transparent 60%);
}

.brand-headline span {
    background: linear-gradient(90deg, #FFFFFF 0%, #C9DBF5 60%, #D9CFFF 100%);
    -webkit-background-clip: text;
    background-clip: text;
}
