/* --- ZMIENNE I MOTYWY --- */
:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #0f172a;
    --primary: #007bff;
    --border: #e2e8f0;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --primary: #3b82f6;
    --border: #334155;
}

/* --- RESET I TYPOGRAFIA --- */
html {
    overflow-y: scroll; /* Zapobiega skakaniu treści przy przełączaniu stron */
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); transition: background 0.3s ease, color 0.3s ease; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }

/* --- WSPÓLNY HEADER --- */
header { padding: 1rem 0; background: var(--card-bg); border-bottom: 1px solid var(--border); box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.logo { font-size: 1.5rem; font-weight: bold; }
.controls { display: flex; gap: 15px; align-items: center; }
.nav-link { color: var(--text-color); font-weight: 600; padding: 8px 12px; border-radius: 6px; transition: background 0.2s; font-size: 0.95rem; }
.nav-link:hover { background: rgba(0, 123, 255, 0.1); color: var(--primary); }

/* --- UKŁAD (GRID I KARTY) --- */
.container { display: grid; grid-template-columns: 1fr 400px; gap: 2rem; max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
.container-single { grid-template-columns: 1fr !important; max-width: 800px !important; margin: 2rem auto; }
.card { background: var(--card-bg); padding: 1.5rem; border-radius: 12px; margin-bottom: 1.5rem; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border: 1px solid var(--border); transition: transform 0.2s; }
.card h3 { margin-bottom: 1rem; }

/* --- FORMULARZE I PRZYCISKI --- */
input[type="text"], input[type="number"], input[type="email"], input[type="datetime-local"], select, textarea { 
    width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-color); color: var(--text-color); font-size: 1rem; 
}
input[type="range"] { accent-color: var(--primary); }

.btn-primary { width: 100%; padding: 12px 20px; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: bold; cursor: pointer; transition: opacity 0.2s; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { width: 100%; padding: 12px 20px; background: transparent; color: var(--primary); border: 2px solid var(--primary); border-radius: 8px; font-size: 1.1rem; font-weight: bold; cursor: pointer; transition: background 0.2s; }
.btn-secondary:hover { background: rgba(0, 123, 255, 0.1); }

/* --- ZAKŁADKI (TABS) --- */
.qr-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }
.tab-btn { padding: 10px 18px; border: 1px solid var(--border); background: var(--bg-color); color: var(--text-color); border-radius: 8px; cursor: pointer; font-size: 0.95rem; font-weight: 600; transition: all 0.2s; }
.tab-btn:hover { border-color: var(--primary); }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3); }

/* --- ANIMACJE --- */
.input-group { display: none; animation: fadeIn 0.3s ease; }
.input-group.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- ELEMENTY SPECJALNE (QR, Paski Postępu) --- */
.sticky-container { position: sticky; top: 2rem; background: var(--card-bg); padding: 1.5rem; border-radius: 12px; text-align: center; border: 1px solid var(--border); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.qr-wrapper { margin: 1.5rem 0; display: flex; justify-content: center; padding: 1rem; background: #fff; border-radius: 8px; border: 1px solid #e2e8f0; }
.progress-bar { width: 100%; height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; margin-top: 5px; }
.progress-bar div { height: 100%; transition: width 0.3s ease, background-color 0.3s ease; }

/* --- REKLAMY --- */
.ad-slot { background: var(--bg-color); border: 1px dashed var(--border); color: #888; display: flex; align-items: center; justify-content: center; margin: 1rem 0; font-size: 0.8rem; border-radius: 8px; }
.top-ad { max-width: 728px; height: 90px; margin: 1rem auto; }
.in-feed-ad { height: 100px; }
.sticky-ad { width: 300px; height: 250px; margin: 1.5rem auto 0; }

/* --- MODAL POBIERANIA / PRZETWARZANIA (NAPRAWIONY) --- */
.hidden { display: none !important; }

#loadingModal, .modal { 
    position: fixed !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100vw !important; 
    height: 100vh !important; 
    background: rgba(15, 23, 42, 0.85) !important; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 99999 !important; 
}

#loadingModal.hidden, .modal.hidden { 
    display: none !important; 
}

.modal-content { 
    background: var(--card-bg); 
    padding: 2.5rem; 
    border-radius: 12px; 
    text-align: center; 
    width: 90%;
    max-width: 450px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.loader { 
    border: 4px solid var(--border); 
    border-top: 4px solid var(--primary); 
    border-radius: 50%; 
    width: 45px; 
    height: 45px; 
    animation: spin 1s linear infinite; 
    margin: 25px auto; 
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* --- COOKIE BANNER --- */
.cookie-banner { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--card-bg); border-top: 1px solid var(--border); padding: 15px 20px; box-shadow: 0 -4px 10px rgba(0,0,0,0.1); z-index: 2000; display: flex; justify-content: center; }
.cookie-banner.hidden { display: none; }
.cookie-content { max-width: 1200px; width: 100%; display: flex; flex-direction: column; gap: 15px; align-items: center; text-align: center; }
@media (min-width: 768px) { .cookie-content { flex-direction: row; justify-content: space-between; text-align: left; } .cookie-buttons { width: auto; } }
.cookie-buttons { display: flex; gap: 10px; width: 100%; justify-content: center; }

/* --- RWD --- */
@media (max-width: 768px) {
    .container { grid-template-columns: 1fr; }
    .sticky-container { position: static; }
}

/* --- REKLAMY BOCZNE (SKYSCRAPER 160x600) --- */
.side-ad {
    display: none;
    position: fixed;
    top: 120px;
    width: 160px;
    height: 600px;
    background: var(--card-bg);
    border: 1px dashed var(--border);
    color: #888;
    border-radius: 8px;
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

@media (min-width: 1350px) {
    .side-ad { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 0.8rem; }
    .side-ad.left { left: 10px; }
    .side-ad.right { right: 10px; }
    .container { max-width: 980px; grid-template-columns: 1fr 320px; }
    .container.container-single { grid-template-columns: 1fr !important; max-width: 800px !important; } 
}

@media (min-width: 1600px) {
    .side-ad.left { left: calc(50% - 780px); }
    .side-ad.right { right: calc(50% - 780px); }
    .container { max-width: 1200px; grid-template-columns: 1fr 400px; }
    .container.container-single { grid-template-columns: 1fr !important; max-width: 800px !important; }
}