/* ==========================================================================
   Sticker Factory - B2B Chat Script Dictionary
   Brand Guidelines & Design System
   ========================================================================== */

/* Local font declarations */
@font-face {
  font-family: 'UTM Cafeta';
  src: local('UTM Cafeta'), local('UTM-Cafeta'), local('Cafeta');
  font-display: swap;
}

@font-face {
  font-family: 'SVN-Gotham';
  src: local('SVN-Gotham'), local('SVN Gotham'), local('Gotham');
  font-display: swap;
}

:root {
  /* Sticker Factory Brand Colors */
  --brand-red: #e42327;
  --brand-red-hover: #c81a1e;
  --brand-red-light: rgba(228, 35, 39, 0.08);
  --brand-red-border: rgba(228, 35, 39, 0.25);
  
  --brand-white: #ffffff;
  
  --brand-yellow: #ffce07;
  --brand-yellow-hover: #e6b800;
  --brand-yellow-light: #fffde6;
  --brand-yellow-border: #ffd738;
  
  --brand-black: #000000;
  
  --brand-green: #00B201;
  --brand-green-hover: #009601;
  --brand-green-light: rgba(0, 178, 1, 0.1);
  --brand-green-border: rgba(0, 178, 1, 0.3);

  /* Typography */
  --font-heading: 'UTM Cafeta', 'Oswald', 'Bebas Neue', 'Impact', sans-serif;
  --font-body: 'SVN-Gotham', 'SVN Gotham', 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Default: LIGHT MODE */
  --bg-primary: #f4f6f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.96);
  --border-color: #e2e8f0;
  --border-highlight: rgba(228, 35, 39, 0.35);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  
  --accent-primary: var(--brand-red);
  --accent-primary-hover: var(--brand-red-hover);
  --accent-gradient: linear-gradient(135deg, #e42327 0%, #ff4d4f 100%);
  --accent-success: var(--brand-green);
  --accent-warning: var(--brand-yellow);
  --accent-danger: #e42327;
  --accent-youtube: #ff0000;
  
  --customer-highlight-bg: #ffce07;
  --customer-highlight-border: #e6b800;
  --customer-highlight-text: #000000;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(228, 35, 39, 0.2);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Support */
[data-theme="dark"] {
  --bg-primary: #0f141c;
  --bg-secondary: #171f2c;
  --bg-card: rgba(26, 35, 49, 0.85);
  --bg-card-hover: rgba(33, 44, 62, 0.95);
  --bg-glass: rgba(22, 30, 44, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(228, 35, 39, 0.5);
  
  --text-primary: #f0f4fc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --customer-highlight-bg: rgba(255, 206, 7, 0.25);
  --customer-highlight-border: #ffce07;
  --customer-highlight-text: #ffd738;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.45);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(228, 35, 39, 0.6);
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Decorative Brand Stripe */
.brand-stripe {
  height: 4px;
  background: linear-gradient(90deg, #e42327 0%, #e42327 60%, #ffce07 60%, #ffce07 85%, #00B201 85%, #00B201 100%);
  width: 100%;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  max-width: 1600px;
  margin: 0 auto;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(228, 35, 39, 0.25);
  transition: var(--transition);
  flex-shrink: 0;
}

.brand-logo-img:hover {
  transform: rotate(-8deg) scale(1.06);
}

.brand-info h1 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brand-red);
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-transform: uppercase;
}

.brand-tag {
  font-family: var(--font-body);
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--brand-yellow);
  color: var(--brand-black);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.brand-subtitle {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-primary);
  border-color: var(--border-highlight);
  color: var(--brand-red);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: var(--brand-white);
  box-shadow: 0 2px 8px rgba(228, 35, 39, 0.25);
}

.btn-primary:hover {
  background: var(--brand-red-hover);
  border-color: var(--brand-red-hover);
  color: var(--brand-white);
  box-shadow: 0 4px 14px rgba(228, 35, 39, 0.35);
}

.btn-success {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: white;
}

.btn-icon-only {
  padding: 0.45rem;
  width: 36px;
  height: 36px;
}

/* Language Toggle Group */
.lang-toggle-group {
  display: flex;
  background: #edf2f7;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

[data-theme="dark"] .lang-toggle-group {
  background: var(--bg-secondary);
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lang-btn.active {
  background: var(--brand-red);
  color: white;
  box-shadow: 0 1px 4px rgba(228, 35, 39, 0.3);
}

.lang-btn.active .lang-tag {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  box-shadow: none;
}

/* Language Badges (Header & Cards) */
.card-lang-tag,
.lang-tag {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
  padding: 0.22rem 0.45rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.card-lang-tag.en,
.lang-tag.en {
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(29, 78, 216, 0.35);
}

.card-lang-tag.vi,
.lang-tag.vi {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.35);
}

.card-lang-tag.dual,
.lang-tag.dual {
  background: #7c3aed;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.35);
}

.btn-toggle-card-lang {
  width: auto !important;
  min-width: 40px !important;
  padding: 0 0.25rem !important;
}

.btn-toggle-card-lang:hover .card-lang-tag {
  transform: scale(1.06);
  filter: brightness(1.12);
}

/* ==========================================================================
   Customer Personalization Bar
   ========================================================================== */
.personalizer-bar {
  background: #fffdf0;
  border-bottom: 2px solid var(--brand-yellow);
  padding: 0.65rem 1.5rem;
}

[data-theme="dark"] .personalizer-bar {
  background: var(--bg-secondary);
  border-bottom-color: var(--border-color);
}

.personalizer-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.personalizer-inputs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}

.personalizer-label {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-red);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .input-group {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

.input-group:focus-within {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px rgba(228, 35, 39, 0.2);
}

.input-select {
  background: #f8fafc;
  border: none;
  color: var(--text-primary);
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
  border-right: 1px solid #cbd5e1;
  font-weight: 600;
}

[data-theme="dark"] .input-select {
  background: var(--bg-secondary);
  border-right-color: var(--border-color);
}

.input-text {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-family: var(--font-body);
  outline: none;
  min-width: 180px;
}

.input-text::placeholder {
  color: var(--text-muted);
}

.greeting-preview-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--brand-yellow);
  border: 1px solid var(--brand-yellow-border);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-black);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.personalizer-options {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  cursor: pointer;
  accent-color: var(--brand-red);
}

/* ==========================================================================
   Filter & Search Toolbar
   ========================================================================== */
.toolbar-section {
  padding: 1.1rem 1.5rem 0.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.search-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.7rem 4.5rem 0.7rem 2.8rem;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  border-color: var(--brand-red);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(228, 35, 39, 0.15);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-badge {
  position: absolute;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-body);
}

[data-theme="dark"] .search-badge {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

.search-clear {
  position: absolute;
  right: 4.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: none;
}

.search-clear.visible {
  display: block;
}

.search-clear:hover {
  color: var(--brand-red);
}

/* Topic Tabs Filter */
.topic-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color);
}

.topic-tabs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.topic-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.topic-tab:hover {
  border-color: var(--tab-color, var(--brand-red));
  color: var(--tab-color, var(--brand-red));
  transform: translateY(-1px);
}

.topic-tab.active {
  background: var(--tab-color, var(--brand-red));
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.topic-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tab-color, #94a3b8);
}

.topic-tab.active .topic-tab-dot {
  background: white;
}

.topic-tab-count {
  font-size: 0.72rem;
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.15);
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-full);
}

/* Secondary Filters & View Toggle */
.secondary-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.65rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-chip:hover {
  color: var(--brand-red);
  border-color: var(--brand-red);
}

.filter-chip.active {
  background: var(--brand-red-light);
  border-color: var(--brand-red);
  color: var(--brand-red);
  font-weight: 700;
}

.view-mode-group {
  display: flex;
  background: #edf2f7;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

[data-theme="dark"] .view-mode-group {
  background: var(--bg-secondary);
}

.view-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.32rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.view-btn.active {
  background: var(--bg-secondary);
  color: var(--brand-red);
  box-shadow: var(--shadow-sm);
}

/* Stats Summary Line */
.stats-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ==========================================================================
   Main Content & Script Cards (Grid & List)
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 1.25rem 1.5rem 3rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Grid View */
.scripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.35rem;
}

/* Compact List View */
.scripts-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Script Card */
.script-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.script-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Accent bar on top of card */
.script-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: var(--card-topic-color, var(--brand-red));
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.badge-topic {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  color: white;
  background: var(--card-topic-color, var(--brand-red));
  letter-spacing: 0.02em;
}

.badge-shortcut {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--brand-yellow-light);
  border: 1.5px solid var(--brand-yellow-border);
  color: #855d00;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

[data-theme="dark"] .badge-shortcut {
  background: rgba(255, 206, 7, 0.15);
  border-color: rgba(255, 206, 7, 0.35);
  color: #ffd738;
}

.badge-shortcut.empty {
  background: #f1f5f9;
  border-color: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-card-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.btn-card-action:hover {
  background: #f1f5f9;
  border-color: var(--border-color);
  color: var(--brand-red);
}

[data-theme="dark"] .btn-card-action:hover {
  background: var(--bg-secondary);
}

/* Card Message Body */
.card-body {
  flex: 1;
  position: relative;
}

.card-message-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.list-view .card-message-text {
  max-height: 140px;
}

/* Highlighted Customer Variable inside text */
.highlight-customer {
  background: var(--brand-yellow);
  border: 1px solid var(--brand-yellow-border);
  color: var(--brand-black);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.highlight-staff {
  background: var(--brand-red-light);
  border: 1px solid var(--brand-red-border);
  color: var(--brand-red);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  display: inline-block;
}

/* Dual / Bilingual View inside card */
.bilingual-box {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bilingual-section {
  border-left: 3px solid var(--brand-red);
  padding-left: 0.65rem;
}

.bilingual-section.en {
  border-left-color: var(--brand-green);
}

.bilingual-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* Media Section (Images, YouTube, Files) */
.card-media {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
}

.media-photos-grid {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.photo-thumb-container {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  background: var(--bg-primary);
  transition: var(--transition);
}

.photo-thumb-container:hover {
  border-color: var(--brand-red);
  transform: scale(1.05);
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-count-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

.media-photos-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.btn-thumb-copy-img {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  z-index: 2;
}

.photo-thumb-container:hover .btn-thumb-copy-img {
  opacity: 1;
}

.btn-thumb-copy-img:hover {
  background: var(--brand-red);
  transform: scale(1.15);
}

.media-photos-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-photo-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.2;
}

.btn-photo-action:hover {
  background: var(--bg-card);
  border-color: var(--brand-red);
  color: var(--brand-red);
  transform: translateY(-1px);
}

.btn-photo-action.btn-download-all:hover {
  border-color: var(--brand-green);
  color: var(--brand-green);
}

.media-links-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-yt-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: rgba(255, 0, 0, 0.08);
  border: 1px solid rgba(255, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  color: #e42327;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-yt-preview:hover {
  background: #e42327;
  color: white;
}

.btn-file-download {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: var(--brand-green-light);
  border: 1px solid var(--brand-green-border);
  border-radius: var(--radius-sm);
  color: var(--brand-green);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-file-download:hover {
  background: var(--brand-green);
  color: white;
}

/* Card Footer (Copy Button) */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
}

.btn-copy {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  background: var(--brand-red);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(228, 35, 39, 0.25);
}

.btn-copy:hover {
  background: var(--brand-red-hover);
  box-shadow: 0 4px 14px rgba(228, 35, 39, 0.35);
  transform: translateY(-1px);
}

.btn-copy.copied {
  background: var(--brand-green) !important;
  box-shadow: 0 2px 10px rgba(0, 178, 1, 0.4) !important;
}

.card-index {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* List View overrides */
.scripts-grid.list-view .script-card {
  flex-direction: row;
  align-items: flex-start;
  gap: 1.25rem;
}

.scripts-grid.list-view .card-header {
  flex-direction: column;
  align-items: flex-start;
  width: 140px;
  flex-shrink: 0;
}

.scripts-grid.list-view .card-footer {
  flex-direction: column;
  width: 120px;
  flex-shrink: 0;
  margin-top: 0;
}

.scripts-grid.list-view .btn-copy {
  width: 100%;
}

/* ==========================================================================
   Modals (Lightbox, YouTube, Edit)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

/* Wide Responsive Modal for Script Editing */
.modal-box.modal-wide {
  max-width: min(1320px, 96vw);
  width: 96vw;
  max-height: 92vh;
  height: 92vh;
}

/* Fullscreen Mode */
.modal-box.is-fullscreen {
  max-width: 100vw !important;
  width: 100vw !important;
  max-height: 100vh !important;
  height: 100vh !important;
  border-radius: 0 !important;
  margin: 0 !important;
  border: none !important;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-modal-header {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  transition: var(--transition);
}

.btn-modal-header:hover {
  background: var(--bg-primary);
  color: var(--brand-red);
  border-color: var(--brand-red);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-red);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--brand-red);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-primary);
  flex-shrink: 0;
}

/* 2-Column Responsive Layout for Edit Modal Body */
.edit-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  height: 100%;
}

.edit-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.edit-col-vietnamese {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.edit-col-vietnamese .form-group.grow {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.edit-col-vietnamese textarea {
  flex: 1;
  min-height: 380px;
  font-size: 0.95rem;
  line-height: 1.65;
  resize: vertical;
}

.edit-col-english textarea {
  min-height: 200px;
  font-size: 0.95rem;
  line-height: 1.65;
  resize: vertical;
}

/* Gemini AI Translate Button */
.btn-gemini-ai {
  background: linear-gradient(135deg, #e42327 0%, #ea580c 50%, #f59e0b 100%);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(228, 35, 39, 0.25);
  transition: var(--transition);
}

.btn-gemini-ai:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(228, 35, 39, 0.35);
}

.btn-gemini-ai.loading {
  opacity: 0.75;
  pointer-events: none;
}

.btn-gemini-ai .spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Live photo preview inside edit modal */
.edit-photos-preview {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.35rem 0;
  min-height: 20px;
}

.edit-photo-thumb {
  width: 55px;
  height: 55px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  object-fit: cover;
  flex-shrink: 0;
}

/* Gemini Status Badge in Header */
.gemini-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.gemini-status-badge:hover {
  border-color: var(--brand-red);
}

.gemini-status-badge.active {
  background: rgba(0, 178, 1, 0.08);
  border-color: rgba(0, 178, 1, 0.35);
  color: var(--brand-green);
}

/* Responsive for Edit Modal */
@media (max-width: 992px) {
  .edit-modal-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .modal-box.modal-wide {
    width: 98vw;
    max-height: 96vh;
    height: 96vh;
  }
}

/* Lightbox */
.lightbox-box {
  max-width: 900px;
  background: transparent;
  border: none;
  box-shadow: none;
  align-items: center;
}

.lightbox-image-container {
  position: relative;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  transition: var(--transition);
}

.lightbox-nav:hover {
  background: var(--brand-red);
}

.lightbox-nav.prev {
  left: -20px;
}

.lightbox-nav.next {
  right: -20px;
}

.lightbox-counter {
  margin-top: 0.75rem;
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.65);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 2px rgba(228, 35, 39, 0.15);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* YouTube Modal Embed */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: black;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  font-weight: 700;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.toast-success {
  border-left: 5px solid var(--brand-green);
}

.toast.toast-info {
  border-left: 5px solid var(--brand-red);
}

.toast.toast-warning {
  border-left: 5px solid var(--brand-yellow);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.6;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--brand-red);
  margin-bottom: 0.35rem;
}

/* Responsive */
@media (max-width: 900px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .personalizer-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .personalizer-inputs {
    width: 100%;
  }
  .input-text {
    flex: 1;
    min-width: 120px;
  }
  .scripts-grid {
    grid-template-columns: 1fr;
  }
  .scripts-grid.list-view .script-card {
    flex-direction: column;
  }
  .scripts-grid.list-view .card-header,
  .scripts-grid.list-view .card-footer {
    width: 100%;
    flex-direction: row;
  }
}

/* ==========================================================================
   Google Sheets Integration Styles
   ========================================================================== */
.btn-sheets {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
  color: #059669;
  font-weight: 700;
  position: relative;
}

[data-theme="dark"] .btn-sheets {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.btn-sheets:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: #10b981;
  color: #047857;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-sheets:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
  color: #6ee7b7;
}

.sheets-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  margin-left: 3px;
  transition: var(--transition);
}

.sheets-status-dot.connected {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

.sheets-status-dot.syncing {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
  animation: pulse-sync 1s infinite alternate;
}

.sheets-status-dot.error {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
}

@keyframes pulse-sync {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.25); opacity: 1; }
}

.sync-spin-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.sync-spin-icon.syncing {
  animation: spin-sync 0.8s linear infinite;
}

@keyframes spin-sync {
  100% { transform: rotate(360deg); }
}

/* Sheets Status Card in Modal */
.sheets-status-card {
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.sheets-status-card.connected {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.05);
}

.sheets-status-card.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.05);
}

.status-indicator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-badge-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.status-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.status-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-meta-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.sheets-doc-link {
  color: #059669;
  font-weight: 700;
  text-decoration: underline;
}

.sheets-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
  background: var(--bg-primary);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

@media (max-width: 600px) {
  .sheets-options-grid {
    grid-template-columns: 1fr;
  }
}

.sheets-manual-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 1rem;
}

@media (max-width: 600px) {
  .sheets-manual-actions {
    grid-template-columns: 1fr;
  }
}

.manual-action-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.action-card-info strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.action-card-info span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sheets-instructions-box {
  margin-top: 1.15rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

[data-theme="dark"] .sheets-instructions-box {
  background: rgba(30, 41, 59, 0.5);
}

.instruction-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.02);
  user-select: none;
}

.instruction-header:hover {
  background: rgba(0, 0, 0, 0.05);
}

.instruction-title {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--brand-red);
}

.instruction-body {
  padding: 0.85rem 1.1rem 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.step-list {
  padding-left: 1.2rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.step-list li {
  margin-bottom: 0.25rem;
}

.step-list code {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
}

