/* ============================================================
   LAYOUT: шапка, сайдбар, основной контент
   ============================================================ */

/* --- Шапка --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-left h1 {
    font-size: 18px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.header-btn {
    color: #666;
    text-decoration: none;
    font-size: 18px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}
.header-btn:hover { background: #f0f0f0; }

.header-user {
    color: #888;
    font-size: 13px;
    margin: 0 8px;
}

.header-logout {
    font-size: 13px;
    color: #f44336;
    font-weight: 600;
}
.header-logout:hover { background: #ffebee; }

/* --- Гамбургер --- */
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #333;
    padding: 4px 8px;
    border-radius: 6px;
}
.hamburger:hover { background: #f0f0f0; }

/* --- Сайдбар --- */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    z-index: 200;
    transition: left 0.25s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar.open { left: 0; }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 15px;
    color: #666;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 4px 8px;
}
.sidebar-close:hover { color: #333; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
}

.sidebar-link {
    display: block;
    padding: 12px 24px;
    color: #444;
    text-decoration: none;
    font-size: 15px;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.sidebar-link:hover {
    background: #f5f5f5;
    border-left-color: #4CAF50;
}
.sidebar-link.active {
    background: #e8f5e9;
    border-left-color: #4CAF50;
    color: #2e7d32;
    font-weight: 600;
}

/* --- Оверлей сайдбара --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
}
.sidebar-overlay.active { display: block; }

/* --- Основной контент --- */
.main-content { min-height: calc(100vh - 60px); }

/* ============================================================
   АДАПТИВ
   ============================================================ */

@media (max-width: 768px) {
    .hamburger { display: block; }
    .header-left h1 { font-size: 15px; }
    .header-user { display: none; }
    .header-btn { font-size: 16px; padding: 6px 8px; }
    .container { padding: 0 12px; margin: 16px auto; }
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .stats { grid-template-columns: 1fr !important; }
    .header-right { gap: 4px; }
}

/* ============================================================
   ДЕСКТОП: сайдбар всегда виден
   ============================================================ */

@media (min-width: 769px) {
    .sidebar {
        left: 0;
        box-shadow: 1px 0 4px rgba(0,0,0,0.05);
        width: 240px;
    }
    .sidebar-header .sidebar-close { display: none; }
    .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 240px; }
    .header { margin-left: 240px; }
    .hamburger { display: none; }
}

/* ============================================================
   КОЛОКОЛЬЧИК УВЕДОМЛЕНИЙ
   ============================================================ */

.notif-filter {
    padding: 8px 16px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    color: #666;
}

.notif-filter label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.notif-filter input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

body.dark .notif-filter {
    border-bottom-color: #3a3a3a;
    color: #aaa;
}

.notif-wrapper {
    position: relative;
}

.notif-bell {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #f44336;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
    min-width: 16px;
    text-align: center;
}

.notif-dropdown {
    position: absolute;
    top: 42px;
    right: 0;
    width: 360px;
    max-width: 92vw;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    z-index: 300;
    overflow: hidden;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 14px;
}

.notif-mark-read {
    background: none;
    border: none;
    color: #4CAF50;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.notif-mark-read:hover {
    background: #e8f5e9;
}

.notif-list {
    max-height: 420px;
    overflow-y: auto;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: background 0.15s;
}
.notif-item:hover {
    background: #fafafa;
}
.notif-item:last-child {
    border-bottom: none;
}

.notif-item-unread {
    background: #f0f8f3;
}
.notif-item-unread:hover {
    background: #e8f5e9;
}

.notif-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.4;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.4;
}

.notif-text {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-word;
}

.notif-time {
    font-size: 11px;
    color: #999;
}

.notif-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* Тёмная тема */
body.dark .notif-dropdown {
    background: #2a2a2a;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
body.dark .notif-header {
    border-bottom-color: #3a3a3a;
    color: #e0e0e0;
}
body.dark .notif-item {
    border-bottom-color: #3a3a3a;
}
body.dark .notif-item:hover {
    background: #333;
}
body.dark .notif-item-unread {
    background: #1e3a1e;
}
body.dark .notif-item-unread:hover {
    background: #1e3a1e;
}
body.dark .notif-title { color: #e0e0e0; }
body.dark .notif-text { color: #aaa; }
body.dark .notif-time { color: #888; }
body.dark .notif-empty { color: #888; }
body.dark .notif-mark-read { color: #66bb6a; }
body.dark .notif-mark-read:hover { background: #1e3a1e; }