* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px;
}

.container.narrow {
    max-width: 480px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}

label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 600;
}

input,
textarea,
select,
button {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font-size: 16px;
}

button,
.button {
    display: inline-block;
    text-decoration: none;
    background: #6c8cff;
    color: white;
    border: 0;
    cursor: pointer;
    text-align: center;
    padding: 12px 16px;
    border-radius: 12px;
    margin-top: 16px;
}

.button-secondary {
    background: #e5e7eb;
    color: #111827;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.alert {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.note {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #eef4ff;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.entry-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.entry-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    background: #fafafa;
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 600;
}

.pill-light {
    background: #e5e7eb;
    color: #374151;
}

.entry-custom-word {
    margin: 0 0 10px 0;
    color: #374151;
}

.entry-text {
    white-space: normal;
    line-height: 1.6;
    margin-bottom: 14px;
}

.entry-date {
    margin: 0 0 14px 0;
    color: #6b7280;
    font-size: 14px;
}

.entry-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.button-small {
    width: auto;
    padding: 10px 14px;
    font-size: 14px;
}

.button-danger {
    background: #dc2626;
    color: #fff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (min-width: 700px) {
    .entry-actions {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .inline-form {
        flex-direction: row;
        align-items: center;
    }

    .inline-form select {
        min-width: 180px;
    }
}

.danger-zone {
    border: 1px solid #fecaca;
    background: #fff7f7;
}

.sr-data {
    display: none;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.user-badge {
    padding: 10px 12px;
    border-radius: 12px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 14px;
    line-height: 1.4;
}

.topbar-form {
    margin: 0;
}

.button-inline {
    width: auto;
    margin-top: 0;
}

@media (max-width: 700px) {
    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-right {
        justify-content: flex-start;
    }

    .user-badge {
        width: 100%;
    }
}

/* --- TOPBAR FINOMÍTÁS --- */

.user-badge {
    padding: 8px 12px;
    border-radius: 10px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 13px;
    line-height: 1.3;
    width: fit-content; /* ne legyen teljes szélesség */
}

/* Mobil optimalizálás */
@media (max-width: 700px) {

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .topbar-right {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .user-badge {
        width: fit-content;       /* ne nyúljon ki */
        max-width: 100%;
    }

    /* Gombok teljes szélességen egymás alatt */
    .topbar-right .button,
    .topbar-right .button-inline {
        width: 100%;
        text-align: center;
    }

    /* Profil törlés kiemelése, de ne legyen túl agresszív */
    .button-danger {
        background: #dc2626;
        color: #fff;
    }

    /* Kijelentkezés maradjon nyugodt */
    .button-secondary {
        background: #e5e7eb;
        color: #111827;
    }
}

/* --- ADMIN FELÜLETHEZ --- */

.admin-container {
    max-width: 1100px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.stat-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
}

.stat-label {
    color: #475569;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
}

.admin-stats-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.simple-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.simple-list-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.private-note {
    padding: 12px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 10px;
}

@media (max-width: 700px) {
    .stat-value {
        font-size: 28px;
    }
}

.login-footer {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.login-footer a {
    color: #6b7280;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* --- ADMIN FELÜLETHEZ II - szűréshez --- */

.filter-form {
    margin-top: 12px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

@media (max-width: 700px) {
    .filter-actions {
        flex-direction: column;
    }

    .filter-actions .button {
        width: 100%;
    }
}

/* Admin szűrők – kompakt desktop nézet */
@media (min-width: 1100px) {
    .filter-grid {
        grid-template-columns: 1.2fr 1fr 1fr 1fr 0.95fr 0.95fr;
        gap: 12px;
        align-items: end;
    }

    .filter-grid label {
        font-size: 13px;
        margin-top: 0;
    }

    .filter-grid input,
    .filter-grid select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .filter-actions {
        margin-top: 14px;
        justify-content: flex-end;
    }
}

/* ----- Admin analíses előkészületi blokk ----- */

.analysis-mini-grid {
    margin-top: 12px;
}

.reading-stream {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 24px;
}

.reading-item {
    padding: 18px;
    border-radius: 16px;
    background: #fcfcfd;
    border: 1px solid #e5e7eb;
}

.reading-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    color: #475569;
    font-size: 14px;
    line-height: 1.5;
}

.reading-text {
    line-height: 1.8;
    color: #111827;
    white-space: normal;
}

/* ----- Később elemzendő listához ------*/

.analysis-form {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.analysis-form label {
    margin-top: 0;
}

.analysis-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.analysis-note-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.analysis-note-text {
    margin-top: 8px;
    line-height: 1.6;
    color: #334155;
}

.analysis-selected-item {
    border: 1px solid #c7d2fe;
    background: #f8faff;
}

.analysis-stream {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 24px;
}

.analysis-item {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 2fr);
    gap: 18px;
    padding: 18px;
    border-radius: 16px;
    background: #fcfcfd;
    border: 1px solid #e5e7eb;
}

.analysis-main {
    min-width: 0;
}

.analysis-side {
    min-width: 0;
}

.compact-analysis-form {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.compact-note-box {
    margin-top: 0;
    margin-bottom: 14px;
}

.selected-analysis-item {
    border: 1px solid #c7d2fe;
    background: #f8faff;
}

@media (max-width: 900px) {
    .analysis-item {
        grid-template-columns: 1fr;
    }
}

/* ----- Kiválasztott lista elsődleges elemzés ------- */

.analysis-tags {
    margin-top: 12px;
    padding: 10px 12px;
    background: #f1f5f9;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.analysis-tags-list {
    margin-top: 6px;
    font-size: 14px;
    color: #334155;
}

/* ----- kijelölt lista választott téma bövítés ---- */
.analysis-stream {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 24px;
}

.analysis-main {
    min-width: 0;
}

.analysis-side {
    min-width: 0;
}

.compact-analysis-form {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.selected-analysis-item {
    border: 1px solid #c7d2fe;
    background: #f8faff;
}

.remove-analysis-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

@media (max-width: 900px) {
    .analysis-item {
        grid-template-columns: 1fr;
    }
}