/* ── Zmienne CSS ── */
:root {
    --bg: #f5f5f5;
    --bg-card: white;
    --bg-input: white;
    --border: #ddd;
    --border-soft: #f0f0f0;
    --text: #222;
    --text-muted: #666;
    --text-dim: #999;
    --text-accent: #1a1a2e;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    --bg: #0a0a0f;
    --bg-card: #151520;
    --bg-input: #1a1a23;
    --border: #2a2a3a;
    --border-soft: #1f1f2a;
    --text: #e0e0e8;
    --text-muted: #a0a0b0;
    --text-dim: #707080;
    --text-accent: #a0aee0;
    --shadow: 0 4px 16px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}

/* ── Header ── */
header {
    background: #1a1a2e;
    color: white;
    padding: 20px 24px;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 700px;
    margin: 0 auto;
}
.header-text { text-align: left; }
.header-text h1 { font-size: 1.5rem; }
.header-text p { opacity: 0.7; margin-top: 4px; font-size: 0.9rem; }

/* ── Theme Toggle ── */
.theme-toggle {
    flex-shrink: 0;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s;
}
.theme-toggle:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ── Container ── */
.container { 
    max-width: 700px; 
    margin: 40px auto; 
    padding: 0 16px; 
}

/* Większy kontener na dużych ekranach dla dwóch kolumn */
@media (min-width: 769px) {
    .container {
        max-width: 1000px;
    }
}

/* ── Search Box ── */
.search-box {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}
.kierunek { display: flex; gap: 12px; margin-bottom: 16px; }
.kierunek button {
    flex: 1;
    padding: 10px;
    border: 2px solid #1a1a2e;
    border-radius: 8px;
    background: var(--bg-input);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text);
}
.kierunek button.active { background: #1a1a2e; color: white; }

.input-row { display: flex; gap: 8px; }
input[type=text] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
    background: var(--bg-input);
    color: var(--text);
}
input[type=text]::placeholder { color: var(--text-dim); }
input[type=text]:focus { border-color: #1a1a2e; }

button.szukaj-btn {
    padding: 12px 20px;
    background: #1a1a2e;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

/* ── Wyniki ── */
.wyniki {
    margin-top: 24px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    display: none;
}
.wyniki h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 12px; }

.wyniki-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* Globalny przycisk zgłaszania */
.btn-report-global {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    padding: 8px;
    opacity: 0.6;
    transition: all 0.2s;
}
.btn-report-global:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* ── Sekcje słowników ── */
.slownik-sekcja {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: 10px;
    border-left: 4px solid #1a1a2e;
}
.slownik-sekcja:last-of-type { margin-bottom: 0; }

/* Desktop: sekcje obok siebie */
@media (min-width: 769px) {
    .slowniki-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-top: 16px;
    }
    .slownik-sekcja {
        margin-bottom: 0;
    }
}

/* Tablet i mobile: sekcje pod sobą */
@media (max-width: 768px) {
    .slowniki-container {
        display: block;
    }
}

.slownik-tytul {
    font-size: 0.95rem;
    color: var(--text-accent);
    margin-bottom: 12px;
    font-weight: bold;
}

.licznik {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 8px;
}

/* Odznaki słowników */
.badge-ojgyn, .badge-syniawa {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: bold;
    margin-left: 6px;
}
.badge-ojgyn {
    background: #1a1a2e;
    color: white;
}
.badge-syniawa {
    background: #4a6cf7;
    color: white;
}

.lista { list-style: none; }
.lista li {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 1rem;
}
.lista li:last-child { border-bottom: none; }
.brak { color: var(--text-dim); font-style: italic; }

/* ── Frazy ── */
.frazy { margin-top: 20px; padding-top: 16px; border-top: 2px dashed var(--border-soft); }
.frazy h3 { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 10px; }

.frazy-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.frazy-item:hover { background: var(--bg-input); }
.frazy-item .fraza-slowo {
    font-weight: bold;
    color: var(--text-accent);
    font-size: 0.95rem;
    white-space: normal;
    word-break: break-word;
}
.frazy-item .fraza-tlum {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ── Sugestie diakrytyczne ── */
.sugestie-dia {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-input);
    border-left: 4px solid #4a6cf7;
    border-radius: 8px;
}
.sugestie-dia p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; }
.sugestie-dia .dia-item {
    display: inline-block;
    margin: 4px 6px 4px 0;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 2px solid #4a6cf7;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: bold;
    transition: all 0.2s;
    word-break: break-word;
}
.sugestie-dia .dia-item:hover { background: #4a6cf7; color: white; }
.sugestie-dia .dia-tlum { font-size: 0.8rem; color: var(--text-muted); font-weight: normal; margin-left: 4px; }

/* ── Podobne ── */
.podobne { margin-top: 20px; padding-top: 16px; border-top: 2px dashed var(--border-soft); }
.podobne h3 { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 8px; }
.podobne-item {
    margin: 6px 0;
    cursor: pointer;
    color: var(--text-accent);
    font-size: 0.95rem;
    word-break: break-word;
}
.podobne-item:hover { text-decoration: underline; }

/* ── Panel Cookies ── */
.cookie-banner {
    position: fixed;
    bottom: -200px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    box-shadow: 0 -4px 25px rgba(0,0,0,0.2);
    padding: 24px;
    z-index: 10000;
    transition: bottom 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.cookie-banner.show { bottom: 0; }
.cookie-content {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.cookie-content p { font-size: 0.9rem; line-height: 1.5; color: var(--text); }
.cookie-btn {
    background: #1a1a2e;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    transition: all 0.2s;
}
.cookie-btn:hover { background: #2a2a4e; transform: translateY(-2px); }

/* ── Mobile ── */
@media (max-width: 480px) {
    .header-text h1 { font-size: 1.1rem; }
    .header-text p { font-size: 0.8rem; }
    .theme-toggle { width: 38px; height: 38px; }

    /* Fix dla wyszukiwarki */
    .input-row {
        flex-direction: column;
        gap: 12px;
    }
    button.szukaj-btn {
        width: 100%;
        padding: 14px;
    }

    .cookie-content { flex-direction: column; text-align: center; }
    .cookie-btn { width: 100%; }
}


/* ── Przycisk zgłaszania błędów - nowy system ── */
.slownik-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Tryb zgłaszania */
.lista.report-mode li:not(.brak) {
    cursor: pointer;
    padding-left: 40px;
    position: relative;
    transition: background 0.2s;
}
.lista.report-mode li:not(.brak):hover {
    background: var(--bg-card);
}

.checkbox-wrapper {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.error-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.report-actions {
    display: none;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed var(--border-soft);
    justify-content: center;
}

.btn-submit-reports {
    padding: 12px 30px;
    background: #1a1a2e;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.2s;
}
.btn-submit-reports:hover {
    background: #2a2a4e;
    transform: translateY(-2px);
}

.modal-tlumaczenia {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    max-height: 200px;
    overflow-y: auto;
}
.modal-tlumaczenia li {
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 6px;
    margin: 5px 0;
    border-left: 3px solid #dc3545;
}

/* ── Modal ── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s;
    overflow-y: auto;
    padding: 20px 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-card);
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
    position: relative;
}

/* Lepsze przewijanie */
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 4px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

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

.modal-close {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}
.modal-close:hover {
    color: var(--text);
}

.modal-content h2 {
    margin-top: 0;
    color: var(--text);
    font-size: 1.3rem;
}

.modal-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}
[data-theme="dark"] .modal-warning {
    background: #3a3520;
    border-left-color: #ffc107;
}
.modal-warning p {
    margin: 5px 0;
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.5;
}
[data-theme="dark"] .modal-warning p {
    color: #f0e0a0;
}
.modal-warning strong {
    display: block;
    margin-bottom: 5px;
}

.modal-info {
    background: var(--bg-input);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}
.modal-info p {
    margin: 8px 0;
    color: var(--text);
}
.modal-info strong {
    color: var(--text-accent);
}

.modal-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: bold;
}

.modal-form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text);
    resize: vertical;
    outline: none;
}
.modal-form textarea:focus {
    border-color: #1a1a2e;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-submit, .btn-cancel {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.btn-submit {
    background: #1a1a2e;
    color: white;
}
.btn-submit:hover {
    background: #2a2a4e;
    transform: translateY(-2px);
}

.btn-cancel {
    background: var(--border);
    color: var(--text);
}
.btn-cancel:hover {
    background: var(--text-muted);
    color: white;
}

.modal-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    position: sticky;
    bottom: 0;
    z-index: 10;
}
.modal-message.success {
    background: #d4edda;
    color: #155724;
}
.modal-message.error {
    background: #f8d7da;
    color: #721c24;
}

/* Mobile */
@media (max-width: 480px) {
    .modal-content {
        margin: 20% auto;
        width: 95%;
        padding: 20px;
    }
    
    .btn-report {
        font-size: 0.8rem;
        padding: 2px 6px;
    }
}


/* ── Mobile responsywność dla modala ── */
@media (max-width: 480px) {
    .modal {
        padding: 10px 0;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        max-height: calc(100vh - 20px);
    }
    
    .modal-warning {
        padding: 12px;
        font-size: 0.85rem;
    }
    
    .modal-tlumaczenia {
        max-height: 150px;
    }
}
