/* ----------------------- 01. Bố cục: danh sách video + hạn mức ----------------------- */
.uf-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  margin-top: 30px;
  align-items: start;
}

.uf-card {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.uf-title {
  margin: 0 0 4px;
  font-size: 17px;
  color: #222;
}

.uf-subtitle {
  margin: 0;
  font-size: 13px;
  color: #888;
}

/* ----------------------- 02. Danh sách video ----------------------- */
.uf-library-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.uf-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.uf-search {
  flex: 1;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.uf-search:focus {
  outline: none;
  border-color: #4a5cf0;
}

.uf-count {
  font-size: 13px;
  color: #888;
}

.uf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.uf-video {
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  background-color: #fff;
  transition: box-shadow 0.2s;
}

.uf-video:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.uf-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: none;
  background-color: #1e1e1e;
  cursor: pointer;
}

.uf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.uf-thumb .uf-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  opacity: 0;
  background-color: rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s;
}

.uf-thumb:hover .uf-play {
  opacity: 1;
}

.uf-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 12px;
}

.uf-video-body {
  padding: 10px 12px 12px;
}

.uf-video-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 500;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uf-video-meta {
  font-size: 12px;
  color: #888;
}

.uf-warning {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  background-color: #fff4e5;
  color: #b26a00;
  font-size: 12px;
}

.uf-video-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.uf-small-btn {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #fff;
  color: #333;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.uf-small-btn:hover {
  background-color: #f5f5f5;
}

.uf-small-btn.danger {
  border-color: #e57373;
  color: #d32f2f;
}

.uf-small-btn.danger:hover {
  background-color: #fdecea;
}

/* Chưa có video */
.uf-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 0;
  text-align: center;
}

.uf-empty img {
  width: 140px;
  opacity: 0.85;
}

.uf-empty p {
  margin: 0;
  font-size: 14px;
  color: #888;
  line-height: 1.6;
}

/* ----------------------- 03. Hạn mức ----------------------- */
.uf-plan {
  margin: 4px 0 18px;
  font-size: 14px;
  color: #555;
}

.uf-meter {
  margin-bottom: 14px;
}

.uf-meter-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  color: #555;
}

.uf-meter-bar {
  height: 8px;
  border-radius: 4px;
  background-color: #eceef8;
  overflow: hidden;
}

.uf-meter-bar > div {
  width: 0;
  height: 100%;
  border-radius: 4px;
  background-color: #4a5cf0;
  transition: width 0.3s;
}

.uf-meter-bar > div.full {
  background-color: #d32f2f;
}

.uf-upgrade-btn {
  display: block;
  margin: 18px 0;
  padding: 9px 0;
  border-radius: 6px;
  background-color: #4a5cf0;
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
}

.uf-upgrade-btn:hover {
  background-color: #3846d4;
}

.uf-notes {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #666;
  line-height: 1.55;
}

.uf-notes li {
  margin-bottom: 6px;
}

/* ----------------------- 04. Nút chung ----------------------- */
.uf-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 6px;
  background-color: #4a5cf0;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s;
}

.uf-primary-btn:hover {
  background-color: #3846d4;
}

.uf-primary-btn:disabled {
  background-color: #a9b1f5;
  cursor: not-allowed;
}

.uf-primary-btn.danger {
  background-color: #d32f2f;
}

.uf-primary-btn.danger:hover {
  background-color: #b71c1c;
}

.uf-secondary-btn {
  padding: 9px 18px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  color: #333;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

/* ----------------------- 05. Modal ----------------------- */
.uf-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 16px 16px;
  background-color: rgba(0, 0, 0, 0.45);
  z-index: 20000; /* Trên header (z-index 10000) */
  overflow-y: auto;
}

.uf-modal-overlay.open {
  display: flex;
}

.uf-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  background-color: #fff;
  border-radius: 10px;
  padding: 22px 24px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.uf-modal-wide {
  max-width: 900px;
}

.uf-modal h3 {
  margin: 0 0 16px;
  padding-right: 24px;
  font-size: 19px;
  color: #222;
  overflow-wrap: anywhere;
}

.uf-modal p {
  margin: 0 0 14px;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

.uf-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #999;
  cursor: pointer;
}

.uf-modal-close:hover {
  color: #333;
}

.uf-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

#uf-player {
  display: block;
  width: 100%;
  max-height: 70vh;
  border-radius: 6px;
  background-color: #000;
}

.uf-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 16px;
}

.uf-tab {
  padding: 8px 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 14px;
  font-family: inherit;
  color: #555;
  cursor: pointer;
}

.uf-tab.active {
  color: #3f51b5;
  border-bottom-color: #3f51b5;
}

.uf-tab-panel {
  display: none;
}

.uf-tab-panel.active {
  display: block;
}

.uf-field {
  margin-bottom: 14px;
}

.uf-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #333;
}

.uf-field input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.uf-field input:focus {
  outline: none;
  border-color: #3f51b5;
}

/* Vùng kéo thả file */
.uf-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 16px;
  border: 2px dashed #c5cae9;
  border-radius: 10px;
  background-color: #f8f9ff;
  color: #666;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.uf-dropzone strong {
  font-size: 15px;
  color: #333;
}

.uf-dropzone-icon {
  font-size: 34px;
}

.uf-dropzone:hover,
.uf-dropzone.dragover {
  border-color: #4a5cf0;
  background-color: #eef0fe;
}

/* Danh sách file đang tải lên */
.uf-queue {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.uf-queue-item {
  padding: 10px 0;
  border-top: 1px solid #f0f0f0;
  font-size: 13px;
}

.uf-queue-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.uf-queue-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #333;
}

.uf-queue-status {
  flex-shrink: 0;
  color: #888;
}

.uf-queue-item.done .uf-queue-status { color: #2e7d32; }
.uf-queue-item.error .uf-queue-status { color: #d32f2f; }

.uf-progress {
  height: 6px;
  border-radius: 3px;
  background-color: #eceef8;
  overflow: hidden;
}

.uf-progress > div {
  width: 0;
  height: 100%;
  background-color: #4a5cf0;
  transition: width 0.2s;
}

.uf-queue-item.done .uf-progress > div { background-color: #2e7d32; }
.uf-queue-item.error .uf-progress > div { background-color: #d32f2f; }

/* ----------------------- 06. Thông báo nhanh (toast) ----------------------- */
.uf-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20001;
}

.uf-toast {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 6px;
  background-color: #323232;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.uf-toast.success { background-color: #2e7d32; }
.uf-toast.error   { background-color: #c62828; }

/* ----------------------- 07. Màn hình nhỏ ----------------------- */
/* ----------------------- File trên VPS ----------------------- */
.uf-upgrade-alt {
  margin-top: 8px;
  background-color: #fff;
  color: #4a5cf0;
  border: 1px solid #4a5cf0;
}

/* Cột trái: danh sách video + file trên VPS */
.uf-main {
  min-width: 0;
}

/* Thẻ file trên VPS (video tải từ link / bản sao trên VPS) */
.uf-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.uf-in-use {
  flex: 1;
  padding: 5px 0;
  font-size: 12px;
  color: #2e7d32;
  text-align: center;
}

@media (max-width: 1000px) {
  .uf-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .uf-library-head {
    flex-direction: column;
  }

  .uf-card {
    padding: 16px;
  }
}
