@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

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

body.resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.resizing * { pointer-events: none !important; }
body.resizing .workspace-resizer { pointer-events: all !important; }

:root {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg: #F8FAFC;
  --bg2: #FFFFFF;
  --bg3: #F1F5F9;
  --border: #E2E8F0;
  --border2: #cbd5e1;
  --accent: #E11D48; /* Vibrant Rose/Red */
  --accent2: #9F1239;
  --accent-glow: rgba(225, 29, 72, 0.08);
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --text: #0F172A;
  --text2: #475569;
  --text3: #94A3B8;
  --card: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-w: 240px;
  /* CV Theme Variables */
  --cv-primary: #922B21;
  --cv-secondary: #C0392B;
  --cv-accent: #E67E22;
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; overflow: hidden; }

h1, h2, h3 { font-family: 'Outfit', sans-serif; }

/* ─── Layout ────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); background: #111827; color: #f8fafc;
  display: flex; flex-direction: column; flex-shrink: 0; z-index: 50;
  transition: var(--transition);
}
.sidebar-logo {
  padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; gap: 12px;
  transition: var(--transition);
}
.sidebar-logo:hover {
  background: rgba(255,255,255,0.02);
}
.logo-icon {
  width: 38px; height: 38px; 
  background: rgba(225, 29, 72, 0.15);
  border: 1px solid rgba(225, 29, 72, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.1);
}
.sidebar-logo:hover .logo-icon {
  transform: translateY(-5px) scale(1.08);
  background: rgba(225, 29, 72, 0.3);
  border-color: rgba(225, 29, 72, 0.6);
  box-shadow: 0 10px 25px rgba(225, 29, 72, 0.25);
  animation: rocket-float 2s ease-in-out infinite;
  will-change: transform;
}
@keyframes rocket-float {
  0%, 100% { transform: translateY(-5px) scale(1.08); }
  50% { transform: translateY(-8px) scale(1.1); }
}
.logo-text { font-weight: 700; font-size: 19px; letter-spacing: -0.6px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.2); display: flex; align-items: baseline; }
.logo-wave {
  position: relative;
  display: inline-block;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20'%3E%3Cpath d='M0 10 Q25 5 50 10 T100 10 L100 20 L0 20 Z' fill='%2360a5fa' opacity='0.7'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20'%3E%3Cpath d='M0 10 Q25 15 50 10 T100 10 L100 20 L0 20 Z' fill='%2334d399' opacity='0.7'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #34d399, #60a5fa, #34d399, #60a5fa, #34d399);
  background-size: 100px 100%, 100px 100%, 400% 100%;
  background-repeat: repeat-x, repeat-x, repeat-x;
  animation: move-waves 6s linear infinite, logo-flicker 3s ease-in-out infinite;
  font-weight: 900;
  margin-left: 2px;
  -webkit-text-stroke: 0.3px rgba(255,255,255,0.1);
}

@keyframes move-waves {
  0% { background-position: 0 0, 50px 0, 0 0; }
  100% { background-position: 200px 0, 250px 0, 0 0; }
}

@keyframes logo-flicker {
  0%, 100% { filter: brightness(1.1) drop-shadow(0 0 2px rgba(52, 211, 153, 0.4)); }
  50% { filter: brightness(1.4) drop-shadow(0 0 10px rgba(96, 165, 250, 0.6)); }
}
.logo-sub { font-size: 11px; color: rgba(255,255,255,0.45); text-transform: lowercase; letter-spacing: 0.5px; margin-top: -1px; font-style: italic; }




.sidebar-logo:hover .sidebar-brand-img {
  transform: scale(1.08) translateY(-2px);
  filter: drop-shadow(0 5px 20px rgba(96, 165, 250, 0.45));
}


/* Shell Action Buttons (Import/Export) - Premium Refinement */
.shell-actions {
  display: flex;
  gap: 20px;
  padding: 10px 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  justify-content: center;
}

.shell-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: rgba(255,255,255,0.6);
}

.shell-btn svg { width: 22px; height: 22px; transition: inherit; }

.shell-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
}

.shell-btn svg { width: 20px; height: 20px; transition: inherit; }

/* Import - Emerald/Cyan Glow */
.shell-btn.import:hover {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
  transform: scale(1.15);
  animation: arrow-float-down 1.5s ease-in-out infinite;
}

/* Export - Blue/Purple Glow */
.shell-btn.export:hover {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.3);
  transform: scale(1.15);
  animation: arrow-float-up 1.5s ease-in-out infinite;
}

/* Wipe - Small, Semi-transparent Flame */
.shell-btn.wipe {
  width: 32px; height: 32px;
  opacity: 0.4;
  border-color: rgba(239, 68, 68, 0.2);
  margin-top: 4px;
}

.shell-btn.wipe:hover {
  opacity: 1;
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.4);
  transform: scale(1.2);
}

.shell-btn.wipe:hover svg {
  animation: flame-sway 0.8s ease-in-out infinite;
  will-change: transform;
}

@keyframes flame-sway {
  0%, 100% { transform: rotate(-5deg) scale(0.95); opacity: 0.8; }
  50% { transform: rotate(5deg) scale(1.15); opacity: 1; }
}

@keyframes arrow-float-down {
  0%, 100% { transform: scale(1.15) translateY(0); }
  50% { transform: scale(1.15) translateY(4px); }
}

@keyframes arrow-float-up {
  0%, 100% { transform: scale(1.15) translateY(0); }
  50% { transform: scale(1.15) translateY(-4px); }
}

.shell-btn:active { transform: scale(0.95); opacity: 0.8; }

@keyframes arrow-float-down {
  0%, 100% { transform: scale(1.15) translateY(0); }
  50% { transform: scale(1.15) translateY(4px); }
}

@keyframes arrow-float-up {
  0%, 100% { transform: scale(1.15) translateY(0); }
  50% { transform: scale(1.15) translateY(-4px); }
}

.shell-btn:active { transform: scale(0.95); opacity: 0.8; }

/* Nuclear Wipe Button (Fire/Ember Theme) */
.btn-wipe {
  width: 100%; height: 48px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  color: #fff; border: none; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
  position: relative; overflow: hidden;
}

.btn-wipe svg {
  width: 20px; height: 20px; filter: drop-shadow(0 0 2px rgba(255,255,255,0.5));
}

.btn-wipe:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
  animation: button-burn 0.2s linear infinite;
}

@keyframes button-burn {
  0% { transform: translateY(-2px) rotate(0deg); }
  25% { transform: translateY(-2px) rotate(0.5deg); }
  75% { transform: translateY(-2px) rotate(-0.5deg); }
  100% { transform: translateY(-2px) rotate(0deg); }
}

.btn-wipe:active {
  transform: translateY(0) scale(0.98);
}

.sidebar-nav { flex: 1; padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
  color: #94a3b8; font-size: 14px; font-weight: 500; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(176, 58, 46, 0.3); }

.sidebar-footer { padding: 16px 10px; border-top: 1px solid rgba(255,255,255,0.05); }
.api-badge {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: rgba(255,255,255,0.03); border-radius: var(--radius-sm); cursor: pointer;
}
.api-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.api-dot.unconfigured { background: var(--warning); animation: pulse 2s infinite; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-header {
  height: 64px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 32px; gap: 16px; flex-shrink: 0;
}
body.workspace-mode .main-header { display: none; } /* Maximize space */

.header-sub { font-size: 12px; color: var(--text3); }
.header-actions { margin-left: auto; display: flex; gap: 10px; }

.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.tab-page-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.tab-page { flex: 1; min-height: 0; padding: 32px; overflow-y: auto; display: flex; flex-direction: column; width: 100%; }

body.workspace-mode #app { flex-direction: column; }
body.workspace-mode .sidebar {
  width: 100%; height: 60px; flex-direction: row; 
  padding: 0 24px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
body.workspace-mode .sidebar-logo { padding: 0; border: none; margin-right: 40px; }
body.workspace-mode .sidebar-logo .logo-sub { display: none; }
body.workspace-mode .sidebar-nav { flex-direction: row; padding: 0; gap: 4px; }
body.workspace-mode .nav-item { width: 40px; height: 40px; justify-content: center; padding: 0; }
body.workspace-mode .nav-item span:not(.nav-icon) { display: none; }
body.workspace-mode .sidebar-footer { padding: 0; border: none; margin-left: auto; display: flex; align-items: center; gap: 20px; }
body.workspace-mode .lang-switcher { margin: 0; display: flex; gap: 4px; }
body.workspace-mode .api-badge { background: none; padding: 0; gap: 8px; display: flex; align-items: center; }
body.workspace-mode .api-badge .api-label { display: none; }
body.workspace-mode .api-badge .api-provider { font-size: 11px; font-weight: 600; color: #94a3b8; }

body.workspace-mode .tab-page { padding: 0; }

.api-status-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text2);
  white-space: nowrap;
  height: 30px;
}
.api-status-compact:hover { border-color: var(--accent); background: #fff; }
.api-status-compact.active { border-color: var(--success); background: rgba(5, 150, 105, 0.05); color: var(--success); }
.api-status-compact.warning { border-color: var(--warning); background: rgba(217, 119, 6, 0.05); color: var(--warning); }
.api-status-compact span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }

body.workspace-mode .tab-page { padding: 0; }

/* ─── Cards & Components ────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.config-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* JD Textarea Beautification */
.jd-textarea-modern {
  width: 100%; min-height: 200px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fbfcfd; color: var(--text);
  font-family: inherit; font-size: 13px; line-height: 1.6;
  transition: var(--transition); outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.jd-textarea-modern:focus {
  border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Provider Grid (Config Section) */
.config-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.provider-card {
  padding: 16px; border: 2px solid var(--border); border-radius: var(--radius);
  text-align: center; cursor: pointer; transition: var(--transition);
}
.provider-card:hover { border-color: var(--accent); background: var(--accent-glow); }
.provider-card.selected { border-color: var(--accent); background: var(--accent-glow); }
.provider-icon { font-size: 24px; margin-bottom: 8px; }
.provider-name { font-size: 12px; font-weight: 600; color: var(--text); }

/* ─── Forms (used across config, library, workspace) ──────── */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; letter-spacing: 0.3px; }
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: 13px;
  font-family: inherit; outline: none; transition: var(--transition);
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: #fff; }
.form-select {
  width: 100%; padding: 9px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: 13px;
  font-family: inherit; outline: none; cursor: pointer; transition: var(--transition);
}
.form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-textarea {
  width: 100%; min-height: 80px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: 13px;
  font-family: inherit; outline: none; resize: vertical; transition: var(--transition);
}
.form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ─── Job Search Hero ─────────────────────────────────────── */
.search-hero {
  padding: 32px 24px 28px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius); margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.search-hero-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* Row 1 – title + location + search */
.search-row-main {
  display: flex; gap: 10px; align-items: stretch;
}

.search-field-wrap {
  flex: 1; display: flex; align-items: center; gap: 0;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm); padding: 0 14px; transition: var(--transition);
  min-width: 0;
}
.search-field-wrap:focus-within {
  background: rgba(255,255,255,0.1); border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176,58,46,0.25);
}
.search-field-wrap.search-field-loc { flex: 0 0 200px; }

.search-field-icon { font-size: 15px; flex-shrink: 0; opacity: 0.6; margin-right: 8px; }
.search-field-input {
  flex: 1; background: none; border: none; outline: none;
  color: #f1f5f9; font-size: 14px; font-family: inherit;
  padding: 13px 0; min-width: 0;
}
.search-field-input::placeholder { color: rgba(255,255,255,0.35); }

/* Fix Webkit/Chrome Autofill colors */
.search-field-input:-webkit-autofill,
.search-field-input:-webkit-autofill:hover, 
.search-field-input:-webkit-autofill:focus, 
.search-field-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #1e293b inset !important;
    -webkit-text-fill-color: #f1f5f9 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    transition: background-color 5000s ease-in-out 0s;
}
input:-webkit-autofill {
    background-clip: content-box !important;
}

/* New HelloWork Style Filter Bar */
.filter-bar-hellowork {
  display: flex; align-items: center; gap: 12px; margin-top: 16px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm); padding: 10px 14px;
}

.filter-group-wrap { position: relative; }

.filter-group-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 6px 14px; font-size: 12px; font-weight: 600;
  color: #cbd5e1; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.filter-group-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.filter-group-btn.active {
  background: var(--accent); border-color: var(--accent2); color: #fff;
  box-shadow: 0 4px 12px rgba(176,58,46,0.25);
}

.filter-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 100;
  background: #1e293b; border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  padding: 8px 0; min-width: 180px; display: none;
}
.filter-dropdown.show { display: block; animation: slideDown 0.2s ease-out; }
@keyframes slideDown { from { transform: translateY(-5px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.filter-opt-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  font-size: 13px; color: #cbd5e1; cursor: pointer; transition: background 0.1s;
}
.filter-opt-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.filter-opt-item input { width: 14px; height: 14px; accent-color: var(--accent); }

.filter-bar-divider { width: 1px; height: 24px; background: rgba(255,255,255,0.1); margin: 0 4px; }

.filter-tag-area-compact {
  flex: 1; display: flex; align-items: center; gap: 8px;
  min-width: 120px; overflow: hidden;
}
.filter-tag-input {
  background: none; border: none; outline: none; color: #fff;
  font-size: 12px; width: 100%; min-width: 80px;
}
.filter-tag-input::placeholder { color: rgba(255,255,255,0.25); }

.btn-clear-filters {
  background: none; border: none; color: rgba(255,255,255,0.4);
  cursor: pointer; font-size: 14px; padding: 4px; transition: color 0.2s;
}
.btn-clear-filters:hover { color: var(--accent); }

.filter-chips-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(176,58,46,0.35); border: 1px solid rgba(176,58,46,0.6);
  color: #fecaca; border-radius: 20px; padding: 3px 10px 3px 12px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: var(--transition);
}
.filter-chip:hover { background: rgba(176,58,46,0.5); }
.filter-chip-remove {
  background: none; border: none; color: #fca5a5; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 2px; display: flex; align-items: center;
  opacity: 0.7; transition: var(--transition);
}
.filter-chip-remove:hover { opacity: 1; transform: scale(1.2); }

.filter-tag-input {
  background: none; border: none; outline: none;
  color: #f1f5f9; font-size: 13px; font-family: inherit;
  padding: 4px 0; min-width: 160px; flex: 1;
}
.filter-tag-input::placeholder { color: rgba(255,255,255,0.28); }

/* Sort button */
.btn-sort {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 18px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12); border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--transition); white-space: nowrap;
  font-family: inherit; height: 46px;
}
.btn-sort:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-sort.active {
  background: rgba(176,58,46,0.35); border-color: rgba(176,58,46,0.7);
  color: #fecaca;
}

/* Big red search button */
.search-btn-large {
  background: var(--accent); color: #fff; border: none;
  padding: 0 24px; border-radius: var(--radius-sm);
  font-weight: 700; cursor: pointer; height: 48px;
  font-size: 14px; font-family: inherit;
  box-shadow: 0 4px 16px rgba(176,58,46,0.4);
  transition: var(--transition); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.search-btn-large:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(176,58,46,0.5); }

/* Results meta bar */
.results-meta {
  margin-bottom: 16px; font-size: 13px; color: var(--text3);
  display: flex; align-items: center; gap: 6px;
}

/* Job Cards */
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.job-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 14px 12px; transition: var(--transition); position: relative;
  display: flex; flex-direction: column; gap: 8px;
}
.job-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }

/* Top-right "Voir ↗" external link badge */
.job-ext-link {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 600; color: var(--accent2);
  text-decoration: none; letter-spacing: 0.3px;
  background: rgba(203,67,53,0.08); border: 1px solid rgba(203,67,53,0.2);
  border-radius: 20px; padding: 2px 8px;
  transition: var(--transition);
}
.job-ext-link:hover { background: var(--accent2); color: #fff; }

/* Updated Job Card Elements */
.tag {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.tag-contract { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.tag-loc { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.tag-esn { 
  background: #fdf2f2; color: #9b1c1c; border: 1px solid #f8d7da;
  font-size: 10px; padding: 1px 6px; margin-left: 6px;
}

.job-tags { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }

/* Card header: logo + title/company */
.job-card-header {
  display: flex; gap: 16px; align-items: flex-start; margin-bottom: 0px;
}
.job-logo { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid #edf2f7; padding: 4px; flex-shrink: 0; }
.job-logo-placeholder { 
  width: 56px; height: 56px; border-radius: 12px; background: #f8fafc; 
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  border: 1px solid #edf2f7; flex-shrink: 0;
}
.job-card-info { flex: 1; min-width: 0; padding-right: 64px; }
.job-title-text { 
  font-size: 13px; font-weight: 700; color: var(--text); margin: 0 0 2px; line-height: 1.4;
  white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.job-company-text { font-size: 11px; color: var(--accent2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Location & date row */
.job-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-location-text { font-size: 11px; color: var(--text2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-source-badge {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px;
  background: var(--bg3); color: var(--text3); flex-shrink: 0;
}
.job-date { font-size: 10px; color: var(--text3); }

/* Analyze button: full-width at bottom */
.job-analyze-btn { width: 100%; margin-top: 4px; }



/* ─── Workspace Split Panes ──────────────────── */
.workspace-layout { display: flex; height: 100%; background: #f1f5f9; overflow: hidden; }

body.workspace-mode #workspace-ai,
body.workspace-mode #ai-restore-btn,
body.workspace-mode .workspace-resizer,
body.workspace-mode #api-badge-ws,
body.workspace-mode .editor-tab-group { display: none !important; }
body.workspace-mode .workspace-editor-panel { width: 100%; }

.workspace-ai-panel {
  width: var(--ai-panel-width, 400px);
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
  padding: 0; position: relative;
}
.workspace-ai-panel.collapsed { width: 0 !important; border-right: none; }

/* AI Panel Internal Layout */
.ai-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  flex-shrink: 0;
}
.ai-panel-title { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }

/* ─── Agent Selector ─────────────────────────── */
.agent-selector-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg3); flex-shrink: 0;
}
.agent-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--border);
  cursor: pointer; background: #fff; color: var(--text3); transition: var(--transition);
  font-family: inherit; white-space: nowrap;
}
.agent-chip:hover { border-color: var(--accent); color: var(--text); }
.agent-chip.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent2); box-shadow: 0 2px 8px rgba(176,58,46,0.2);
}
.agent-chip.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* AI Panel Body (scrollable chat area) */
.ai-panel-body { flex: 1; overflow-y: auto; padding: 0; display: flex; flex-direction: column; }

/* ─── Chat Messages Area ─────────────────────── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}

/* Welcome / empty state */
.chat-welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; text-align: center; padding: 40px 20px; gap: 12px; color: var(--text3);
}
.chat-welcome-icon { font-size: 48px; opacity: 0.6; }
.chat-welcome-title { font-size: 16px; font-weight: 700; color: var(--text); }
.chat-welcome-sub { font-size: 12px; line-height: 1.6; max-width: 280px; }
.chat-welcome-hints {
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px; width: 100%; max-width: 320px;
}
.chat-hint-chip {
  padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--text2);
  cursor: pointer; text-align: left; transition: var(--transition);
  font-family: inherit; width: 100%;
}
.chat-hint-chip:hover { border-color: var(--accent); background: var(--accent-glow); color: var(--text); }

/* Message bubbles */
.chat-bubble {
  max-width: 88%; padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.6; word-wrap: break-word;
  animation: chatFadeIn 0.25s ease-out;
}
@keyframes chatFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.chat-bubble-user {
  align-self: flex-end; background: var(--accent); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-ai {
  align-self: flex-start; background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-bubble-ai strong { color: var(--accent); }

/* AI badge inside bubble */
.chat-ai-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; color: var(--accent); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.4px;
}

/* Typing indicator */
.chat-typing {
  align-self: flex-start; display: flex; align-items: center; gap: 4px;
  padding: 10px 16px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 14px; border-bottom-left-radius: 4px;
}
.chat-typing-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text3);
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.chat-typing-dot:nth-child(1) { animation-delay: 0s; }
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* CV Payload action bar (appears in AI bubble when CV is ready) */
.chat-payload-actions {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.chat-payload-actions .btn { font-size: 11px; padding: 5px 10px; }

/* ─── Chat Input Bar ────────────────────────── */
.chat-input-bar {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border); background: #fff; flex-shrink: 0;
  align-items: flex-end;
}
.chat-input-wrap {
  flex: 1; display: flex; align-items: flex-end;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  transition: var(--transition);
}
.chat-input-wrap:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}
.chat-input-textarea {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; font-family: inherit;
  resize: none; max-height: 120px; min-height: 20px;
  line-height: 1.5;
}
.chat-input-textarea::placeholder { color: var(--text3); }
.chat-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: var(--transition); flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--accent2); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Collapsed Tab – vertical label */
.ai-collapsed-tab {
  width: 32px; background: #111827; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 16px 0; flex-shrink: 0;
  transition: var(--transition); border-right: 1px solid rgba(255,255,255,0.08);
}
.ai-collapsed-tab:hover { background: #1e293b; }
.ai-collapsed-arrow { font-size: 12px; color: #94a3b8; }
.ai-collapsed-label {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 11px; font-weight: 700; color: #94a3b8;
  letter-spacing: 1.5px; text-transform: uppercase;
  transform: rotate(180deg);
}
.ai-collapsed-label.lang-cn {
  transform: none;
  text-orientation: upright;
}



.workspace-resizer {
  width: 10px; 
  margin: 0 -5px; /* Pull it to keep layout tight but hit area large */
  background: transparent; 
  cursor: col-resize;
  transition: background 0.2s; 
  z-index: 100; /* Ensure it stays on top of editor/panels */
  position: relative;
}
.workspace-resizer:hover, body.resizing .workspace-resizer { 
  background: var(--accent);
  opacity: 0.5;
}
body.resizing { 
  cursor: col-resize !important; 
  user-select: none !important; 
  -webkit-user-select: none !important;
}
/* 🔥 Crucial: Prevent panel content from stealing mouse events during drag */
body.resizing * {
  pointer-events: none !important;
}
body.resizing .workspace-layout, 
body.resizing .workspace-resizer {
  pointer-events: all !important;
}

.workspace-editor-panel {
  flex: 1; 
  background: #eaeff2; /* Neutral light gray for focus */
  display: flex; 
  flex-direction: column;
  overflow: auto; /* Enable horizontal and vertical scroll for A4 */
  min-width: 0; /* Allow shrinking below content size to trigger overflow */
  height: 100%; 
  position: relative;
}

.editor-toolbar-sticky {
  position: sticky; top: 0; background: #fff; z-index: 50;
  padding: 12px 24px; border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.layout-settings { position: relative; flex-shrink: 0; }
.layout-settings > summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
.layout-settings > summary::-webkit-details-marker { display: none; }
.layout-settings-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  display: grid; gap: 14px; width: 270px; padding: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.layout-setting-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 12px; color: var(--text2); }
.layout-setting-row output { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.layout-setting-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.layout-setting-row input:disabled { opacity: 0.45; }

@media (max-width: 760px) {
  .editor-toolbar-sticky { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
}

/* Workspace Tab Group (CV / Lettre) */
.editor-tab-group { display: flex; gap: 4px; }
.editor-tab {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; background: none; color: var(--text3); transition: var(--transition);
  font-family: inherit;
}
.editor-tab:hover { background: var(--bg3); color: var(--text); }
.editor-tab.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent2); box-shadow: 0 2px 8px rgba(176,58,46,0.2);
}

/* Toast notifications */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  background: #1e293b; color: #fff; box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease; max-width: 300px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.warning { background: var(--warning); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Loading overlay */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.loading-text { color: #fff; font-size: 14px; font-weight: 600; }



/* ──────────────────────────────────────────────────────────
   📄 PROFESSIONAL CV PAPER (SIDEBAR TEMPLATE)
   ────────────────────────────────────────────────────────── */
.cv-editor-outer {
  flex: 1; display: flex; justify-content: center; padding: 40px 0;
}

.cv-paper {
  width: 210mm; min-height: 297mm; background: #fff;
  box-shadow: 0 0 30px rgba(0,0,0,0.2); display: flex;
  font-family: 'Inter', sans-serif; position: relative;
  transition: transform 0.2s;
  
  /* 📄 Multi-page simulation background */
  background-image: linear-gradient(to bottom, transparent 296.5mm, rgba(211, 84, 0, 0.3) 296.5mm, rgba(211, 84, 0, 0.3) 297mm, transparent 297mm);
  background-size: 100% 297mm;
}

/* Page Break Badge */
.cv-paper::after {
  content: "✂️ PAGE BREAK (297mm)";
  position: absolute; right: -80px; top: 290mm;
  writing-mode: vertical-rl; font-size: 10px; color: #D35400; opacity: 0.5;
  letter-spacing: 2px;
}

/* --- Left Sidebar (#8B261F) --- */
.cv-sidebar {
  width: 32%; background: var(--cv-primary); color: #fff;
  padding: 40px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 20px;
}

.cv-photo-placeholder {
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: 3px solid #fff;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px; cursor: pointer;
}
.cv-photo-placeholder img { width: 100%; height: 100%; object-fit: cover; }

.cv-side-name {
  font-family: 'Outfit', sans-serif; font-size: 24px; font-weight: 700;
  text-align: center; margin-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 10px; width: 100%;
}

.cv-side-section { width: 100%; margin-bottom: 25px; }
.cv-side-title {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 12px; color: rgba(255,255,255,0.9);
}
.cv-side-item { font-size: 11px; margin-bottom: 8px; line-height: 1.4; }
.cv-side-label { font-weight: 700; font-size: 10px; margin-bottom: 2px; display: block; }

/* Language Bars */
.cv-lang-row { margin-bottom: 12px; }
.cv-lang-bar {
  height: 6px; background: rgba(255,255,255,0.2); width: 100%;
  margin-top: 4px; display: flex; gap: 4px;
}
.cv-lang-dot { flex: 1; background: #fff; }
.cv-lang-dot.empty { background: rgba(255,255,255,0.4); }

/* --- Main Content Area --- */
.cv-main {
  flex: 1; padding: 40px; background: #fff; color: #333;
}

.cv-section-title-right {
  font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 700;
  color: var(--cv-primary);
  text-transform: uppercase; margin-bottom: 12px;
  border-bottom: 2px solid var(--cv-primary); padding-bottom: 4px;
}

.cv-entry { margin-bottom: 20px; }
.cv-entry-header { display: flex; justify-content: space-between; align-items: baseline; }
.cv-entry-role { color: var(--cv-secondary); font-weight: 700; font-size: 14px; }
.cv-entry-company { font-weight: 700; font-style: italic; color: #5D6D7E; font-size: 12px; }
.cv-entry-date { font-size: 11px; color: #85929E; }
.cv-entry-loc { font-size: 11px; color: #BDC3C7; text-align: right; }

.cv-bullet-list {
  padding: 0; margin: 10px 0 0 0; list-style: none; /* Removed default bullets */
}

.cv-bullet-item {
  display: flex !important; align-items: flex-start; gap: 12px;
  position: relative; margin-bottom: 6px;
}

/* 💎 Beautiful Custom Bullet Logo */
.cv-bullet-item::before {
  content: ""; flex-shrink: 0; width: 6px; height: 6px;
  background: var(--cv-accent); transform: rotate(45deg); /* Elegant Diamond Shape */
  margin-top: 8px; /* Precise vertical alignment with text baseline */
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

/* Resets for Editing in Paper */
.cv-input-paper {
  background: transparent; border: 1px solid transparent; width: 100%;
  color: inherit; font-size: inherit; font-weight: inherit; font-family: inherit;
  transition: all 0.2s; padding: 2px;
}
.cv-input-paper:hover { background: rgba(211, 84, 0, 0.04); border-color: rgba(211, 84, 0, 0.5); }
.cv-input-paper:focus { background: #fff; outline: none; border-color: #D35400; color: #000; box-shadow: 0 0 5px rgba(211, 84, 0, 0.2); }

.cv-textarea-paper {
  background: transparent; border: 1px solid transparent; width: 100%;
  min-height: 30px; resize: none; color: inherit; font-size: inherit;
  font-family: inherit; line-height: 1.5; padding: 2px;
  transition: all 0.2s;
}
.cv-textarea-paper:hover { background: rgba(211, 84, 0, 0.04); border-color: rgba(211, 84, 0, 0.5); }
.cv-textarea-paper:focus { background: #fff; outline: none; border-color: #D35400; color: #000; box-shadow: 0 0 5px rgba(211, 84, 0, 0.2); }

/* Buttons & Navigation Toggles */
.lang-toggle {
  display: flex; background: var(--bg3); padding: 4px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.lang-btn {
  padding: 4px 12px; cursor: pointer; border-radius: 4px;
  font-size: 11px; font-weight: 600; border: none; background: none; color: var(--text3);
}
.lang-btn.active { background: #fff; color: var(--accent); box-shadow: var(--shadow); }

.btn-icon {
  background: none; border: none; cursor: pointer; font-size: 16px;
  color: var(--text3); transition: var(--transition);
}
.btn-icon:hover { color: var(--accent); }

.spinner {
  width: 20px; height: 20px; border: 3px solid rgba(0,0,0,0.1);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Delete Buttons (Minimalist '×') === */
.cv-item-delete, .cv-bullet-delete {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(231, 76, 60, 0.1);
  color: #E74C3C;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 300;
  cursor: pointer;
  opacity: 0.3;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  padding: 0;
  line-height: 1;
}

.cv-item-delete {
  right: 15px;
  top: 15px;
  font-size: 16px;
  width: 24px;
  height: 24px;
}

.cv-bullet-delete {
  right: -28px;
  top: 4px;
}

.cv-item-delete:hover, .cv-bullet-delete:hover {
  opacity: 1;
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  transform: scale(1.1) rotate(90deg);
}

.cv-entry:hover .cv-item-delete,
.cv-bullet-item:hover .cv-bullet-delete {
  opacity: 0.6;
}

.cv-item-delete:hover,
.cv-bullet-item:hover .cv-bullet-delete:hover {
  opacity: 1;
}

.cv-add-bullet {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px dashed var(--cv-accent); color: var(--cv-accent);
  background: none; cursor: pointer; font-size: 14px;
  margin-top: 8px; opacity: 0.5; transition: 0.2s;
}
.cv-add-bullet:hover { opacity: 1; background: rgba(211,84,0,0.1); transform: scale(1.1); }

/* Special style for horizontal skills edit */
.cv-tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cv-tag-item {
  background: #f1f5f9; padding: 4px 10px; border-radius: 4px; border: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 6px; font-size: 11px;
}
.cv-tag-delete { color: #E74C3C; cursor: pointer; font-weight: bold; }

/* ─── PDF PREVIEW PANEL ────────────────────────────────────── */
.panel-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); z-index: 1000;
  opacity: 0; pointer-events: none; transition: 0.3s;
}
.panel-overlay.show { opacity: 1; pointer-events: all; }

.preview-panel {
  position: fixed; top: 0; right: -100%; width: 90%; max-width: 1000px;
  height: 100vh; background: #fff; z-index: 1001;
  box-shadow: -10px 0 30px rgba(0,0,0,0.2);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
}
.preview-panel.open { right: 0; }

.preview-header {
  padding: 16px 32px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: #f8fafc;
}
.preview-header h2 { font-size: 18px; color: var(--text); margin: 0; }
.preview-actions { display: flex; gap: 12px; }

#pdf-frame { flex: 1; border: none; width: 100%; height: 100%; background: #525659; }

@media (max-width: 768px) {
  .preview-panel { width: 100%; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 600; cursor: pointer; transition: var(--transition);
  border: none; gap: 8px; font-family: inherit;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(176, 58, 46, 0.2); }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }

/* --- Utilities & Status --- */
.status-badge {
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge.success { background: #dcfce7; color: #166534; }
.status-badge.warning { background: #fef3c7; color: #92400e; }
.status-badge.info { background: #e0f2fe; color: #075985; }

.error-msg {
  padding: 16px; background: #fee2e2; border: 1px solid #fecaca;
  color: #991b1b; border-radius: var(--radius-sm); font-size: 13px;
  margin: 20px 0; text-align: center;
}

.spinner-container {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px; gap: 12px; color: var(--text3);
}

.empty-state {
  text-align: center; padding: 60px; color: var(--text3);
  border: 2px dashed var(--border); border-radius: var(--radius);
  font-style: italic; margin-top: 20px;
}

/* --- PDF Preview Modal --- */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.panel-overlay.show { opacity: 1; pointer-events: auto; }
.preview-panel { position: fixed; right: -850px; top: 0; bottom: 0; width: 800px; max-width: 90%; background: #f8fafc; z-index: 1001; box-shadow: -5px 0 25px rgba(0,0,0,0.2); transition: right 0.3s ease-out; display: flex; flex-direction: column; }
.preview-panel.open { right: 0; }
.preview-header { padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.preview-header-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview-header h2 { margin: 0; font-size: 16px; color: var(--text); }
.preview-actions { display: flex; gap: 8px; }
.preview-layout-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.preview-layout-control { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 10px; font-size: 11px; color: var(--text2); }
.preview-layout-control output { color: var(--text); font-weight: 600; }
.preview-layout-control input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
#pdf-frame { flex: 1; width: 100%; border: none; background: #525659; }

@media (max-width: 600px) {
  .preview-header { padding: 10px 12px; }
  .preview-layout-controls { grid-template-columns: 1fr; gap: 8px; }
  .preview-header-main { align-items: flex-start; }
  .preview-actions { gap: 5px; }
  .preview-actions .btn { padding: 7px 9px; font-size: 11px; }
}

/* === Modal & Overlay System === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  z-index: 2000; opacity: 0; pointer-events: none; transition: 0.3s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal-card {
  background: white; width: 500px; max-width: 95%; border-radius: var(--radius);
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  overflow: hidden; display: flex; flex-direction: column; transform: translateY(20px); transition: 0.3s ease;
}
.modal-overlay.show .modal-card { transform: translateY(0); }

.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; background: var(--bg2);
}
.modal-title { font-weight: 700; color: var(--text); font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text3); }

.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 15px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; background: var(--bg1); }

/* === Form System (Editor/Config) === */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-input, .form-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text); transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--accent); }
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-row .form-group { flex: 1; margin-bottom: 0; }

/* === Import Options UI === */
.import-options { display: grid; gap: 12px; }
.import-option {
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: 0.2s; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.import-option:hover { border-color: var(--accent); background: #fffcfb; transform: translateY(-2px); }
.import-icon { font-size: 24px; margin-bottom: 8px; }
.import-label { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.import-sub { font-size: 0.8rem; color: var(--text3); }
.import-textarea { width: 100%; height: 200px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); resize: none; font-family: inherit; }

/* === Toast System === */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm); background: white; color: var(--text);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); border-left: 4px solid var(--accent);
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500;
  animation: slideIn 0.3s ease;
}
.toast-success { border-left-color: #22c55e; }
.toast-error { border-left-color: #ef4444; }
.toast-info { border-left-color: var(--accent); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === Loading Overlays === */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.8); backdrop-filter: blur(2px);
  z-index: 4000; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.loading-overlay.show { display: flex; }
.spinner { width: 40px; height: 40px; border: 3px solid #f3f3f3; border-top: 3px solid var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-text { font-weight: 600; color: var(--text2); }


/* ── i18n & AI Features ────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.lang-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #888;
  font-size: 10px;
  font-weight: 700;
  padding: 6px 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-ai-inline {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border: none;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-ai-inline:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.loading-spin {
  animation: ai-spin 1s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}

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

.field-loading {
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.1), transparent);
  background-size: 200% 100%;
  animation: field-shimmer 1.5s infinite;
}

@keyframes field-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.form-textarea {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Profile Image Upload ─────────────────────────────────────── */
.profile-upload-zone {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background: var(--bg2);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s;
  position: relative;
}

.profile-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.profile-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-preview-placeholder {
  text-align: center;
  color: var(--text3);
  font-size: 11px;
}

.photo-delete-btn, .photo-delete-btn-cv {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 10;
  transition: transform 0.2s;
}

.photo-delete-btn:hover, .photo-delete-btn-cv:hover {
  transform: scale(1.1);
  background: #c0392b;
}

.lib-item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg2);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lib-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Section Reordering Controls */
.section-move-controls {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

.cv-section:hover .section-move-controls {
  opacity: 1;
}

/* ── Add Section Tool Styles ───────────────────── */
.cv-add-section-container {
  margin: 30px auto 0;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 60;
}

.cv-add-section-btn {
  background: white;
  border: 2px dashed #D35400;
  color: #D35400;
  padding: 10px 24px;
  border-radius: 30px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.cv-add-section-btn:hover {
  background: #D35400;
  color: #fff;
  border-style: solid;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(211, 84, 0, 0.15);
}

.cv-add-section-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 15px 30px rgba(0,0,0,0.1);
  border-radius: 12px;
  width: 220px;
  padding: 8px;
  display: none;
  z-index: 100;
  animation: modalScaleIn 0.25s ease-out;
}

.cv-add-section-menu.show {
  display: block;
}

.cv-add-section-item {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}

.cv-add-section-item:hover {
  background: #f1f5f9;
  color: var(--accent);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(10px) scale(1); }
}

.section-move-btn {
  background: white;
  border: 1px solid #D35400;
  color: #D35400;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: all 0.2s;
  padding: 0;
}

.section-move-btn:hover {
  background: #D35400;
  color: white;
  transform: scale(1.1);
}

.cv-photo-placeholder {
  position: relative;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  opacity: 0;
  transition: opacity 0.2s;
}

.cv-photo-placeholder:hover .photo-overlay {
  opacity: 1;
}

/* 📊 Applications Tracker (Candidatures) Redesign */
.stats-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
  gap: 20px; 
  margin-bottom: 32px; 
}
.stat-card {
  background: #fff; padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-num { font-size: 32px; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text3); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }

.app-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
  gap: 20px; 
}
.app-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: var(--transition); position: relative;
  display: flex; flex-direction: column; gap: 14px;
}
.app-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); }

.app-card-header { 
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
}
.app-company-info { flex: 1; min-width: 0; }
.app-company { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.app-date { font-size: 11px; color: var(--text3); font-weight: 500; }

.app-title { 
  font-size: 14px; color: var(--text2); font-weight: 500; 
  line-height: 1.4;
}

.status-badge {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge.sent { background: #E0F2FE; color: #0369A1; border: 1px solid #BAe6FD; }
.status-badge.saved { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
.status-badge.interview { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; }
.status-badge.offer { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; }
.status-badge.rejected { background: #FEE2E2; color: #B91C1C; border: 1px solid #FECACA; }

.app-actions { 
  display: flex; gap: 8px; margin-top: auto; padding-top: 16px; 
  border-top: 1px solid var(--bg3); 
}
.btn-app-action {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text2);
}
.btn-app-action:hover { background: var(--bg3); color: var(--accent); border-color: var(--accent); }
.btn-app-action.danger:hover { background: #FEF2F2; color: var(--danger); border-color: var(--danger); }

/* 🎭 Premium Modal System */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  z-index: 9999; opacity: 0; transition: opacity 0.2s ease;
}
.modal-overlay.show { opacity: 1; }

.modal-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 90%; max-width: 400px; padding: 24px;
  transform: translateY(20px) scale(0.95); transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex; flex-direction: column; gap: 16px;
}
.lib-item-lang-status { display: flex; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.lang-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--bg3); color: var(--text3); opacity: 0.5; transition: var(--transition); }
.lang-badge.active { background: var(--accent-glow); color: var(--accent); opacity: 1; border: 1px solid var(--accent); }

/* Multilingual Editor Styling */
.multilingual-field-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg3);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border-left: 4px solid var(--accent);
}

.form-label-with-ai {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.lang-group-fr { border-left: 2px solid #3B82F6; padding-left: 10px; }
.lang-group-en { border-left: 2px solid #10B981; padding-left: 10px; }
.lang-group-cn { border-left: 2px solid #F59E0B; padding-left: 10px; }

.btn-ai-inline {
  background: white; border: 1px solid var(--border); border-radius: 4px;
  font-size: 10px; padding: 2px 6px; cursor: pointer; color: var(--accent);
  transition: var(--transition); font-weight: 600;
}
.btn-ai-inline:hover { background: var(--accent); color: white; border-color: var(--accent2); }

.modal-overlay.show .modal-card { transform: translateY(0) scale(1); }

.modal-title { font-size: 18px; font-weight: 800; color: var(--text); line-height: 1.2; }
.modal-text { font-size: 14px; color: var(--text2); line-height: 1.5; }

.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* Selection Grid in Modals */
.modal-choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; max-height: 400px; overflow-y: auto; padding: 4px; }
.choice-btn {
  padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); cursor: pointer; transition: var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--text2);
  width: 100%; transition: all 0.2s ease;
}
.choice-btn:hover { border-color: var(--accent); background: #fff; color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.choice-btn.active { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }
.choice-icon { font-size: 18px; }

/* List Mode for long content (like bullets) */
.modal-choice-grid.list-mode {
  grid-template-columns: 1fr;
}
.modal-choice-grid.list-mode .choice-btn {
  flex-direction: row;
  align-items: center;
  text-align: left;
  padding: 10px 16px;
  gap: 12px;
}
.modal-choice-grid.list-mode .choice-btn div:last-child {
  flex: 1;
  white-space: normal;
  line-height: 1.4;
}

/* ── Hierarchical Library Styles ── */
.lib-items-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lib-item-card {
  padding: 24px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.lib-item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}

.lib-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bg3);
}

.lib-item-main {
  display: flex;
  gap: 16px;
  align-items: center;
  flex: 1;
  min-width: 0; /* Important for flex child wrapping */
}

.lib-item-icon-circle {
  font-size: 20px;
  background: var(--bg3);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
  color: var(--accent);
}

.lib-item-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 160px; /* Leave space for absolute badges and actions */
}

.lib-item-primary-title {
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
}

.lib-item-secondary-title {
  font-size: 13px;
  color: var(--text3);
  font-weight: 500;
  opacity: 0.9;
}

.lib-item-actions {
  display: flex;
  gap: 8px;
}

.lib-item-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lib-detail-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lib-detail-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.8;
}

.lib-detail-content {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.5;
}

.lib-bullet-list {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.lib-bullet-item {
  margin-bottom: 6px;
}

.lib-bullet-item::marker {
  color: var(--primary);
}

.danger-hover:hover {
  background: #ef4444 !important;
  color: white !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* ── Inline Library Editing ─────────────────────────────────── */
.lib-item-card {
  padding: 20px;
  position: relative;
}

.lib-item-card .lib-item-lang-status {
  position: absolute;
  top: 20px;
  right: 100px; /* Room for save/delete */
  margin: 0;
  display: flex;
  gap: 6px;
}

.lang-badge {
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.lang-badge:hover {
  transform: scale(1.1);
  opacity: 1;
}

.inline-edit-field {
  position: relative;
  margin-bottom: 12px;
  background: var(--bg3);
  padding: 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: var(--transition);
  display: none; /* Hidden by default */
}

/* Show only the active language */
.lib-item-card[data-active-lang="fr"] .inline-edit-field[data-lang="fr"],
.lib-item-card[data-active-lang="en"] .inline-edit-field[data-lang="en"],
.lib-item-card[data-active-lang="cn"] .inline-edit-field[data-lang="cn"] {
  display: block;
}

/* Non-multilingual fields are always shown */
.inline-edit-field:not([data-lang]) {
  display: block;
}

.inline-edit-field.active-lang {
  border-left-color: var(--accent);
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.inline-edit-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.inline-edit-input, .inline-edit-textarea {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  padding: 4px 0;
}

.inline-edit-textarea {
  min-height: 40px;
  resize: vertical;
}

.inline-ai-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0.1;
  transition: opacity 0.2s;
}

.inline-edit-field:hover .inline-ai-btn {
  opacity: 1;
}

.lib-card-save-btn {
  background: var(--success);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.lib-card-save-btn:hover {
  transform: scale(1.1);
  background: #059669;
}

.lib-card-save-btn.changed {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.highlight-flash {
  animation: flash-border 1.5s ease-out;
}

@keyframes flash-border {
  0% { background: var(--accent-glow); }
  100% { background: transparent; }
}

/* API Key Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-trial {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.badge-user {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
