@font-face {
  font-family: 'Giaothong2';
  src: url(fonts/giaothong2.ttf) format('truetype');
}

:root {
  --card-bg: #1e1e1e;
  --card-border: #2e2e2e;
  --accent-color: #00ff9d;
  --text-muted: #a0a0a0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* KHÓA CỨNG TOÀN BỘ TRANG WEB - KHÔNG CHO SCROLL TRANG CHÍNH */
html, body {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden; /* Cấm trình duyệt xuất hiện scrollbar tổng */
  font-family: 'Giaothong2', sans-serif;
  background-color: #121212;
  background-image: radial-gradient(#262626 1px, transparent 1px);
  background-size: 20px 20px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
}

/* HEADER CỐ ĐỊNH CHIỀU CAO */
header {
  width: 100%;
  height: 60px;
  background-color: rgba(30, 30, 30, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0; /* Không cho header bị co lại */
}

.nav-container {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 16px;
  width: auto;
}

.header-status {
  font-size: 13px;
  color: var(--text-muted);
  background: #2a2a2a;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
}

/* KHU VỰC CHÍNH: TỰ ĐỘNG TÍNH CHIỀU CAO CÒN LẠI */
.delivery-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  flex: 1; /* Chiếm trọn phần chiều cao còn lại của màn hình */
  height: calc(100vh - 60px);
  min-height: 0; /* Cho phép con co giãn đúng chuẩn Grid */
}

.bento-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Bắt buộc để không bị dãn khung */
}

/* CỘT TRÁI (SIDEBAR) */
.file-sidebar {
  height: 100%;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0; /* Giữ nguyên header của sidebar */
}

.sidebar-header h2 {
  font-size: 16px;
  color: var(--accent-color);
}

/* VÙNG CHỨA CÓ SCROLLBAR DUY NHẤT TRÊN WEB */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto; /* Bật cuộn riêng tại đây */
  padding-right: 6px;
  will-change: scroll-position;
  contain: layout style paint;
}

/* Custom thanh Scrollbar riêng bên trái cho đẹp */
.file-list::-webkit-scrollbar {
  width: 6px;
}
.file-list::-webkit-scrollbar-track {
  background: #121212;
  border-radius: 4px;
}
.file-list::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 4px;
}
.file-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: #121212;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0; /* Không cho item bị đè xẹp */
  contain: content; /* Giúp browser không cần tính toán lại cả trang khi hover item này */
  will-change: transform, border-color;
  transform: translateZ(0); /* Bật tăng tốc phần cứng GPU */
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.file-item:hover {
  border-color: #555;
}

.file-item.active {
  border-color: var(--accent-color);
  background: #1a2822;
}

.thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  image-rendering: -webkit-optimize-contrast;
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.file-name {
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CỘT PHẢI (PREVIEW AREA) */
.preview-stage {
  height: 100%;
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

#preview-filename {
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.preview-box {
  flex: 1;
  background: #121212;
  border: 2px dashed var(--card-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 16px;
  min-height: 0;
  height: 100%; /* Thêm height 100% để ép flex item cố định */
}

#main-preview {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}
/* BUTTONS */
.action-btn {
  padding: 6px 12px;
  background: #2a2a2a;
  border: 1px solid var(--card-border);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: 0.2s;
}

.action-btn:hover {
  background: #333;
  color: var(--accent-color);
}

.action-btn-accent {
  padding: 8px 14px;
  background: var(--accent-color);
  color: #000;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  font-size: 13px;
  transition: 0.2s;
}

.action-btn-accent:hover {
  opacity: 0.9;
}