:root {
    --bg-color: #0f0f0f;
    --sidebar-color: #161616;
    --content-bg: #1a1a1a;
    --text-color: #e0e0e0;
    --text-muted: #888;
    
    /* Złoty akcent */
    --accent-color: #feba01; 
    --accent-hover: #cca600; 
    
    /* Czerwony akcent */
    --danger-color: #8b0000;
    --danger-hover: #ff0000;
    
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-radius-pill: 50px;
    
    --shadow-soft: 0 4px 20px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 15px rgba(255, 212, 12, 0.15);
}

/* --- 1. RESET & BAZA --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea, .editor, .mce-content-body {
    -webkit-user-select: text !important;
    user-select: text !important;
    cursor: auto;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--accent-color); }


/* --- 2. SIDEBAR (LEWE MENU) --- */
.sidebar {
    width: 300px;
    background-color: var(--sidebar-color);
    border-right: 1px solid #222;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    height: 100vh;
    padding: 20px 0 0 0; 
}

.logo-area {
    padding: 0 20px 20px 20px; 
    text-align: center;
    border-bottom: 1px solid #222;
    margin-bottom: 10px;
}

.sidebar-gif {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    margin-bottom: 15px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-soft);
}

.logo-area h1 {
    color: var(--accent-color);
    font-size: 22px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 5px;
    text-shadow: 0 0 15px rgba(255, 212, 12, 0.3);
}
.logo-area p { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* Menu Lista */
.menu-list {
    list-style: none;
    padding: 10px; 
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
}

.menu-item { margin-bottom: 5px; }

.menu-link {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    flex: 1;
    width: 100%; 
    padding: 12px 15px;
    color: #d1d1d1; 
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid transparent;
}

.menu-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.menu-link.active {
    background-color: var(--accent-color);
    color: #000; 
    box-shadow: 0 4px 15px rgba(255, 212, 12, 0.4);
    transform: translateY(-1px);
}

/* Podmenu */
.submenu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                opacity 0.4s ease, 
                padding 0.4s ease;
    list-style: none;
    padding: 0 0 0 15px; 
}

.submenu-link { 
    display: block; 
    padding: 8px 15px; 
    color: #a8a8a8; 
    font-size: 14px;
    text-decoration: none; 
    transition: 0.2s; 
    border-radius: 8px;
    margin-bottom: 2px;
}
.submenu-link:hover { color: #fff; background: rgba(255,255,255,0.03); }
.submenu-link.active { color: var(--accent-color); background: rgba(255, 212, 12, 0.1); border: 1px solid rgba(255, 212, 12, 0.2); }

.menu-item.open .submenu {
    max-height: 500px; 
    opacity: 1;
    padding: 5px 0 10px 15px; 
}

.arrow-wrapper { 
    display: flex; align-items: center; justify-content: center; 
    width: 30px; height: 100%; cursor: pointer; color: inherit; 
}

/* Admin Controls */
.admin-controls { display: inline-flex; gap: 4px; margin-left: 8px; opacity: 0; transition: 0.3s; }
.menu-item:hover .admin-controls, .submenu-item:hover .admin-controls { opacity: 1; }

.admin-mini-btn { 
    background: #222; border: 1px solid #444; color: #888; 
    font-size: 10px; width: 20px; height: 20px; 
    display:flex; align-items:center; justify-content:center;
    cursor: pointer; transition: 0.2s; border-radius: 4px; 
}
.admin-mini-btn:hover { border-color: #fff; color: #fff; transform: scale(1.1); }

/* NOWE KOLORY PRZYCISKÓW ADMINA */
.admin-mini-btn.add { color: #4caf50; border-color: #2e7d32; }
.admin-mini-btn.add:hover { background: #4caf50; color: #fff; border-color: #4caf50; }

.admin-mini-btn.del { color: #f44336; border-color: #c62828; }
.admin-mini-btn.del:hover { background: #f44336; color: #fff; border-color: #f44336; }

.menu-link.active .admin-mini-btn { border-color: rgba(0,0,0,0.2); color: rgba(0,0,0,0.6); background: rgba(255,255,255,0.2); }
.menu-link.active .admin-mini-btn:hover { color: #000; background: #fff; }


/* Stopka Sidebara */
.sidebar-footer { 
    margin-top: auto; 
    padding: 15px 15px 5px 15px; 
    border-top: 1px solid #222; 
    background-color: var(--sidebar-color); 
    text-align: center; 
}

.server-btn { 
    display: block; width: 100%; padding: 10px; 
    background: transparent; 
    border: 1px solid var(--accent-color); 
    color: var(--accent-color); 
    text-decoration: none; 
    font-weight: 700; font-size: 11px; 
    margin-bottom: 12px; 
    transition: 0.3s; 
    border-radius: var(--border-radius-pill);
    text-transform: uppercase;
}
.server-btn:hover { background: var(--accent-color); color: #000; box-shadow: var(--shadow-glow); }

.social-icons { display: flex; justify-content: center; gap: 10px; margin-bottom: 0; }
.social-btn { 
    width: 32px; height: 32px; 
    display: flex; align-items: center; justify-content: center; 
    background: #252525; color: #888; border-radius: 50%; 
    text-decoration: none; font-size: 14px; transition: 0.3s; 
    border: 1px solid #333;
}
.social-btn:hover { color: #fff; border-color: #555; transform: translateY(-3px); }
.social-btn.discord:hover { background: #5865F2; border-color: #5865F2; }
.social-btn.tiktok:hover { background: #000; border-color: #fff; }
.social-btn.facebook:hover { background: #1877F2; border-color: #1877F2; }
.social-btn.instagram:hover { background: #E4405F; border-color: #E4405F; }

.sidebar-footer p { font-size: 10px; color: #555; margin-top: 10px; margin-bottom: 0 !important; padding-bottom: 0 !important; }


/* --- 3. CONTENT (PRAWA STRONA) --- */
.content-area {
    flex-grow: 1;
    padding: 50px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, #1a1a1a 0%, #0f0f0f 100%);
    background-image: linear-gradient(rgba(15,15,15,0.92), rgba(15,15,15,0.92)), url('https://upload.wikimedia.org/wikipedia/commons/1/18/Metin2_Logo.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed; 
}

h2 {
    color: var(--accent-color); font-size: 32px; margin-bottom: 25px; padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 212, 12, 0.2); font-weight: 700; letter-spacing: -0.5px;
}
h3 { color: #fff; margin-top: 35px; margin-bottom: 20px; font-size: 24px; }
p { line-height: 1.7; margin-bottom: 20px; color: #ccc; font-size: 16px; }

table { 
    width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: 30px; 
    background-color: rgba(30, 30, 30, 0.8); box-shadow: var(--shadow-soft);
    border-radius: var(--border-radius-sm); overflow: hidden; border: 1px solid #333;
}
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #333; }
th { background-color: #252525; color: var(--accent-color); text-transform: uppercase; font-size: 13px; letter-spacing: 1px; border-bottom: 2px solid #333; }
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: rgba(255, 255, 255, 0.02); }


/* --- 4. ELEMENTY INTERFEJSU --- */

input[type="text"], .custom-modal-input {
    background: #111; border: 1px solid #333; color: #fff; 
    padding: 12px 15px; border-radius: var(--border-radius-sm); 
    transition: 0.3s; outline: none; width: 100%;
}
input[type="text"]:focus, .custom-modal-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(255, 212, 12, 0.1);
}

.btn { 
    background: rgba(255, 212, 12, 0.05); color: var(--accent-color); border: 1px solid var(--accent-color); 
    padding: 12px 30px; cursor: pointer; text-decoration: none; font-weight: 700; 
    display: inline-block; transition: 0.3s; text-transform: uppercase; font-size: 13px; letter-spacing: 1px;
    border-radius: var(--border-radius-pill); 
}
.btn:hover { background: var(--accent-color); color: #000; box-shadow: var(--shadow-glow); transform: translateY(-2px); }
.btn-red { background: rgba(139, 0, 0, 0.2); color: #ff4d4d; border-color: #ff4d4d; }
.btn-red:hover { background: #ff0000; color: white; border-color: #ff0000; box-shadow: 0 0 20px rgba(255, 0, 0, 0.4); }


/* --- WYSZUKIWARKA I WYNIKI --- */
.search-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.search-wrapper input { 
    background: #0f0f0f; border: 1px solid #333; border-radius: 8px; flex-grow: 1; padding-right: 15px !important; 
}
.search-clear { 
    position: static; transform: none; 
    width: 44px; min-width: 44px; background: #111; border: 1px solid #333; border-radius: 8px;
    color: #555; cursor: pointer; transition: 0.3s; font-size: 14px;
    display: none; justify-content: center; align-items: center;
}
.search-clear:hover { 
    background: rgba(139, 0, 0, 0.2); color: #ff4d4d; border-color: #ff4d4d; 
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.2);
}

.no-results-msg { text-align: center; color: #666; font-size: 12px; margin-top: 15px; display: none; line-height: 1.6; }
.no-results-container { padding-top: 60px; text-align: center; opacity: 0.7; }
.no-results-icon { font-size: 80px; margin-bottom: 25px; color: #333; display: block; }
.no-results-text { font-size: 18px; margin-bottom: 30px; color: #888; }

#searchTrigger { transition: 0.3s; }
#searchTrigger:hover { color: #fff !important; text-shadow: 0 0 10px rgba(255, 212, 12, 0.6); }


/* --- 5. EDYTOR I ADMIN BAR --- */
.admin-bar {
    background-color: rgba(20, 20, 20, 0.9); border: 1px solid #333; border-left: 4px solid var(--accent-color); 
    color: #fff; padding: 15px 25px; display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 40px; border-radius: var(--border-radius-sm); box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}
.editor-container {
    background: #161616; padding: 25px; border: 1px solid #333; border-radius: var(--border-radius-lg); 
    box-shadow: var(--shadow-soft);
}
.tox-tinymce { border: 1px solid #333 !important; border-radius: var(--border-radius-sm) !important; width: 100% !important; box-sizing: border-box !important; }
.tox-statusbar { display: none !important; } 


/* --- 6. MODALE I LIGHTBOX (ZOPTYMALIZOWANE) --- */
.custom-modal-overlay, .lightbox-modal {
    display: none; position: fixed; z-index: 10000; left: 0; top: 0; 
    width: 100%; height: 100%; 
    /* BRAK BLURA DLA WYDAJNOŚCI - CIEMNIEJSZE TŁO */
    background-color: rgba(0, 0, 0, 0.95); 
    backdrop-filter: none;
    
    justify-content: center; align-items: center; 
}

.custom-modal-box {
    background: #1a1a1a; border: 1px solid #333; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); padding: 30px; 
    width: 420px; max-width: 90%; text-align: center; 
    border-radius: 16px; position: relative; 
    display: flex; flex-direction: column; gap: 15px;
    animation: fadeInBackdrop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-modal-title { color: #fff; font-size: 22px; margin-bottom: 5px; font-weight: 700; }
.custom-modal-desc { color: #888; font-size: 14px; margin-bottom: 10px; }

/* Link do bazy ikon */
.icon-db-link {
    color: var(--accent-color);
    font-size: 11px;
    text-transform: uppercase;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 5px;
    transition: 0.3s;
}
.icon-db-link:hover { text-shadow: 0 0 10px rgba(255, 212, 12, 0.6); text-decoration: underline; }


.modal-btn { padding: 12px; border-radius: 8px; font-size: 14px; cursor: pointer; transition: 0.3s; width: 48%; }
.modal-btn.confirm { background: var(--accent-color); color: #000; box-shadow: 0 0 15px rgba(255, 212, 12, 0.15); border: none; font-weight: bold; }
.modal-btn.confirm:hover { transform: translateY(-2px); filter: brightness(1.1); }
.modal-btn.cancel { background: transparent; border: 1px solid #444; color: #aaa; }
.modal-btn.cancel:hover { border-color: #fff; color: #fff; }
.modal-btn-group { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; }

.lightbox-content {
    max-width: 90%; max-height: 90%; border-radius: 8px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8); transition: transform 0.3s;
}

/* Animacje */
@keyframes fadeInBackdrop { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes zoomInImage { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeOutBackdrop { from { opacity: 1; } to { opacity: 0; } }
@keyframes zoomOutImage { from { transform: scale(1); opacity: 1; } to { transform: scale(0.9); opacity: 0; } }

.lightbox-modal.active { display: flex; animation: fadeInBackdrop 0.3s forwards; }
.lightbox-modal.active .lightbox-content { animation: zoomInImage 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.lightbox-modal.closing { display: flex; animation: fadeOutBackdrop 0.3s forwards; }
.lightbox-modal.closing .lightbox-content { animation: zoomOutImage 0.3s forwards; }


/* --- 7. FIX STRZAŁEK --- */
.arrow-icon { transition: transform 0.3s ease, color 0.3s ease; display: inline-block; }
.menu-item.open .arrow-icon { transform: rotate(180deg); }
.menu-item:not(.open) .arrow-wrapper:hover .arrow-icon { color: #00ff00; text-shadow: 0 0 10px rgba(0, 255, 0, 0.6); transform: scale(1.3); }
.menu-item.open .arrow-wrapper:hover .arrow-icon { color: #ff0000; text-shadow: 0 0 10px rgba(255, 0, 0, 0.6); transform: rotate(180deg) scale(1.3); }
/* --- NAPRAWA LIMITU WYSOKOŚCI PODKATEGORII --- */
.menu-item.open .submenu {
    max-height: 3000px !important; 
}
/* --- WYGLĄD LINKÓW W TREŚCI --- */
/* Zawężamy działanie tylko do akapitów (p), list (li) i tabel (td), żeby nie popsuć innych przycisków */
.content-area p a, 
.content-area li a, 
.content-area td a {
    text-decoration: none !important; 
    color: #FEBA01 !important;        
    font-weight: normal !important;   
    transition: 0.2s ease;
}

/* Magia: automatyczna ikona z Google Material Symbols przed linkiem */
.content-area p a::before, 
.content-area li a::before, 
.content-area td a::before {
    font-family: 'Material Symbols Outlined'; /* Wczytanie czcionki ikon */
    content: 'left_click';                    /* Nazwa ikony */
    font-size: 1.2em;                         /* Rozmiar ikony */
    vertical-align: middle;                   /* Wyśrodkowanie względem tekstu */
    margin-right: 4px;                        /* Odstęp od tekstu */
    font-weight: normal !important;           /* BARDZO WAŻNE: ikony Google muszą mieć normalną grubość, inaczej zmienią się w tekst */
}

/* Efekt po najechaniu myszką */
.content-area p a:hover, 
.content-area li a:hover, 
.content-area td a:hover {
    text-decoration: underline !important;             
    text-decoration-color: #FEBA01 !important;       
    opacity: 0.9;                                      
}
/* --- NAPRAWA TABEL Z TINYMCE --- */
.content-area table {
    width: 100% !important;        /* Każda tabela zawsze zajmie pełną szerokość ekranu */
    border-collapse: collapse;     /* Łączy ramki ze sobą */
    margin-bottom: 25px;           /* Odstęp pod tabelą */
}

.content-area th, 
.content-area td {
    padding: 12px 10px !important;     /* Równe, ładne odstępy wewnątrz każdej komórki */
    vertical-align: middle !important; /* Wyrównanie zawartości idealnie do środka w pionie */
}

/* ZABIJAMY DZIWNE MARGINESY Z EDYTORA */
.content-area td p, 
.content-area th p {
    margin: 0 !important;          /* Usuwa "ukryte" marginesy z tekstu */
    padding: 0 !important;
}

/* Opcjonalnie: lekkie wyśrodkowanie obrazków (np. ikon shortcodów) w komórkach */
.content-area td img {
    vertical-align: middle;
    margin-right: 5px;             /* Odstęp między ikoną a tekstem obok */
}
/* --- STYLIZACJA TYLKO DLA GIFÓW W TREŚCI --- */
/* Skanuje wszystkie obrazki i wybiera tylko te, które w linku (src) mają rozszerzenie .gif */
.content-area img[src$=".gif"] {
    border-radius: 12px; /* Przyjemne zaokrąglenie rogów */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7); /* Głęboki, elegancki cień */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Płynność animacji */
}

/* Subtelny efekt po najechaniu myszką na gifa */
.content-area img[src$=".gif"]:hover {
    transform: translateY(-4px); /* Lekkie uniesienie */
}
/* --- STYLIZACJA DLA OBRAZÓW WEBP (Tylko zaokrąglenie) --- */
.content-area img[src*=".webp" i] {
    border-radius: 12px !important;
    /* Brak cieni i transformacji zgodnie z życzeniem */
    box-shadow: none !important; 
}