:root {
    --primary: #f97316;
    --primary-hover: #ea580c;
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --text-white: #ffffff;
    --text-gray: #a1a1aa;
    --danger: #ef4444;
    --success: #22c55e;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-white);
}

h1, h2, h3, .logo { font-family: 'Poppins', sans-serif; }
.highlight { color: var(--primary); }

.view { display: none; }
.view.active { display: flex; flex-direction: column; min-height: 100vh; }

/* Login */
#login-view { justify-content: center; align-items: center; }
.login-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-box h2 { margin-bottom: 30px; font-size: 32px; }
input, select {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 15px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
}
.btn {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    background: var(--primary);
    color: white;
    transition: 0.3s;
}
.btn:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); width: auto; }
.btn-success { background: var(--success); width: auto; }
.error-msg { color: var(--danger); margin-top: 10px; font-size: 14px; }

/* Dashboard Nav */
.admin-nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 5%;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(249, 115, 22, 0.2);
}
.admin-nav .logo { font-size: 24px; }
.nav-links { display: flex; gap: 10px; }
.tab-btn {
    background: transparent;
    color: var(--text-gray);
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
}
.tab-btn.active, .tab-btn:hover { color: var(--primary); }

/* Dashboard Content */
.admin-content { padding: 40px 5%; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.header-row { display: flex; justify-content: space-between; margin-bottom: 20px; }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: 12px; overflow: hidden; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
th { background: rgba(255,255,255,0.02); color: var(--text-gray); font-size: 14px; }
.actions { display: flex; gap: 10px; }
.actions button { padding: 6px 12px; font-size: 12px; }

/* --- MODAL STÍLUSOK --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none; /* Amikor aktív, flex-re váltjuk */
    justify-content: center;
    align-items: center;
}

.modal {
    background: var(--bg-card);
    padding: 35px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 450px;
    display: none; /* Amikor aktív, block-ra váltjuk */
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 {
    margin-bottom: 25px;
    font-size: 22px;
    color: var(--primary);
}

.modal p {
    color: var(--text-gray);
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.modal-actions .btn {
    width: auto;
    padding: 10px 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-gray);
    font-size: 14px;
    margin-top: 5px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

/* --- DRAG & DROP STÍLUSOK --- */
.drag-handle {
    cursor: grab;
    color: var(--text-gray);
    font-size: 20px;
    padding: 15px 10px;
    text-align: center;
    touch-action: none; /* Mobilos görgetés letiltása a fogantyún a húzás érdekében */
}
.drag-handle:active {
    cursor: grabbing;
}
.sortable-ghost {
    opacity: 0.4;
    background-color: rgba(249, 115, 22, 0.1) !important;
}

/* --- MOBIL NÉZET OPTIMALIZÁLÁS --- */
@media screen and (max-width: 768px) {
    .header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-row .btn {
        width: 100%;
        justify-content: center;
    }

    .admin-nav {
        flex-direction: column;
        gap: 15px;
        padding: 15px 5%;
    }

    .nav-links {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 8px 10px;
        font-size: 14px;
        flex: 1;
        text-align: center;
    }

    th, td {
        padding: 10px;
        font-size: 13px;
    }

    /* Gombok oszlopba rendezése a táblázatban mobilon */
    .actions {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    .actions button {
        width: 100%;
        padding: 10px;
    }
}

/* --- JÁTÉKMÓDOK RÁCS ÉS KÁRTYÁK --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.gamemode-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s;
}
.gamemode-card:hover {
    border-color: rgba(249, 115, 22, 0.3);
}
.gamemode-card .drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    border-radius: 8px;
    width: 36px; height: 36px;
    display: flex; justify-content: center; align-items: center;
    cursor: grab;
    z-index: 10;
    backdrop-filter: blur(4px);
}
.gamemode-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #222;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.gamemode-info {
    padding: 20px;
    flex: 1;
}
.gamemode-info h4 { margin-bottom: 10px; color: var(--primary); font-size: 18px; }
.gamemode-info p { font-size: 13px; color: var(--text-gray); line-height: 1.5; }
.gamemode-actions {
    display: flex;
    padding: 15px;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.2);
}
.gamemode-actions .btn { flex: 1; padding: 8px; font-size: 13px; }

/* Képfeltöltő a Modalban */
.image-upload-wrapper {
    display: flex; flex-direction: column; gap: 10px;
}
.image-preview {
    width: 100%; height: 150px; border-radius: 8px;
    background: rgba(255,255,255,0.05); border: 2px dashed rgba(255,255,255,0.2);
    display: flex; justify-content: center; align-items: center;
    overflow: hidden; position: relative;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; display: none; }
.image-preview span { color: var(--text-gray); font-size: 13px; }

/* --- MULTI-SELECT DROPDOWN --- */
.multi-select-container label {
    font-size: 12px;
    color: var(--primary);
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}
.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 32px; /* Helyfoglaló, ha üres */
}
.chip {
    background: rgba(255,255,255,0.1);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}
.chip i { transition: 0.2s; }
.chip:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
    color: var(--danger);
}
.chip.admin-chip {
    background: rgba(249, 115, 22, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}
.chip.admin-chip:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
    color: var(--danger);
}
.multi-select-dropdown {
    position: relative;
    width: 100%;
}
.dropdown-header {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    user-select: none;
}
.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    margin-top: 5px;
    z-index: 2500;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    color: white;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: rgba(255,255,255,0.05); }
.dropdown-item.disabled {
    color: rgba(255,255,255,0.2);
    pointer-events: none;
    background: transparent;
}

/* --- MARKDOWN STÍLUSOK A FELADATOKBAN --- */
.markdown-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-gray);
    word-break: break-word;
}
.markdown-content p { margin-bottom: 10px; }
.markdown-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid rgba(255,255,255,0.1);
    display: block;
}
.markdown-content blockquote {
    border-left: 4px solid var(--primary); /* Itt a menő behúzás */
    padding: 8px 15px;
    margin: 10px 0;
    color: #ccc;
    background: rgba(255,255,255,0.03);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}
.markdown-content ul, .markdown-content ol {
    margin-left: 20px;
    margin-bottom: 10px;
}
.markdown-content code {
    background: rgba(0,0,0,0.4);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
    color: #ff9800;
}
.markdown-content pre code {
    display: block;
    padding: 10px;
    overflow-x: auto;
    color: white;
}
.markdown-content a {
    color: var(--primary);
    text-decoration: none;
}
.markdown-content a:hover {
    text-decoration: underline;
}