/* ==========================================================================
   1. ZMIENNE (Właściwości Niestandardowe)
   ========================================================================== */
:root {
    --primary: #5b2881;
    --primary-hover: #4a2069;
    --primary-light: rgba(91, 40, 129, 0.08);
    --bg-canvas: #090b10;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-lg: 32px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow-app: 0 30px 60px -12px rgba(0, 0, 0, 0.25), 0 18px 36px -18px rgba(91, 40, 129, 0.3);
    --focus-ring: 0 0 0 4px rgba(91, 40, 129, 0.3);
}

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

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-canvas);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(91, 40, 129, 0.22) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(74, 32, 105, 0.18) 0%, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.5;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 4px;
}

/* ==========================================================================
   3. LAYOUT (Główna aplikacja)
   ========================================================================== */
.aplikacja {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-app);
    width: 100%;
    max-width: 580px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    animation: appear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: max-width 0.3s ease;
}

.aplikacja-szeroka {
    max-width: 760px;
}

@keyframes appear {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.naglowek {
    background: linear-gradient(135deg, #5b2881 0%, #3a1654 100%);
    color: white;
    padding: 44px 36px;
    text-align: center;
    position: relative;
}

.naglowek h1 {
    font-size: 24px;
    font-weight: 700;
}

.zawartosc {
    padding: 40px 36px;
}

/* ==========================================================================
   4. KOMPONENTY
   ========================================================================== */

/* --- Nawigacja --- */
.nawigacja {
    display: flex;
    background: #f1f5f9;
    padding: 5px;
    border-radius: var(--radius-md);
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
}

.nawigacja a {
    flex: 1;
    text-align: center;
    padding: 13px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    border-radius: 12px;
    transition: all 0.25s ease;
}

.nawigacja a:hover { color: var(--primary); }
.nawigacja a.aktywna {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

/* --- Formularze --- */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
}

input[type="text"], 
input[type="password"],
.select-pole {
    width: 100%;
    padding: 15px 18px;
    background: #f8fafc;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    transition: all 0.2s ease;
}

input[type="text"]:focus, 
input[type="password"]:focus,
.select-pole:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: var(--focus-ring);
}

/* --- Upload (Drag & Drop) --- */
.file-upload-wrapper {
    position: relative;
    margin-bottom: 24px;
}

input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    padding: 36px 20px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    width: 100%;
    cursor: pointer;
    color: var(--text-muted);
    text-align: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.file-upload-label:hover,
.file-upload-label.drag-over,
input[type="file"]:focus + .file-upload-label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-2px);
}

.file-upload-label span {
    font-size: 13px;
    font-weight: 600;
    word-break: break-word;
}

/* --- Przyciski --- */
.btn-glowny {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 16px 24px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    width: 100%;
    font-weight: 700;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    box-shadow: 0 8px 20px -4px rgba(91, 40, 129, 0.35);
}

.btn-glowny:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -4px rgba(91, 40, 129, 0.45);
}

.btn-wyloguj-top {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
}

.btn-wyloguj-top:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

/* --- Lista plików --- */
.lista-plikow {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}

.karta-pliku {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease;
}

.karta-pliku:hover {
    border-color: #cbd5e1;
}

.plik-informacje {
    min-width: 0;
    flex: 1;
}

.plik-nazwa {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.plik-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.badge-infinite {
    background: #eef2ff;
    color: #4338ca;
}

.badge-ok {
    background: #f0fdf4;
    color: #15803d;
}

.badge-warning {
    background: #fefce8;
    color: #a16207;
}

.badge-danger {
    background: #fef2f2;
    color: #b91c1c;
}

.plik-akcje {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-akcja {
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-kopiuj {
    background: white;
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-kopiuj:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-kopiuj.skopiowano {
    background: #166534;
    color: white;
    border-color: #166534;
}

.btn-pobierz {
    background: var(--primary);
    color: white;
}

.btn-pobierz:hover {
    background: var(--primary-hover);
}

.pusty-stan {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
}

/* --- Pasek postępu --- */
.progress-container {
    margin-bottom: 24px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease-out;
}

.progress-status {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Alerty --- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 13px;
    font-weight: 600;
    word-break: break-word;
}

.alert a {
    color: inherit;
    text-decoration: underline;
}

.alert-sukces {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-blad {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

@media (max-width: 560px) {
    .karta-pliku {
        flex-direction: column;
        align-items: flex-start;
    }
    .plik-akcje {
        width: 100%;
    }
    .btn-akcja {
        flex: 1;
        text-align: center;
    }
}
/* ==========================================================================
   5. STRONA BŁĘDU 404
   ========================================================================== */
.aplikacja-404 {
    max-width: 720px;
}

.naglowek-404 {
    padding: 36px 32px;
}

.kod-bledu {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -2px;
    margin-bottom: 10px;
    color: #ffffff;
}

.naglowek-404 h1 {
    font-size: 18px;
    font-weight: 600;
    opacity: 0.92;
}

.komunikaty-jezykowe {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.blok-jezyka {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease;
}

.blok-jezyka:hover {
    border-color: #cbd5e1;
}

.blok-jezyka-tresc {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text-main);
    line-height: 1.55;
}

.etykieta-jezyka {
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.btn-jezyk,
.btn-jezyk:link,
.btn-jezyk:visited {
    flex-shrink: 0;
    display: inline-block;
    background-color: var(--primary) !important;
    color: #ffffff !important;
    text-decoration: none !important;
    text-align: center;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px -2px rgba(91, 40, 129, 0.28);
}

.btn-jezyk:hover,
.btn-jezyk:focus,
.btn-jezyk:active {
    background-color: var(--primary-hover) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -2px rgba(91, 40, 129, 0.38);
}