/* Bar */
.top-bar { position: fixed; top: 0; left: 0; width: 100%; height: 60px; display: flex; justify-content: space-between; align-items: center; padding: 0 16px; z-index: 100; background: var(--surface); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-left { display: flex; align-items: center; gap: 12px; }
.nav-btn { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text-main); cursor: pointer; }
.avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 1px solid var(--border); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Card bài viết */
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: 0.3s; cursor: pointer; }
.card-img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.card-info { padding: 10px; display: flex; flex-direction: column; gap: 4px; text-align: center; }
.card-info h3 { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info p { font-size: 0.65rem; color: var(--text-sub); line-height: 1.3; height: 2.6em; overflow: hidden; }

/* Nút Chi tiết  */
.btn { margin: 6px auto 0; padding: 4px 12px; font-size: 0.6rem; color: var(--accent) !important; border: 1px solid var(--accent); border-radius: 20px; text-transform: uppercase; font-weight: 700; width: fit-content; }
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card:hover .btn { background: var(--accent); color: #fff !important; }

/* Overlay & Drawer */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: none; z-index: 1000; backdrop-filter: blur(2px); }
.overlay.show { display: block; }

.drawer.left {
    position: fixed; top: 0; left: 0; width: 280px; height: 100%;
    background: #0b0b0c;
    z-index: 2000;
    transform: translateX(-100%); transition: transform 0.4s ease;
    border-right: 1px solid var(--border); border-radius: 0 16px 16px 0;
    display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }

.menu-header { padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.avatar-mini { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 1px solid var(--border); }
.avatar-mini img { width: 100%; height: 100%; object-fit: cover; }
.close-btn-mini { font-size: 20px; cursor: pointer; color: var(--text-sub); background: none; border: none; }

.menu-links { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; font-size: 0.9rem; border:none; background:none; color:inherit; text-align:left; width: 100%; }
.menu-item:hover { background: var(--surface); }
.divider { border: none; border-top: 1px solid var(--border); margin: 10px 15px; }

/* Sub Panel */
.settings-sub { padding: 10px; background: rgba(255,255,255,0.03); border-top: 1px solid var(--border); }
.settings-sub.hidden { display: none; }
.setting { padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.select { padding: 4px 8px; border-radius: 6px; background: #1c1c1e; border: 1px solid var(--border); color: var(--text-main); }
.menu-footer { padding: 20px; text-align: center; font-size: 0.75rem; color: var(--text-sub); }

/* Viewer - Cửa sổ nổi */
.viewer { 
    position: fixed; 
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    display: flex;
    align-items: center; justify-content: center; 
    z-index: 1500;
}

.viewer-window {
    pointer-events: auto;
    width: 90%; max-width: 450px;
    max-height: 75vh; 
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px; 
    display: flex; flex-direction: column;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50, -50);
    overflow: hidden;
}

/* Thanh tiêu đề (Visual) */
.viewer-header {
    padding: 14px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    cursor: move;
}

.viewer-title { font-size: 0.85rem; font-weight: 600; opacity: 0.8; }

.close-btn-modal { 
    font-size: 18px; color: var(--text-sub); 
    background: none; border: none; cursor: pointer; transition: 0.2s;
}
.close-btn-modal:hover { color: #ff5f56; }

/* Nội dung bên trong bảng */
.viewer-content { 
    padding: 24px; overflow-y: auto; flex: 1; 
    text-align: center; line-height: 1.6;
}

.viewer-content h1 { font-size: 1.3rem; margin-bottom: 12px; }
.viewer-content p { font-size: 0.95rem; margin-bottom: 10px; }
.viewer-content img { border-radius: 12px; margin: 10px 0; max-width: 100%; }

/* Ẩn viewer khi chưa gọi */
.viewer.hidden { display: none; }

/* Switch */
.switch { position: relative; width: 34px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #555; border-radius: 20px; transition: 0.3s; cursor: pointer; }
.slider::before { content: ""; position: absolute; width: 12px; height: 12px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }

@media (max-width: 480px) {
    .viewer { background: none; }
    .viewer-window { width: 95%; max-height: 80vh; }
}
