/* ===== GLOBAL STYLES — FenixFine v3 ===== */
:root {
    --primary: #D32F2F;
    --primary-dark: #B71C1C;
    --primary-light: #FF5252;
    --bg: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --text: #212121;
    --text-secondary: #757575;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s ease;
    --header-height: 64px;
    --sidebar-width: 260px;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #f44336;
    --info: #2196F3;
}

[data-theme="dark"] {
    --bg: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #252525;
    --text: #e0e0e0;
    --text-secondary: #aaaaaa;
    --border: #333333;
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.5);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
}

input, textarea {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    background: var(--bg);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== CUSTOM STYLED SELECT — ОБЪЁМНЫЕ КРАСИВЫЕ ===== */
select {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 44px 12px 16px;
    background-color: var(--bg-card);
    background-image:
        linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0.03) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M1 1l6 7 6-7' stroke='%23D32F2F' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: auto, 14px;
    color: var(--text);
    cursor: pointer;
    min-height: 46px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all var(--transition);
    position: relative;
}

select:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.12), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.15), 0 4px 12px rgba(211, 47, 47, 0.1);
    transform: translateY(-1px);
}

select:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), inset 0 2px 4px rgba(0,0,0,0.06);
}

[data-theme="dark"] select {
    background-image:
        linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0.1) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M1 1l6 7 6-7' stroke='%23FF5252' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    box-shadow: 0 2px 6px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

[data-theme="dark"] select:hover {
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

select option {
    background: var(--bg-card);
    color: var(--text);
    padding: 10px;
    font-weight: 500;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow);
    transition: background var(--transition), border-color var(--transition);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.header-logo:hover {
    color: var(--primary-dark);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-theme-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.header-theme-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.25);
}

/* ===== LANGUAGE SELECTOR ===== */
.lang-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 22px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
    min-height: 42px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.lang-btn:hover {
    border-color: var(--primary);
    background: rgba(211, 47, 47, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.12);
}

.lang-btn .lang-flag { font-size: 1.25rem; line-height: 1; }
.lang-btn .lang-code { text-transform: uppercase; letter-spacing: 0.5px; }

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 8px;
    z-index: 1200;
    display: none;
    animation: dropIn 0.25s ease;
}

.lang-dropdown.show { display: block; }

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

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    width: 100%;
    background: none;
    border: none;
    text-align: left;
}

.lang-option:hover {
    background: var(--bg-secondary);
    transform: translateX(2px);
}

.lang-option.active {
    background: rgba(211, 47, 47, 0.08);
    color: var(--primary);
    font-weight: 700;
}

.lang-option .lang-opt-flag { font-size: 1.3rem; }
.lang-option .lang-opt-name { flex: 1; }
.lang-option .lang-opt-check { color: var(--primary); font-weight: 700; }

/* ===== AVATAR BUTTON ===== */
.header-avatar-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    padding: 0;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.25);
}

.header-avatar-btn:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.2);
    transform: scale(1.08);
}

.header-nav a, .header-nav button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text);
    background: transparent;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    padding: 8px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 0;
    z-index: 900;
    transition: transform var(--transition), background var(--transition);
}

.sidebar-section { padding: 8px 16px; }

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(211, 47, 47, 0.08);
    color: var(--primary);
}

.sidebar-link .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 16px; }

.sidebar-game-link { display: flex; align-items: center; gap: 10px; position: relative; }
.sidebar-game-name { flex: 1; font-weight: 600; }

.sidebar-game-count {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
    transition: all var(--transition);
}

.sidebar-game-link:hover .sidebar-game-count,
.sidebar-game-link.active .sidebar-game-count {
    background: var(--primary);
    color: #fff;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left var(--transition);
}

.main-content.full-width { margin-left: 0; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition), transform var(--transition), background var(--transition);
}

.card:hover { box-shadow: var(--shadow-hover); }
.card-clickable:hover { transform: translateY(-2px); cursor: pointer; }

/* ===== GRIDS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d32f2f; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #388E3C; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; color: var(--text); }
.form-group input, .form-group textarea, .form-group select { width: 100%; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-user { background: #e3f2fd; color: #1565c0; }
.badge-publisher { background: #e8f5e9; color: #2e7d32; }
.badge-moderator { background: #fff3e0; color: #e65100; }
.badge-admin { background: #fce4ec; color: #c62828; }
.badge-owner { background: linear-gradient(135deg, #FFD700, #FFA000); color: #3e2723; }

[data-theme="dark"] .badge-user { background: #1a3a5c; color: #90caf9; }
[data-theme="dark"] .badge-publisher { background: #1b3a1e; color: #a5d6a7; }
[data-theme="dark"] .badge-moderator { background: #3e2700; color: #ffcc80; }
[data-theme="dark"] .badge-admin { background: #4a1520; color: #ef9a9a; }

/* ===== POST CARDS ===== */
.post-card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all var(--transition);
}

.post-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.post-card-image { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: var(--bg-secondary); }
.post-card-body { padding: 14px; }

.post-card-title {
    font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.post-card-meta { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-secondary); }
.post-card-meta .author { color: var(--primary); font-weight: 600; }
.post-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { display: inline-block; padding: 2px 8px; background: var(--bg-secondary); border-radius: 4px; font-size: 0.7rem; color: var(--text-secondary); border: 1px solid var(--border); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000; opacity: 0; visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto;
    box-shadow: var(--shadow-hover); transform: translateY(20px); transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }

.modal-close {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--bg-secondary); font-size: 1.2rem; color: var(--text-secondary);
    transition: background var(--transition);
}
.modal-close:hover { background: var(--border); }

/* ===== BREADCRUMBS ===== */
.breadcrumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.85rem; margin-bottom: 16px; }
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { color: var(--text-secondary); }
.breadcrumbs .current { color: var(--text); font-weight: 600; }

/* ===== PAGE HERO ===== */
.page-hero { padding: 40px 0 24px; margin-bottom: 24px; }
.page-hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.page-hero p { color: var(--text-secondary); font-size: 1rem; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 32px; }
.pagination button {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text); font-weight: 600; transition: all var(--transition);
}
.pagination button:hover, .pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== COMMENT ===== */
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-weight: 700; font-size: 0.9rem; }
.comment-time { font-size: 0.75rem; color: var(--text-secondary); }
.comment-text { font-size: 0.9rem; line-height: 1.5; }
.comment-actions { margin-top: 6px; display: flex; gap: 12px; }
.comment-actions button { background: none; color: var(--text-secondary); font-size: 0.8rem; padding: 2px 0; transition: color var(--transition); }
.comment-actions button:hover { color: var(--primary); }

/* ===== ALERTS ===== */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-danger { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-warning { background: #fff8e1; color: #e65100; border: 1px solid #ffcc80; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
[data-theme="dark"] .alert-success { background: #1b3a1e; border-color: #2e7d32; }
[data-theme="dark"] .alert-danger { background: #4a1520; border-color: #c62828; }
[data-theme="dark"] .alert-warning { background: #3e2700; border-color: #e65100; }
[data-theme="dark"] .alert-info { background: #1a3a5c; border-color: #1565c0; }

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: var(--radius-sm); color: #fff; font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-hover); animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards; max-width: 360px; }
.toast-success { background: var(--success); }
.toast-danger { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ===== PROFILE ===== */
.profile-header { display: flex; align-items: center; gap: 24px; margin-bottom: 32px; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 800; flex-shrink: 0; }
.profile-info h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.profile-info p { color: var(--text-secondary); font-size: 0.9rem; }
.profile-stats { display: flex; gap: 24px; margin-top: 10px; }
.profile-stat { text-align: center; }
.profile-stat .num { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.profile-stat .label { font-size: 0.75rem; color: var(--text-secondary); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 10px 18px; font-weight: 600; font-size: 0.9rem; color: var(--text-secondary); background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== ADMIN ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { padding: 20px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); text-align: center; }
.stat-card .stat-number { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== TABLE ===== */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background: var(--bg-secondary); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; color: var(--text-secondary); }

/* ===== SEARCH BAR ===== */
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; margin-bottom: 20px; }
.search-bar input { flex: 1; border: none; background: transparent; padding: 10px 14px; }
.search-bar input:focus { box-shadow: none; }
.search-bar button { padding: 10px 18px; border-radius: var(--radius-sm); background: var(--primary); color: #fff; font-weight: 600; }

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* ===== DROPDOWN ===== */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover); padding: 6px; z-index: 1100; display: none; animation: dropIn 0.25s ease;
}
.dropdown-menu.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; color: var(--text); font-size: 0.9rem; transition: background var(--transition); width: 100%; background: none; text-align: left; border: none; cursor: pointer; }
.dropdown-item:hover { background: var(--bg-secondary); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .empty-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 20px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

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

/* ===== HELPER CLASSES ===== */
.hide-small-text {
display: inline;
}

@media (max-width: 480px) {
.hide-small-text {
display: none;
}
}

/* ===== RESPONSIVE — ИСПРАВЛЕННЫЙ ===== */

/* Большие экраны — всё видно */
@media (min-width: 1025px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .mobile-menu-btn {
        display: none;
    }
}

/* Планшеты */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .mobile-menu-btn {
        display: none;
    }

    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Мобильные — только здесь прячем sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-hover);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        flex-direction: column;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .page-hero h1 {
        font-size: 1.5rem;
    }

    .modal {
        width: 95%;
        padding: 18px;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-select {
        width: 100%;
        min-width: unset;
    }

    .header-controls .hide-tablet {
        display: none;
    }

    .lang-btn .lang-code {
        display: none;
    }

    .header-logo {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 0 12px;
        gap: 4px;
    }

    .header-controls {
        gap: 4px;
    }

    .header-logo {
        font-size: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .header-theme-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .lang-btn {
        padding: 6px 10px;
        min-height: 36px;
    }

    .header-avatar-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .header { padding: 0 12px; }
    .header-logo { font-size: 1.3rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
/* ===== CUSTOM DROPDOWN (замена <select>) ===== */
.custom-select {
    position: relative;
    min-width: 160px;
    user-select: none;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 46px;
    transition: all var(--transition);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.08);
}

.custom-select-trigger:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.12);
    transform: translateY(-1px);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.12), 0 4px 12px rgba(211, 47, 47, 0.1);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-trigger .cs-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-trigger .cs-arrow {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
    color: var(--primary);
    font-size: 0.7rem;
    flex-shrink: 0;
}

.custom-select.open .cs-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1100;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    animation: csDropIn 0.2s ease;
}

.custom-select.open .custom-select-dropdown {
    display: block;
}

@keyframes csDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-select-dropdown::-webkit-scrollbar {
    width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.cs-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.cs-option:hover {
    background: rgba(211, 47, 47, 0.06);
    border-left-color: var(--primary-light);
    padding-left: 20px;
}

.cs-option.selected {
    background: rgba(211, 47, 47, 0.1);
    color: var(--primary);
    font-weight: 700;
    border-left-color: var(--primary);
}

.cs-option .cs-opt-check {
    margin-left: auto;
    color: var(--primary);
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.cs-option.selected .cs-opt-check {
    opacity: 1;
}

.cs-option-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.cs-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.cs-search input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.85rem;
    background: var(--bg-secondary);
}

.cs-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(211,47,47,0.1);
}

.cs-no-results {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== FILTER ROW LAYOUT ===== */
.filter-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .custom-select {
        width: 100%;
        min-width: unset;
    }

    .filter-row {
        flex-direction: column;
    }
}