@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

button {
    cursor: pointer;
    color: var(--main-text);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans),system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Be Vietnam Pro",sans-serif;
    font-size: 0.9em;
    line-height: 1.5;
    color: color-mix(in oklab,var(--color-slate-700)90%,transparent);    
}

input {
    color: color-mix(in oklab,var(--color-slate-700)90%,transparent);   
    font-family: var(--font-sans),system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Be Vietnam Pro",sans-serif;
}

input::placeholder {
    color: color-mix(in oklab,var(--color-slate-700)90%,transparent);   
    opacity: 0.6; /* Làm mờ nhẹ để trông tinh tế hơn */
    font-family: var(--font-sans),system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Be Vietnam Pro",sans-serif;
}

/* 2. Layout Structure */
.app-wrapper {
    display: flex;
    width: 100%;
}

/* 3. Sidebar Trái (Danh mục tàng thư) */
.sidebar {
    width: 300px;
    background-color: var(--bg-primary);
    border-right: var(--border-default);
    display: flex;
    flex-direction: column;
    padding: 1.3em;
    flex-shrink: 0;
    box-shadow: var(--box-left);
    min-height: 100vh;
    overflow: hidden !important;
}

.sidebar-top {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar-top img {
    width: auto;
    height: 60px;
    display: block;
}

.sidebar-top div {
    flex: 1;
    line-height: 1.3;
}

.sidebar-top .brand {
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
    margin-left: 0.2em;
    width: 90%;
}

.sidebar-top .brand:first-child {
    padding-right: 1em;
}

.sidebar-top .brand:last-child {
    padding-left: 1em;
}

.brand {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--header-text);
    letter-spacing: 2px;
}

.sidebar, .right-panel {
    position: sticky;
    top: 0;
    height: 100vh; /* Giữ sidebar cao bằng màn hình */
}

.side-search {
    width: 100%;
    border: none;
    background-color: var(--bg-third);
    box-shadow: var(--search-shadow);
    border-radius: var(--radius-md);
    outline: none;
    padding: 0.6em 0.9em;
    margin-bottom: 1em;
    font-size: 0.8em;
}

.nav-tree {
    flex-grow: 1;
    display: block !important;

    /overflow-y: auto !important; /* Luôn sẵn sàng scroll dọc */
    overflow-x: hidden !important; /* Cấm tuyệt đối scroll ngang */
    scrollbar-width: thin;
    scrollbar-color: var(--bg-primary) transparent;*/
}

.nav-tree span {
    padding-left: 0.6em;
}

/* Tùy chỉnh thanh cuộn siêu mỏng */
.nav-tree::-webkit-scrollbar { width: 1px; }
.nav-tree::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 10px; }

.nav-item {
    padding: 6px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    transition: all 0.2s;
    white-space: nowrap;

    display: block;
    overflow: hidden;
    text-overflow: ellipsis; /* Đây là chìa khóa để không bị scroll ngang */
}

.nav-item:hover {
    background-color: rgba(144, 157, 171, 0.12);
}

.nav-sub {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border-default);
/*    margin-top: 4px;*/
/*    margin-bottom: 4px;*/
}

.folder { font-weight: 600; color: var(--text-white); }

/* 4. Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    min-height: 100vh;
}

.main-nav {
    padding: 12px 24px;
/*    box-shadow: var(--border-bottom);*/
    border-bottom: var(--border-default);
    background-color: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0.5em;
    position: sticky;
    top: 0;
}

.main-nav div {
/*    display: flex;*/
/*    justify-content: center;*/
/*    align-items: center;*/
    min-height: 30px; min-width: 30px; 
}

.main-nav div {
    min-height: 30px; min-width: 30px; 
}

.main-nav img {
    height: 30px;       /* Bắt buộc cao bằng div cha */
    width: 100%;        /* Phủ kín chiều ngang */
    object-fit: cover;  /* Quan trọng: Giữ tỉ lệ ảnh, cắt bớt phần thừa thay vì làm méo ảnh */
    display: block;
    max-height: 30px;
}
.main-nav i {
    font-size: 1.2em;
}

.nav-pointer{
    cursor: pointer;
}

.search-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-third);
    border-radius: var(--radius-md);
    padding: 0.3em 0.8em;
    width: 100%;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.2s;
    justify-content: flex-start !important;
    box-shadow: var(--search-shadow);
    font-size: 0.8em;
}

.search-bar span {
    opacity: 0.6;
}

#btnSetting{
    display: flex;
    justify-content: flex-end;
    align-items: center;    
}

.content-body {
    padding: 1em;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
}

.btn-send {
    background-color: var(--accent-green);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* 6. Feed Cards (Modern Card) */
.feed-card {
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    padding: 1.3em;
    margin-bottom: 1.8em;
    background-color: var(--bg-secondary);
}

.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5em }
.repo-link { color: var(--header-text); font-weight: 600; text-decoration: none; }
.btn {
    background-color: var(--bg-third);
    border: var(--border-default);
    border-radius: var(--radius-sm);
    padding: 0.5em 1em;
}

.btn > i {
    margin-right: 0.1em;
}

.btn-yellow {
    color: var(--yellow-light);
    border: none;
    font-weight: bold;
    box-shadow: var(--card-shadow);
}

.btn-red {
    color: var(--red-light);
    border-color: var(--red-light);
}

.btn-gray {
    color: var(--gray-light);
}

.btn-green {
    color: var(--green-light);
    border-color: var(--green-light);
}

.card-meta {
    margin-top: 16px;
    font-size: 0.9em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 1em;
}

.card-meta > div {
    flex: 1;
}

/* 7. Sidebar Phải */
.right-panel {
    width: 320px;
/*    padding: 32px 20px;*/
    padding: 2em 1.3em 2em 0;
    flex-shrink: 0;
}

.news-card {
    background-color: var(--bg-secondary);
    border: var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.3em;
    box-shadow: var(--box-left);
}

.news-card h3 {
    border-bottom: var(--border-default);
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

.news-card ul { list-style: none; }
.news-card li {
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 2px solid var(--accent-mint);
}

.news-card p { margin: 4px 0 0 0; color: var(--text-primary); }

/* 8. Modal Tìm Kiếm (Glassmorphism) */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
}

.modal-close {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-secondary);
    width: 45vw;
    border-radius: var(--radius-md);
    padding: 24px;
    z-index: 1001;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    margin-top: 5vh;
}

.modal-hints {
    font-size: 0.8em;
}

#modalInput {
    width: 100%;
    background-color: var(--bg-third);
    border: var(--border-default);
    padding: 0.6em 1.2em;
    border-radius: var(--radius-md);
    outline: none;
    margin-bottom: 1em;
}

.card-media {
    width: 100%;           /* Chiều rộng khối bao ngoài */
    height: 30em;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #010409; /* Nền tối để hợp với ảnh contain */
    border: 1px solid #30363d;
    border-radius: 12px;   /* Bo góc đồng bộ với feed card */
    overflow: hidden;      /* Cắt phần thừa nếu có */
    margin: 1em 0;
}

.card-media iframe{
    border: 1px solid #30363d;
    width:100%;
    height:300px;
}

.card-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;   /* Thu phóng ảnh nhưng giữ nguyên tỉ lệ, nằm gọn trong div */
    display: block;
}

.theme-change {
    display: flex;
/*    flex-direction: column;*/
    flex-wrap: wrap;
    gap: 1em;
}
.theme-change button {
    text-align: left;
    padding: 0.5em 0.3em;
    background-color: var(--bg-secondary);
    border: unset;
}
.theme-change button {
    border-bottom: 1px solid var(--header-text);
}
.theme-change button i {
    margin: 0 0.5em;
}
.screen-767 {
    display: none !important;
}
.screen-max {
    display: block !important;
}

.popup {
    margin: auto 0;
    padding: 1.3em;
}

.popup-title {
    display: flex;
    align-items: center;
}

.popup-title i {
    cursor: pointer;
    font-size: 1.2em;
}

.popup-title h2 {
    margin-bottom: 0 !important;
    flex: 1;
    margin-right: 0.5em;
    color: var(--text-muted);
}

.popup-content {
    padding: 1em;
    margin: 1em 0;
    color: var(--main-text) !important;
    height: 35vh;
    overflow-y: auto;
}
