
/* AI CONTENT SALES ENGINE — WEB APP */

:root {
  font-family: "Segoe UI", Arial, sans-serif;
  color: #17243b;
  background: #f3f6fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-size: 14px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #101e38;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 26px 20px;
  border-bottom: 1px solid #ffffff20;
}

.brand-icon {
  background: linear-gradient(135deg, #16b8a6, #3875ff);
  width: 43px;
  height: 43px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: .5px;
}

.brand span {
  display: block;
  color: #9caeca;
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 2px;
}

.sidebar nav {
  padding: 16px 10px;
  overflow-y: auto;
  flex: 1;
}

.sidebar nav button {
  width: 100%;
  display: block;
  text-align: left;
  border: none;
  background: transparent;
  color: #b9c7df;
  padding: 14px 16px;
  margin-bottom: 5px;
  border-radius: 10px;
  transition: .2s;
}

.sidebar nav button:hover,
.sidebar nav button.active {
  background: #253d66;
  color: #fff;
}

.sidebar nav button.active {
  border-left: 3px solid #20c6a5;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid #ffffff20;
  display: grid;
  gap: 10px;
}

.sidebar-footer button {
  padding: 10px;
  border: 1px solid #ffffff35;
  color: #fff;
  background: transparent;
  border-radius: 8px;
}

/* MAIN */

.main {
  flex: 1;
  min-width: 0;
  padding: 28px;
  max-width: 1800px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
}

.topbar p {
  margin: 7px 0 0;
  color: #8290a5;
}

#menuBtn {
  display: none;
  border: 0;
  background: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 22px;
}

.account-badge {
  margin-left: auto;
  background: white;
  padding: 12px 18px;
  border-radius: 25px;
  box-shadow: 0 3px 14px #152a4810;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #16b985;
}

.page { display: none; }
.page.active { display: block; }

.page h2 {
  margin-top: 0;
  font-size: 22px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* CARDS */

.welcome-card {
  background: linear-gradient(115deg, #163866, #1765a0, #0da995);
  color: white;
  padding: 36px;
  border-radius: 18px;
  margin-bottom: 25px;
  box-shadow: 0 12px 30px #1e629b22;
}

.welcome-card h2 {
  font-size: 28px;
  max-width: 650px;
}

.welcome-card p {
  max-width: 600px;
  line-height: 1.8;
  color: #e0f5ff;
}

.panel {
  background: white;
  padding: 26px;
  border-radius: 15px;
  box-shadow: 0 4px 20px #203f6810;
  margin-bottom: 24px;
}

.panel h3 {
  font-size: 18px;
  margin-top: 0;
}

.panel > p {
  color: #697c96;
  line-height: 1.7;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 25px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 14px;
  box-shadow: 0 4px 18px #203f6810;
  min-width: 0;
}

.stat-card span {
  display: block;
  color: #71839b;
  margin-bottom: 15px;
}

.stat-card strong {
  font-size: 28px;
  color: #163e76;
  overflow-wrap: anywhere;
}

/* FORMS */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: block;
  font-weight: 600;
  margin: 16px 0;
}

.form-grid label {
  margin: 0;
}

input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 12px 14px;
  border: 1px solid #dce3ef;
  border-radius: 9px;
  background: #fff;
  color: #24334c;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2786e5;
  box-shadow: 0 0 0 3px #2786e51a;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

button.primary,
a.button.primary {
  border: 0;
  background: linear-gradient(120deg, #168eec, #13ad9c);
  color: white;
  padding: 13px 22px;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
}

button.secondary,
a.button.secondary {
  background: #edf4ff;
  border: 1px solid #cbdcf7;
  color: #1c5b9c;
  padding: 12px 20px;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
}

button.primary:hover,
button.secondary:hover {
  filter: brightness(.96);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* VIDEO STUDIO */

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border: 2px solid #e3eaf5;
  border-radius: 12px;
  cursor: pointer;
  margin: 0;
}

.mode-card:has(input:checked) {
  border-color: #13ac9a;
  background: #f0fffc;
}

.mode-card strong {
  font-size: 18px;
  color: #16518a;
}

.mode-card span {
  font-weight: 400;
  color: #667c96;
}

.mode-card input {
  align-self: flex-start;
}

#videoPreview {
  background: #142238;
  border-radius: 12px;
  min-height: 220px;
}

/* MEDIA AND LISTS */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.media-grid img,
.media-grid video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
}

#productList,
#videoLibrary,
#fanpageList {
  margin-top: 20px;
}

.list-card {
  border: 1px solid #e4eaf3;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
}

.list-card h3 {
  margin: 0 0 10px;
}

.list-card p {
  color: #71839b;
  line-height: 1.6;
}

.empty {
  padding: 36px;
  text-align: center;
  color: #91a0b4;
  background: #f8faff;
  border: 1px dashed #dce5f0;
  border-radius: 12px;
}

.hint {
  font-size: 13px;
  color: #8191a7;
  line-height: 1.7;
}

#notice {
  display: none;
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: 9px;
  background: #eaf8f1;
  color: #126847;
}

#notice.error {
  background: #fff0f0;
  color: #b42318;
}

#notice:not(:empty) {
  display: block;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 260px;
    z-index: 100;
    transition: left .25s ease;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 15px 0 60px #0005;
  }

  .main {
    padding: 16px;
    width: 100%;
  }

  #menuBtn {
    display: block;
  }

  .topbar {
    gap: 12px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar p {
    font-size: 12px;
  }

  .account-badge {
    padding: 8px 12px;
    font-size: 11px;
  }

  .welcome-card {
    padding: 25px;
  }

  .welcome-card h2 {
    font-size: 23px;
  }

  .panel {
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }

  .stats {
    gap: 10px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card strong {
    font-size: 23px;
  }
}

@media (max-width: 400px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .topbar p {
    display: none;
  }
}

/* FIREBASE AUTHENTICATION */

.auth-screen {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(
    135deg,
    #101e38,
    #1a5388,
    #0caa96
  );
}

.auth-screen[hidden],
.app[hidden] {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: #fff;
  padding: 38px;
  border-radius: 20px;
  box-shadow: 0 20px 65px #0003;
}

.auth-logo {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #2785ee, #0bb49c);
  color: white;
  font-size: 23px;
  font-weight: 800;
  margin-bottom: 22px;
}

.auth-card h1 {
  font-size: 25px;
  margin: 0;
  color: #142743;
}

.auth-subtitle {
  color: #75859b;
  line-height: 1.7;
  margin-bottom: 26px;
}

.auth-card label {
  display: block;
  margin-bottom: 18px;
}

.auth-submit {
  width: 100%;
  margin-top: 12px;
}

#authMessage {
  min-height: 20px;
  font-size: 13px;
  line-height: 1.6;
}

.auth-switch {
  text-align: center;
  margin: 24px 0 0;
  color: #73839a;
}

#authToggle {
  border: 0;
  background: transparent;
  color: #147de0;
  font-weight: 700;
  padding: 5px;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 26px 22px;
  }
}

/* Nút hiện/ẩn mật khẩu nằm trong ô nhập */

.auth-password-group {
  margin-top: 18px;
}

.auth-password-group > label {
  display: block;
  margin-bottom: 9px;
  font-weight: 600;
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field #authPassword {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding-right: 52px;
}

.password-field .toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);

  display: flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;

  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 19px;
  cursor: pointer;
}

.password-field .toggle-password:hover {
  background: #f1f5f9;
}

/* =====================================================
   PRODUCT MEDIA UPLOAD + PREVIEW
   ===================================================== */

.product-media-upload {
  margin-top: 8px;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.product-media-upload input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #ffffff;
  box-sizing: border-box;
}

.product-media-upload .hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #64748b;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.media-preview-item {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

.media-preview-item img,
.media-preview-item video {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #0f172a;
}

.media-preview-name {
  padding: 8px 10px;
  font-size: 11px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



/* THƯ VIỆN VIDEO - DANH SÁCH HÀNG NGANG */

.video-library-panel {
  overflow: hidden;
}

.video-library-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.video-library-heading h3 {
  margin: 0 0 6px;
}

.video-library-heading .hint {
  margin: 0;
}

.video-library-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.video-library-list .video-library-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.video-library-list .video-library-item:hover {
  border-color: #b8c7e8;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.06);
}

.video-library-list .video-library-thumb {
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #111827;
}

.video-library-list .video-library-thumb video,
.video-library-list .video-library-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-library-list .video-library-info {
  flex: 1;
  min-width: 0;
}

.video-library-list .video-library-name {
  margin: 0 0 7px;
  overflow: hidden;
  color: #172033;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow-wrap: anywhere;
}

.video-library-list .video-library-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.video-library-list .video-library-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #15803d;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.video-library-list .video-library-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 6px;
}

.video-library-list .video-library-actions button,
.video-library-list .video-library-actions a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 36px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.video-library-list .video-library-actions button:hover,
.video-library-list .video-library-actions a:hover {
  background: #f1f5f9;
}

.video-library-list .video-library-actions .video-delete-btn {
  color: #dc2626;
  border-color: #fee2e2;
}

.video-library-list .video-library-actions .video-delete-btn:hover {
  background: #fef2f2;
}

.video-library-list .video-library-empty {
  padding: 28px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  text-align: center;
  font-size: 14px;
}

@media (max-width: 640px) {
  .video-library-list {
    gap: 8px;
  }

  .video-library-list .video-library-item {
    gap: 9px;
    padding: 9px;
  }

  .video-library-list .video-library-thumb {
    flex-basis: 82px;
    width: 82px;
  }

  .video-library-list .video-library-name {
    font-size: 13px;
  }

  .video-library-list .video-library-meta {
    gap: 3px 8px;
    font-size: 11px;
  }

  .video-library-list .video-library-actions {
    gap: 4px;
  }

  .video-library-list .video-library-actions button,
  .video-library-list .video-library-actions a {
    min-width: 32px;
    min-height: 32px;
    padding: 5px;
    font-size: 12px;
  }
}





/* =========================================
   ACSE - THƯ VIỆN VIDEO THÀNH PHẨM
   ========================================= */

.video-library-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.video-library-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.video-library-item:hover {
  border-color: #b7c9e8;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}


.video-library-thumb {
  position: relative;
  display: block;
  flex: 0 0 104px;
  width: 104px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 9px;
  background: #111827;
}

/* Video chiếm toàn bộ khung thumbnail */
.video-library-thumb .video-library-thumb-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border: 0;
}

/* Nút phát luôn nằm chính giữa khung */
.video-library-thumb .video-library-thumb-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  color: #fff;
  background: rgba(15, 23, 42, 0.65);
  font-size: 20px;
  line-height: 1;
  box-sizing: border-box;
  pointer-events: none;
}


.video-library-thumb-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  font-size: 14px;
  padding-left: 2px;
  box-sizing: border-box;
}

.video-library-info {
  flex: 1;
  min-width: 0;
}

.video-library-name {
  margin: 0 0 7px;
  color: #172033;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
}

.video-library-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.5;
}

.video-library-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #15803d;
  font-weight: 600;
  white-space: nowrap;
}

.video-library-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.video-library-status-other {
  color: #b45309;
}

.video-library-status-other .video-library-status-dot {
  background: #f59e0b;
}

.video-library-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.video-library-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #ffffff;
  color: #334155;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.video-library-actions button:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.video-library-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.video-library-actions .video-view-btn {
  color: #2563eb;
}

.video-library-actions .video-download-btn {
  color: #15803d;
}

.video-library-actions .video-delete-btn {
  color: #dc2626;
  border-color: #fee2e2;
}

.video-library-actions .video-delete-btn:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fecaca;
}

.video-library-empty {
  padding: 28px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: #64748b;
  text-align: center;
}

.video-library-empty p {
  margin-bottom: 0;
  font-size: 13px;
}

@media (max-width: 640px) {
  .video-library-item {
    gap: 9px;
    padding: 9px;
  }

  .video-library-thumb {
    flex-basis: 72px;
    width: 72px;
  }

  .video-library-thumb-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .video-library-name {
    font-size: 12px;
  }

  .video-library-meta {
    gap: 3px 7px;
    font-size: 10px;
  }

  .video-library-actions {
    gap: 4px;
  }

  .video-library-actions button {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    font-size: 14px;
  }
}



/* ACSE - THƯ VIỆN VIDEO: GIAO DIỆN DỄ NHÌN, DỄ BẤM */

#videoLibraryList {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

#videoLibraryList .video-library-item {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 116px;
  padding: 16px;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #fff;
  box-sizing: border-box;
}

#videoLibraryList .video-library-thumb {
  flex: 0 0 150px;
  width: 150px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
}

#videoLibraryList .video-library-thumb-icon {
  width: 44px;
  height: 44px;
  font-size: 20px;
}

#videoLibraryList .video-library-info {
  flex: 1;
  min-width: 0;
}

#videoLibraryList .video-library-name {
  margin: 0 0 10px;
  color: #172033;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

#videoLibraryList .video-library-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  line-height: 1.6;
}

#videoLibraryList .video-library-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
}

#videoLibraryList .video-library-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid #dbe3ee;
  border-radius: 9px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ACSE - NÚT THAO TÁC VIDEO TO, RÕ, DỄ NHÌN */

#videoLibraryList .video-library-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

#videoLibraryList .video-library-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  min-width: 112px;
  min-height: 48px;
  padding: 12px 16px;

  border: 1px solid transparent;
  border-radius: 12px;

  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;

  cursor: pointer;
  transition:
    transform .15s ease,
    box-shadow .15s ease,
    background .15s ease;
}

/* XEM VIDEO */
#videoLibraryList .video-library-actions .video-view-btn {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

/* TẢI VIDEO */
#videoLibraryList .video-library-actions .video-download-btn {
  color: #fff;
  background: #15803d;
  border-color: #15803d;
}

/* XÓA VIDEO */
#videoLibraryList .video-library-actions .video-delete-btn {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

/* HIỆU ỨNG KHI RÊ CHUỘT */
#videoLibraryList .video-library-actions button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, .16);
}

#videoLibraryList .video-library-actions .video-view-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

#videoLibraryList .video-library-actions .video-download-btn:hover:not(:disabled) {
  background: #166534;
}

#videoLibraryList .video-library-actions .video-delete-btn:hover:not(:disabled) {
  background: #b91c1c;
}

/* NÚT BỊ VÔ HIỆU HÓA */
#videoLibraryList .video-library-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* MÀN HÌNH NHỎ */
@media (max-width: 760px) {
  #videoLibraryList .video-library-actions {
    width: 100%;
    gap: 8px;
  }

  #videoLibraryList .video-library-actions button {
    flex: 1 1 100px;
    min-width: 0;
    min-height: 48px;
    padding: 12px 10px;
    font-size: 14px;
  }
}


/* =========================================
   QUẢN LÝ FANPAGE - GIAO DIỆN
   Chỉ áp dụng cho cửa sổ Fanpage
========================================= */

#fanpages .fanpage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

#fanpages .fanpage-header > div:first-child {
  flex: 1;
  min-width: 240px;
}

#fanpages .fanpage-header h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

#fanpages .fanpage-header p {
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1.6;
}

#fanpages .fanpage-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

#fanpages .fanpage-stat-card {
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  min-width: 0;
}

#fanpages .fanpage-stat-label {
  display: block;
  margin-bottom: 12px;
  color: #64748b;
  font-size: 14px;
}

#fanpages .fanpage-stat-card strong {
  display: block;
  color: #1e293b;
  font-size: 28px;
  line-height: 1.3;
}

#fanpages .fanpage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

#fanpages .fanpage-search {
  flex: 1;
  min-width: 220px;
}

#fanpages .fanpage-search input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
}

#fanpages .fanpage-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#fanpages .fanpage-toolbar-actions select,
#fanpages .fanpage-toolbar-actions button {
  box-sizing: border-box;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font: inherit;
}

#fanpages .fanpage-toolbar-actions button {
  cursor: pointer;
}

#fanpages .fanpage-toolbar-actions button:hover {
  background: #f1f5f9;
}

#fanpages .fanpage-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

#fanpages .fanpage-list-header h3 {
  margin: 0;
}

#fanpages .fanpage-list-header .hint {
  margin: 0;
}

#fanpages #fanpageList {
  box-sizing: border-box;
  width: 100%;
  min-height: 220px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

#fanpages .fanpage-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 460px;
  min-height: 220px;
  margin: 0 auto;
  text-align: center;
}

#fanpages .fanpage-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e8f0fe;
  color: #1877f2;
  font-size: 30px;
  font-weight: 700;
}

#fanpages .fanpage-empty-state h3 {
  margin: 0;
  color: #1e293b;
}

#fanpages .fanpage-empty-state p {
  margin: 0;
  color: #64748b;
  line-height: 1.7;
}

#fanpages .fanpage-security-note {
  margin-top: 20px;
  line-height: 1.7;
}

/* TƯƠNG THÍCH MÀN HÌNH NHỎ */
@media (max-width: 768px) {
  #fanpages .fanpage-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #fanpages .fanpage-stat-card {
    padding: 16px;
  }

  #fanpages .fanpage-stat-card strong {
    font-size: 24px;
  }

  #fanpages .fanpage-toolbar {
    align-items: stretch;
  }

  #fanpages .fanpage-search {
    min-width: 100%;
  }

  #fanpages .fanpage-toolbar-actions {
    width: 100%;
  }

  #fanpages .fanpage-toolbar-actions select,
  #fanpages .fanpage-toolbar-actions button {
    flex: 1;
    min-width: 0;
  }

  #fanpages #fanpageList {
    padding: 16px;
  }
}




/* FACEBOOK — FANPAGE MANAGEMENT UI */

#fanpageList:not(.empty) {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

/* Mỗi Fanpage là một hàng */
#fanpageList .fanpage-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 16px 18px;
  border: 1px solid #d8e4f2;
  border-left: 4px solid #1877f2;
  border-radius: 12px;
  background: #edf5ff;
  box-shadow: 0 2px 6px rgba(25, 65, 110, 0.06);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

/* Hai màu nền luân phiên */
#fanpageList .fanpage-card:nth-child(even) {
  background: #f2f5f9;
  border-color: #dce3eb;
  border-left-color: #64748b;
}

#fanpageList .fanpage-card:hover {
  box-shadow: 0 5px 14px rgba(25, 65, 110, 0.12);
  transform: translateY(-1px);
}

/* Biểu tượng Facebook */
#fanpageList .fanpage-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 12px;
  background: #1877f2;
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 3px 7px rgba(24, 119, 242, 0.22);
}

/* Khu vực thông tin */



#fanpageList .fanpage-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

#fanpageList .fanpage-info h3 {
  margin: 0;
  color: #172554;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.4;
}

#fanpageList .fanpage-info p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}



#fanpageList .fanpage-info h3 {
  margin: 0;
  color: #172b4d;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

#fanpageList .fanpage-info p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* Trạng thái kết nối */
#fanpageList .fanpage-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 10px;
  border: 1px solid #a7e5c1;
  border-radius: 999px;
  background: #e8fff1;
  color: #167342;
  font-size: 12px;
  font-weight: 700;
}

/* Khu vực nút thao tác — dùng khi bổ sung các nút ở bước sau */
#fanpageList .fanpage-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

#fanpageList .fanpage-actions button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

#fanpageList .fanpage-actions button:focus-visible {
  outline: 2px solid #1877f2;
  outline-offset: 2px;
}

#fanpageList .fanpage-actions .btn-reconnect {
  background: #1877f2;
  color: #fff;
}

#fanpageList .fanpage-actions .btn-reconnect:hover {
  background: #0f5fc8;
}

#fanpageList .fanpage-actions .btn-disconnect {
  border-color: #b8d5fb;
  background: #fff;
  color: #1456a0;
}

#fanpageList .fanpage-actions .btn-disconnect:hover {
  background: #e4efff;
}

#fanpageList .fanpage-actions .btn-remove {
  border-color: #fecaca;
  background: #fff;
  color: #b42318;
}

#fanpageList .fanpage-actions .btn-remove:hover {
  background: #fff0f0;
}

/* Màn hình nhỏ */
@media (max-width: 640px) {
  #fanpageList .fanpage-card {
    align-items: flex-start;
    gap: 11px;
    padding: 13px;
  }

  #fanpageList .fanpage-empty-icon {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    font-size: 23px;
  }

  #fanpageList .fanpage-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  #fanpageList .fanpage-actions {
    width: 100%;
    margin-left: 0;
  }
}


/* FACEBOOK — HAI MÀU FANPAGE NỔI BẬT */

/* Hàng lẻ: xanh dương */
#fanpageList:not(.empty) > .fanpage-card:nth-child(odd) {
  background: #dbeafe;
  border-color: #93c5fd;
  border-left: 5px solid #2563eb;
}

/* Hàng chẵn: tím lavender */
#fanpageList:not(.empty) > .fanpage-card:nth-child(even) {
  background: #ede9fe;
  border-color: #c4b5fd;
  border-left: 5px solid #7c3aed;
}

/* Hiệu ứng khi rê chuột */
#fanpageList:not(.empty) > .fanpage-card:nth-child(odd):hover {
  background: #bfdbfe;
  border-color: #60a5fa;
}

#fanpageList:not(.empty) > .fanpage-card:nth-child(even):hover {
  background: #ddd6fe;
  border-color: #a78bfa;
}

/* Tên Fanpage rõ nét */
#fanpageList .fanpage-info h3 {
  color: #172554;
  font-weight: 750;
}

/* ID Fanpage dễ đọc */
#fanpageList .fanpage-info p {
  color: #475569;
}



/* FACEBOOK — TRẠNG THÁI KẾT NỐI VÀ BỐ CỤC HOÀN THIỆN */

#fanpageList:not(.empty) > .fanpage-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
}

#fanpageList .fanpage-info {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

#fanpageList .fanpage-info h3 {
  margin: 0;
  color: #172554;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#fanpageList .fanpage-info p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#fanpageList .fanpage-status {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-left: auto;
  padding: 5px 10px;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

/* Điện thoại: cho phép trạng thái xuống dòng khi thiếu chỗ */
@media (max-width: 480px) {
  #fanpageList:not(.empty) > .fanpage-card {
    gap: 10px;
    padding: 12px;
  }

  #fanpageList .fanpage-empty-icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  #fanpageList .fanpage-info h3 {
    font-size: 14px;
  }

  #fanpageList .fanpage-status {
    font-size: 11px;
    padding: 4px 7px;
  }
}


/* FACEBOOK — CÁC NÚT THAO TÁC FANPAGE */

#fanpageList .fanpage-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: 8px;
}

#fanpageList .fanpage-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

#fanpageList .fanpage-disconnect {
  color: #9f1239;
  background: #ffe4e6;
  border-color: #fda4af;
}

#fanpageList .fanpage-disconnect:hover {
  background: #fecdd3;
}

#fanpageList .fanpage-reconnect {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

#fanpageList .fanpage-reconnect:hover {
  background: #bbf7d0;
}

#fanpageList .fanpage-hide {
  color: #374151;
  background: #f3f4f6;
  border-color: #d1d5db;
}

#fanpageList .fanpage-hide:hover {
  background: #e5e7eb;
}

@media (max-width: 760px) {
  #fanpageList:not(.empty) > .fanpage-card {
    flex-wrap: wrap;
  }

  #fanpageList .fanpage-actions {
    width: 100%;
    margin-left: 44px;
    justify-content: flex-start;
  }
}
