﻿/* ==========================================================================
   MAGYARFEJLESZTOK.HU - TELJES MOBIL- ÉS ASZTALI OPTIMALIZÁLT CSS
   ========================================================================== */

/* 1. DIZÁJN TOKENEK & VÁLTOZÓK */
:root {
    --bg-dark: #0b0f19;
    --bg-card: #111827;
    --bg-hover: #1f2937;
    --border-color: #1f293d;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --code-color: #3b82f6;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
}

/* 2. ALAP BEÁLLÍTÁSOK */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
}

a {
    color: inherit;
    transition: color 0.15s ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 3. VÁZ ÉS ELRENDEZÉS (LAYOUT) */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.brand a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
}

.code-icon {
    color: var(--code-color);
    font-weight: 900;
}

.tld {
    color: var(--text-muted);
}

.nav-links {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.nav-item.active {
    border-left: 3px solid var(--accent-blue);
    background-color: rgba(37, 99, 235, 0.1);
}

.main-wrapper {
    margin-top:-25px;
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: calc(100% - 260px);
}

/* TOPBAR & FEJLÉC */
.topbar {
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    background-color: rgba(17, 24, 39, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 80;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 420px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.user-profile-link:hover {
    background: var(--bg-hover);
}

.topbar-icon-btn {
    color: var(--text-muted);
    font-size: 1.05rem;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.15s ease;
}

.topbar-icon-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

/* Keresőmező */
.search-container {
    position: relative;
    width: 100%;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    width: 280px;
    color: var(--text-muted);
    position: relative;
}

.search-box:focus-within {
    border-color: var(--accent-blue);
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}

.shortcut {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-muted);
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    margin-left: auto;
}

/* Gombok */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 38px;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-blue-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    min-height: 32px;
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Tartalom térköz */
.content {
    padding: 30px 25px;
    flex: 1;
    width: 100%;
}

.footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    background: var(--bg-card);
}

/* 4. DASHBOARD & RÁCS RENDSZEREK */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 25px;
    align-items: start;
}

.hero-banner {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 35px;
    margin-bottom: 25px;
}

.hero-banner h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.25;
}

.hero-banner h1 span {
    color: var(--code-color);
}

.hero-banner p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 1rem;
}

.section-block {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 10px;
}

.section-header h1, .section-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

/* Rácsok */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 15px;
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: border-color 0.2s ease;
}

.article-card:hover {
    border-color: var(--accent-blue);
}

.article-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 5. ŰRLAPOK ÉS HITELTESÍTÉS */
.auth-container {
    max-width: 480px;
    margin: 30px auto;
    width: 100%;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.auth-card h2 {
    font-size: 1.45rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.auth-card p.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 22px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--accent-blue);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 18px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* 6. PROFIL & KOMMENTEK */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.avatar-placeholder {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.comment-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    flex-shrink: 0;
}

.comment-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e5e7eb;
    word-break: break-word;
}

/* 7. KÓDBLOKK ÉS FORMÁZÁS */
.code-block-wrapper {
    position: relative;
    margin: 15px 0;
    max-width: 100%;
}

pre[class*="language-"], pre {
    background: #1d1f21 !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-family: 'Consolas', 'Fira Code', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 100%;
}

.editor-toolbar {
    display: flex;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 8px;
    flex-wrap: wrap;
}

.editor-toolbar button, .editor-toolbar select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* 8. ÉLŐ KERESŐ ÉS ÉRTESÍTÉSEK DROPDOWN */
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    min-width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.notif-bell-container {
    position: relative;
}

.notif-bell-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.9rem;
}

.notif-read-btn {
    background: none;
    border: none;
    color: var(--code-color);
    font-size: 0.75rem;
    cursor: pointer;
}

.notif-list {
    max-height: 320px;
    overflow-y: auto;
}

.notif-item {
    display: block;
    padding: 10px 14px;
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.notif-item.unread {
    background: rgba(37, 99, 235, 0.08);
    border-left: 3px solid var(--accent-blue);
}

.notif-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* 9. ADMIN & TÁBLÁZATOK */
.admin-table-wrapper, div[style*="overflow-x: auto"] {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.admin-table th, .admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge {
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.role-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.role-admin { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.role-moderator { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.role-user { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }

.btn-danger-sm {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
}

/* ==========================================================================
   10. MOBIL & TABLET RESPONSIVE TÖRÉSPONTOK
   ========================================================================== */

.mobile-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.35rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Tablet (<= 1024px) */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .right-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
}

/* Mobil és Kisebb Tabletek (<= 768px) */
@media (max-width: 768px) {
    .mobile-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Becsúszó Sidebar */
    .sidebar {
        position: fixed;
        left: -290px;
        top: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
        transform: translateX(0);
    }

    .sidebar.open {
        transform: translateX(290px);
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .topbar {
        padding: 0 12px;
        height: 58px;
    }

    .topbar-left {
        max-width: unset;
        gap: 8px;
    }

    .search-box {
        width: 100%;
        min-width: 110px;
        max-width: 180px;
        padding: 6px 10px;
    }

    .search-box input {
        font-size: 0.82rem;
    }

    /* Mobilon a hosszú szövegek elrejtése a fejlécben */
    .user-name-text,
    .logout-text,
    .shortcut {
        display: none !important;
    }

    .logout-btn {
        padding: 6px 10px !important;
    }

    .content {
        padding: 20px 14px;
    }

    .hero-banner {
        padding: 22px;
    }

    .hero-banner h1 {
        font-size: 1.45rem;
    }

    /* Űrlap grid elemek 1 oszlopba törése mobilon */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-header .btn {
        width: 100%;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .article-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .notif-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: calc(100vw - 20px);
    }

    .search-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        min-width: unset;
        max-width: calc(100vw - 20px);
    }
}

/* Kis Mobil Képernyők (<= 480px) */
@media (max-width: 480px) {
    .topbar {
        padding: 0 8px;
    }

    .topbar-left {
        gap: 6px;
    }

    .search-box {
        max-width: 130px;
    }


    .user-menu {
        gap: 4px !important;
    }

    .auth-container {
        margin: 10px auto;
    }

    .auth-card {
        padding: 20px 14px;
    }

    .profile-card {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }

    .comment-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .comment-date {
        align-self: flex-start;
        font-size: 0.72rem;
    }

    /* Részletező oldalak gombjainak teljes szélességre nyújtása */
    div[style*="display: flex; gap: 10px"],
    div[style*="display: flex; gap: 12px"] {
        flex-direction: column;
    }

    div[style*="display: flex; gap: 10px"] .btn,
    div[style*="display: flex; gap: 12px"] .btn {
        width: 100%;
    }
}