:root {
    /* --- SZÍNPALETTA --- */
    --sn-dark-bg: hsl(228, 24%, 16%);
    --sn-card-bg: hsl(228, 20%, 23%);
    --sn-primary: hsl(228, 70%, 63%);
    --sn-primary-hover: hsl(228, 70%, 53%);
    --sn-text-main: #ffffff;
    --sn-text-muted: #a0aec0;
    --sn-border: hsl(228, 20%, 30%);
    --sn-radius: 16px;
    --sn-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

/* Minden elemre érvényesítjük a dobozmodellt */
.sn-pm-container, .sn-pm-container * {
    box-sizing: border-box;
}

/* --- OVERLAY & CONTAINER --- */
.sn-pm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 18, 0.85);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px; /* Hely a széleken */
    animation: snFadeIn 0.2s ease-out;
}

.sn-pm-container {
    background: var(--sn-dark-bg);
    color: var(--sn-text-main);
    width: 100%;
    max-width: 480px;
    
    /* GÖRGETÉS FIX (A legfontosabb rész) */
    display: flex;
    flex-direction: column;
    
    /* Fontos: Mobilon/TV-n a 100vh néha gondot okoz az alsó sávok miatt, ezért 85vh a biztonságos */
    max-height: 70vh; 
    height: 100%; /* Kényszerítjük, hogy töltse ki a max-height-et, ha kell */
    
    border-radius: var(--sn-radius);
    box-shadow: var(--sn-shadow);
    position: relative;
    border: 1px solid var(--sn-border);
    overflow: hidden; /* Lekerekített sarkok miatt */
}

/* Ha a tartalom kicsi, akkor a konténer is legyen kicsi (ne nyúljon meg feleslegesen) */
.sn-pm-container:has(.sn-pm-body:empty) {
    height: auto;
}

/* Gyári close gomb rejtése */
.sn-pm-container > .sn-pm-close { display: none; }

/* --- CONTENT WRAPPER --- */
.sn-pm-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* --- SCROLL AREA (A tartalom) --- */
.sn-pm-body {
    padding: 20px 25px;
    
    /* FLEXBOX SCROLL FIX */
    flex: 1 1 auto;   /* Kitölti a rendelkezésre álló helyet */
    min-height: 0;    /* Firefox/Chrome fix: enélkül nem görgetne */
    height: 100%;     /* Biztosítjuk a magasságot */
    
    /* GÖRGETÉS BEÁLLÍTÁSOK */
    overflow-y: auto; 
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS/Mobil sima görgetés */
    touch-action: pan-y; /* Érintőképernyő fix */
    
    scrollbar-width: thin;
    scrollbar-color: var(--sn-primary) var(--sn-dark-bg);
    overscroll-behavior: contain; /* Ne görgesse az oldalt a modal mögött */
}

/* Görgetősáv stílusa (Webkit) */
.sn-pm-body::-webkit-scrollbar { width: 6px; }
.sn-pm-body::-webkit-scrollbar-track { background: var(--sn-dark-bg); }
.sn-pm-body::-webkit-scrollbar-thumb { background-color: var(--sn-primary); border-radius: 4px; }

/* --- HEADER & AVATAR --- */
.sn-pm-cover-header {
    height: 120px;
    background: linear-gradient(135deg, #1a202c 0%, var(--sn-primary) 100%);
    position: relative;
    flex-shrink: 0; /* A fejléc sose nyomódjon össze */
    z-index: 1;
}

/* Avatar szekció */
.sn-pm-avatar-section {
    position: relative;
    margin-top: -70px;
    display: flex;
    justify-content: center;
    z-index: 10;
    flex-shrink: 0; /* Az avatar tartója se nyomódjon össze */
    pointer-events: none;
    margin-bottom: 10px;
}

.sn-pm-avatar-wrap {
    position: relative;
    padding: 5px;
    background: var(--sn-dark-bg);
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    pointer-events: auto;
}

.sn-pm-avatar-wrap img {
    display: block;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--sn-card-bg);
}

.sn-pm-status-indicator {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 18px;
    height: 18px;
    background: #10b981;
    border: 3px solid var(--sn-dark-bg);
    border-radius: 50%;
}

.sn-pm-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.3);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    z-index: 20;
}
.sn-pm-close-btn:hover { background: var(--sn-primary); }

/* --- CONTENT STYLING --- */
.sn-pm-identity {
    text-align: center;
}

.sn-pm-identity h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--sn-text-main);
    font-weight: 700;
}

.sn-pm-handle {
    display: block;
    color: var(--sn-primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.sn-pm-meta {
    font-size: 0.85rem;
    color: var(--sn-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.sn-pm-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 20px 0;
}

.sn-pm-stat-card {
    background: var(--sn-card-bg);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--sn-border);
}

.sn-icon-badge { font-size: 24px; color: var(--sn-primary); margin-bottom: 5px; }
.sn-stat-value { font-size: 1.25rem; font-weight: 800; color: var(--sn-text-main); }
.sn-stat-label { font-size: 0.8rem; text-transform: uppercase; color: var(--sn-text-muted); }

.sn-pm-bio-box {
    background: var(--sn-card-bg);
    border: 1px solid var(--sn-border);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--sn-text-main);
    line-height: 1.6;
    margin-bottom: 25px;
    text-align: left;
}
.sn-pm-empty-bio { font-style: italic; color: var(--sn-text-muted); text-align: center; }

.sn-pm-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-bottom: 10px; /* Hely az alján a görgetéshez */
}

/* --- SUB HEADERS (Edit, Settings, Lists) --- */
.sn-pm-sub-header {
    padding: 15px 25px;
    border-bottom: 1px solid var(--sn-border);
    display: flex;
    align-items: center;
    background: var(--sn-dark-bg);
    flex-shrink: 0; /* A fejléc sose nyomódjon össze, maradjon fixen fent */
    z-index: 10;
    min-height: 60px; /* Fix magasság */
}

.sn-pm-sub-header.with-icon {
    background: var(--sn-card-bg);
}

.header-bg-icon {
    font-size: 22px;
    margin-right: 12px;
    color: var(--sn-primary);
}

.sn-pm-sub-header h2 {
    margin: 0;
    font-size: 1.1rem;
    flex-grow: 1;
    text-align: center;
    color: var(--sn-text-main);
}

.sn-pm-back-link, .sn-pm-close-btn-sub {
    background: none;
    border: none;
    color: var(--sn-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
}
.sn-pm-back-link:hover, .sn-pm-close-btn-sub:hover { color: var(--sn-text-main); }
.sn-pm-close-btn-sub { font-size: 24px; }

/* --- FORMS --- */
.sn-pm-form { display: flex; flex-direction: column; gap: 15px; }
.sn-pm-input-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--sn-text-muted); font-size: 0.9rem; }
.sn-pm-input-group input, .sn-pm-input-group textarea {
    width: 100%; padding: 12px; background: var(--sn-card-bg); border: 1px solid var(--sn-border);
    border-radius: 8px; font-size: 1rem; color: var(--sn-text-main); box-sizing: border-box;
}
.sn-pm-input-group.disabled input { background: rgba(255,255,255,0.05); color: #666; }
.sn-pm-divider { text-align: center; border-bottom: 1px solid var(--sn-border); line-height: 0.1em; margin: 10px 0 20px; }
.sn-pm-divider span { background: var(--sn-dark-bg); padding: 0 10px; color: var(--sn-text-muted); font-size: 0.85rem; }

.sn-pm-avatar-upload-section {
    display: flex; align-items: center; gap: 20px; padding-bottom: 20px; border-bottom: 1px dashed var(--sn-border);
}
.sn-pm-avatar-upload-section img { border-radius: 50%; }
.sn-pm-upload-btn {
    display: inline-flex; align-items: center; gap: 8px; background: var(--sn-card-bg); color: var(--sn-text-main);
    padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.9rem; border: 1px solid var(--sn-border);
}
.sn-pm-char-count { text-align: right; font-size: 0.8rem; color: var(--sn-text-muted); margin-top: 5px; }

/* --- BUTTONS --- */
.sn-pm-btn {
    border: none; padding: 12px 20px; border-radius: 10px; font-weight: 600; font-size: 1rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s;
}
.sn-pm-btn-primary { background: var(--sn-primary); color: white; }
.sn-pm-btn-primary:hover { background: var(--sn-primary-hover); }
.sn-pm-btn-outline { background: transparent; border: 1px solid var(--sn-border); color: var(--sn-text-main); }
.sn-pm-btn-outline:hover { border-color: var(--sn-primary); color: var(--sn-primary); }
.sn-pm-btn-block { width: 100%; }

/* --- LIST VIEW OVERRIDES (A modalon belüli lista elemek) --- */
.sn-pm-list-view .user-post-item {
    background: var(--sn-card-bg) !important;
    border: 1px solid var(--sn-border) !important;
    color: var(--sn-text-main) !important;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
    align-items: center;
    overflow: hidden; /* Ha valami mégis kilógna */
}

/* KÉPMÉRETEZÉS - Fontos a túlnyúlás elkerüléséhez! */
.sn-pm-list-view .user-post-thumbnail {
    flex-shrink: 0; /* Ne nyomódjon össze */
    width: 70px;    /* Fix szélesség */
}

.sn-pm-list-view .user-post-thumbnail img {
    width: 70px !important;       /* Kényszerített szélesség */
    height: 105px !important;     /* Kényszerített magasság (kb 2:3 arány) */
    object-fit: cover !important; /* Levágja a felesleget, nem torzít */
    border-radius: 8px !important;
    display: block;
}

.sn-pm-list-view .user-post-content {
    flex: 1; /* Kitölti a maradék helyet */
    min-width: 0; /* Flexbox text-overflow fix */
}

.sn-pm-list-view .user-post-title {
    margin: 0 0 5px 0 !important;
    font-size: 1rem !important;
    line-height: 1.3 !important;
}

.sn-pm-list-view .user-post-title a { color: var(--sn-text-main) !important; text-decoration: none; }
.sn-pm-list-view .user-post-title a:hover { color: var(--sn-primary) !important; }
.sn-pm-list-view .user-post-excerpt { color: var(--sn-text-muted) !important; font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; }

/* A törlés és adatlap gombok a listában */
.sn-pm-list-view .user-post-button,
.sn-pm-list-view .user-post-delete-button {
    display: inline-block; padding: 6px 12px !important; border-radius: 6px !important;
    font-size: 0.8rem !important; margin-right: 5px; margin-top: 5px; text-decoration: none; cursor: pointer; border: none; font-weight: 600;
}
.sn-pm-list-view .user-post-button { background: var(--sn-primary) !important; color: white !important; }
.sn-pm-list-view .user-post-delete-button { background: #ef4444 !important; color: white !important; }

/* Értesítés gomb megjelenítése a modalban */
.sn-pm-list-view .toggle-notification {
    display: inline-block !important;
    background: transparent !important;
    border: 1px solid var(--sn-border) !important;
    color: var(--sn-text-muted) !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    margin-top: 5px !important;
    width: auto !important;
    font-weight: 600 !important;
    text-align: center;
}
.sn-pm-list-view .toggle-notification:hover {
    border-color: var(--sn-text-muted) !important;
    color: var(--sn-text-main) !important;
}

/* --- BADGES GRID --- */
.sn-pm-list-view .sj-badge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.sn-pm-list-view .sj-badge-item {
    background: var(--sn-card-bg) !important;
    border: 1px solid var(--sn-border) !important;
    color: var(--sn-text-main) !important;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.sn-pm-list-view .sj-badge-img { width: 60px !important; height: 60px !important; object-fit: contain; margin-bottom: 10px; }
.sn-pm-list-view .sj-badge-title { color: var(--sn-text-main) !important; font-weight: bold; margin-top: 5px; font-size: 0.9rem; }
.sn-pm-list-view .sj-badge-desc { color: var(--sn-text-muted) !important; font-size: 0.8rem; border-top: 1px solid var(--sn-border) !important; margin-top: 10px; padding-top: 10px; width: 100%; }
.sn-pm-list-view .sj-no-img-placeholder { background: var(--sn-dark-bg) !important; color: var(--sn-text-muted) !important; margin: 0 auto; width: 60px; height: 60px; display:flex; align-items:center; justify-content:center; border-radius:50%; }

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .sn-pm-container {
        height: 100%;     /* Mobilon teljes magasság */
        max-height: 100%; /* Ne legyen max limit */
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        border: none;
    }
    .sn-pm-overlay { padding: 0; }
    .sn-pm-list-view .sj-badge-grid { grid-template-columns: 1fr; }
}

/* Animációk */
@keyframes snFadeIn { from { opacity: 0; } to { opacity: 1; } }