/* ============================================
   SYSTEM THEME VARIABLES
   ============================================ */
   :root {
    --bg-primary:    #ffffff;
    --bg-secondary:  #f8f9fa;
    --bg-card:       #ffffff;
    --text-primary:  #1a1a2e;
    --text-secondary:#6c757d;
    --border-color:  #dee2e6;
    --shadow:        0 4px 20px rgba(0,0,0,0.08);
    --accent:        #4361ee;
    --accent-hover:  #3a56d4;
    --success:       #2ecc71;
    --danger:        #e74c3c;
    --warning:       #f39c12;
    --info:          #3498db;
    --transition:    all 0.3s ease;
  }
  
  @media (prefers-color-scheme: dark) {
    :root {
      --bg-primary:    #0f0f13;
      --bg-secondary:  #1a1a24;
      --bg-card:       #1e1e2e;
      --text-primary:  #e2e8f0;
      --text-secondary:#94a3b8;
      --border-color:  #2d2d3d;
      --shadow:        0 4px 20px rgba(0,0,0,0.4);
    }
  }
  
  /* ============================================
     BASE RESET
     ============================================ */
  *, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    transition: var(--transition);
    min-height: 100vh;
  }
  
  /* ============================================
     NAVBAR
     ============================================ */
  .navbar {
    background-color: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 12px 24px;
  }
  
  .navbar-brand {
    color: var(--text-primary) !important;
    font-size: 1.4rem !important;
  }
  
  .theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 50px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
  }
  
  .theme-toggle:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
  }
  
  /* ============================================
     HERO
     ============================================ */
  .hero {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-bottom: 1px solid var(--border-color);
    padding: 50px 20px;
    text-align: center;
  }
  
  .hero h1 {
    color: var(--text-primary);
    font-size: 2.2rem;
    font-weight: 700;
  }
  
  .hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 8px;
  }
  
  /* ============================================
     FEATURE TABS
     ============================================ */
     .tabs-scroll {
      flex-wrap: wrap;
      overflow-x: visible;
      padding-bottom: 4px;
      scrollbar-width: none;
      justify-content: center;
      gap: 4px;
    }
    
    .tabs-scroll::-webkit-scrollbar { display: none; }
    
    .nav-pills .nav-link {
      color: var(--text-secondary);
      border-radius: 50px;
      padding: 7px 14px;
      margin: 0;
      transition: var(--transition);
      border: 1px solid transparent;
      font-weight: 500;
      white-space: nowrap;
      font-size: 0.82rem;
    }
  
  .nav-pills .nav-link:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
  }
  
  .nav-pills .nav-link.active {
    background-color: var(--accent);
    color: white !important;
    border-color: var(--accent);
  }

  .nav-pills .nav-link.go-ai-tab.active {
    background-color: #c53030;
    border-color: #c53030;
  }
  
  /* ============================================
     MAIN LAYOUT — 2-column grid, centered on screen
     Tool panel (left) capped at 80% width (−20%);
     preview pane (right) set to 390px (+15% from former 340px);
     whole layout centered horizontally with max-width constraint.
     ============================================ */
  .main-layout {
    display: grid;
    grid-template-columns: 1fr 410px;
    gap: 24px;
    align-items: start;
    max-width: 1280px;
    margin: 0 auto;
  }

  .main-layout > .card       { min-width: 0; width: 90%; max-width: 90%; justify-self: center; }
  .main-layout > .preview-panel { min-width: 0; width: 100%; justify-self: center; }

  /* ============================================
     SEO CONTENT BLOCK
     Per-route unique content rendered server-side, collapsed inside
     a <details> accordion so the tool page stays clean. Content remains
     in the DOM and is indexed by search engines.
     ============================================ */
  .seo-block {
    max-width: 900px;
    margin: 32px auto 60px;
    padding: 0 24px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.65;
  }
  .seo-block .seo-details {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.18s ease;
  }
  .seo-block .seo-details[open] {
    border-color: var(--accent, var(--border-color));
  }
  .seo-block .seo-summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    user-select: none;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.18s ease;
  }
  .seo-block .seo-summary::-webkit-details-marker { display: none; }
  .seo-block .seo-summary::after {
    content: '⌄';
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    margin-left: auto;
  }
  .seo-block .seo-details[open] .seo-summary::after {
    transform: rotate(180deg);
  }
  .seo-block .seo-summary:hover {
    background: rgba(255, 255, 255, 0.02);
  }
  .seo-block .seo-summary-label {
    font-size: 0.95rem;
  }
  .seo-block .seo-summary-hint {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: auto;
    margin-right: 8px;
  }
  .seo-block .seo-details-body {
    padding: 4px 24px 24px;
    border-top: 1px solid var(--border-color);
  }
  .seo-block h2.seo-h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 18px 0 10px;
    line-height: 1.3;
  }
  .seo-block h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 28px 0 10px;
    letter-spacing: -0.01em;
  }
  .seo-block h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 14px 0 6px;
  }
  .seo-block p, .seo-block li {
    color: var(--text-secondary);
  }
  .seo-block .seo-hero {
    font-size: 0.98rem;
    margin-bottom: 8px;
  }
  .seo-block .seo-howto {
    margin: 0 0 0 8px;
    padding-left: 16px;
  }
  .seo-block .seo-howto li {
    margin-bottom: 6px;
  }
  .seo-block .seo-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 8px 18px;
  }
  .seo-block .seo-features li {
    position: relative;
    padding-left: 22px;
    font-size: 0.93rem;
  }
  .seo-block .seo-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--success, #2ecc71);
    font-weight: 700;
  }
  .seo-block .seo-faq-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 10px;
  }
  .seo-block .seo-faq-item h3 {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 0.95rem;
  }
  .seo-block .seo-faq-item p {
    margin: 0;
    font-size: 0.9rem;
  }
  .seo-block .seo-related {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .seo-block .seo-related a {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.18s ease;
  }
  .seo-block .seo-related a:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  @media (max-width: 768px) {
    .seo-block { padding: 0 16px; margin: 24px auto 48px; }
    .seo-block h2.seo-h1 { font-size: 1.1rem; }
    .seo-block .seo-summary { padding: 14px 18px; }
    .seo-block .seo-summary-hint { display: none; }
    .seo-block .seo-details-body { padding: 4px 18px 20px; }
  }

  @media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    .main-layout > .card { width: 100%; max-width: 100%; }
  }
  
  /* ============================================
     CARDS
     ============================================ */
  .card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow);
    transition: var(--transition);
  }
  
  /* ============================================
     DRAG & DROP ZONE
     ============================================ */
  .drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--bg-secondary);
    position: relative;
  }
  
  .drop-zone:hover,
  .drop-zone.dragover {
    border-color: var(--accent);
    background-color: rgba(67, 97, 238, 0.05);
  }
  
  .drop-zone.dragover { transform: scale(1.01); }
  
  .drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
  }
  
  .drop-zone-icon {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 12px;
  }
  
  .drop-zone-text { color: var(--text-secondary); font-size: 0.95rem; }
  .drop-zone-text strong { color: var(--accent); }
  
  /* ============================================
     FILE LIST
     ============================================ */
  .file-list { margin-top: 16px; }
  
  .file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
  }
  
  .file-item-icon { font-size: 1.4rem; color: var(--danger); }
  .file-item-info { flex: 1; min-width: 0; }
  
  .file-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .file-item-size { font-size: 0.75rem; color: var(--text-secondary); }
  
  .file-item-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    padding: 2px 6px;
    border-radius: 6px;
    flex-shrink: 0;
  }
  
  .file-item-remove:hover {
    color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
  }
  
  /* ============================================
     PROGRESS BAR
     ============================================ */
  .progress-container { display: none; margin-top: 16px; }
  
  .progress-container.show {
    display: block;
    animation: fadeIn 0.3s ease;
  }
  
  .progress {
    height: 8px;
    border-radius: 50px;
    background-color: var(--bg-secondary);
    overflow: hidden;
  }
  
  .progress-bar {
    background: linear-gradient(90deg, var(--accent), #7209b7);
    border-radius: 50px;
    transition: width 0.4s ease;
    animation: progressPulse 1.5s infinite;
  }
  
  @keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
  }
  
  .progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
  }
  
  /* ============================================
     BUTTONS
     ============================================ */
  .btn-action {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 16px;
    display: block;
    text-align: center;
  }
  
  .btn-action:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.3);
    color: white;
    text-decoration: none;
  }
  
  .btn-action:active  { transform: translateY(0); }
  .btn-action:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
  
  /* ============================================
     OUTPUT TYPE BUTTONS
     ============================================ */
  .output-type-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary);
    transition: all 0.2s ease;
  }
  
  .output-type-btn.active {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
  }
  
  /* ============================================
     PREVIEW PANEL (right column)
     ============================================ */
  .preview-panel {
    position: sticky;
    top: 20px;
  }
  
  .preview-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
  }
  
  .preview-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
  }
  
  .preview-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
  }
  
  .preview-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.3;
  }
  
  .preview-file-info { animation: fadeIn 0.3s ease; }
  
  .preview-thumbnail {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-height: 180px;
  }
  
  .preview-thumbnail canvas { max-width: 100%; height: auto; display: block; }
  .preview-thumbnail-icon { font-size: 4rem; color: var(--danger); opacity: 0.7; }
  
  .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    gap: 8px;
  }
  
  .info-row:last-child { border-bottom: none; }
  .info-label  { color: var(--text-secondary); font-weight: 500; flex-shrink: 0; }
  .info-value  { color: var(--text-primary); font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  
  /* ============================================
     RESULT SECTION
     ============================================ */
  .result-section { display: none; margin-top: 20px; animation: fadeIn 0.4s ease; }
  .result-section.show { display: block; }
  
  .result-card { border-radius: 12px; padding: 20px; border: none; }
  
  .result-card.success {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3) !important;
  }
  
  .result-card.error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3) !important;
  }
  
  .download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    margin-top: 12px;
    margin-right: 8px;
  }
  
  .download-btn:hover { background: #27ae60; transform: translateY(-2px); color: white; }
  
  /* ============================================
     MERGE FILE ITEMS
     ============================================ */
  .merge-file-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
    transition: border-color 0.2s;
  }
  
  .merge-file-item.dragging  { opacity: 0.5; border: 2px dashed var(--accent); }
  .merge-file-item.drag-over { border-color: var(--accent); background: rgba(67, 97, 238, 0.05); }
  
  .merge-file-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  
  .merge-file-order {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
  }
  
  .merge-file-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  
  .merge-file-size { font-size: 0.75rem; color: var(--text-secondary); flex-shrink: 0; }
  .merge-file-controls { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
  
  .reorder-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
  }
  
  .reorder-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
  
  .page-range-input {
    width: 100%;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    transition: all 0.2s;
  }
  
  .page-range-input:focus { outline: none; border-color: var(--accent); }
  .page-range-input::placeholder { color: var(--text-secondary); }
  
  /* ============================================
     COMPRESSION LEVEL CARDS
     ============================================ */
  .compress-level-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .compress-level-card:hover  { border-color: var(--accent); background: rgba(67, 97, 238, 0.05); }
  .compress-level-card.active { border-color: var(--accent); background: rgba(67, 97, 238, 0.08); }
  
  .compress-level-header { display: flex; align-items: center; gap: 10px; }
  
  .compress-level-radio {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    transition: all 0.2s;
  }
  
  .compress-level-radio.active { border-color: var(--accent); background: var(--accent); }
  
  .compress-level-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
  .compress-level-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
  .compress-level-desc { font-size: 0.75rem; color: var(--text-secondary); }
  
  .compress-level-badge {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
  }
  
  /* ============================================
     COMPARE RESULTS
     ============================================ */
  .compare-results { margin-top: 20px; animation: fadeIn 0.3s ease; }
  .compare-results.d-none { display: none; }
  
  .similarity-score {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
  }
  
  .similarity-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
  }
  
  #similarityNumber { font-size: 1.2rem; font-weight: 700; line-height: 1; }
  .similarity-label { font-size: 0.7rem; opacity: 0.8; }
  .similarity-stats { display: flex; gap: 16px; flex-wrap: wrap; }
  .stat-item { display: flex; flex-direction: column; align-items: center; }
  .stat-value { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
  .stat-label { font-size: 0.72rem; color: var(--text-secondary); }
  .stat-item.removed .stat-value { color: var(--danger); }
  .stat-item.added   .stat-value { color: var(--success); }
  
  .diff-header { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
  
  .diff-header-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
  }
  
  .diff-header-item.removed { background: rgba(231,76,60,0.1);  color: var(--danger); }
  .diff-header-item.added   { background: rgba(46,204,113,0.1); color: var(--success); }
  
  .diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
  }
  
  .diff-panel { padding: 10px; font-size: 0.78rem; line-height: 1.6; overflow-x: hidden; }
  
  .diff-line {
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    word-break: break-word;
    font-family: monospace;
  }
  
  .diff-line.removed { background: rgba(231,76,60,0.15);  color: var(--danger);  border-left: 3px solid var(--danger); }
  .diff-line.added   { background: rgba(46,204,113,0.15); color: var(--success); border-left: 3px solid var(--success); }
  .diff-line.common  { color: var(--text-secondary); }
  
  /* ============================================
     OFFICE FORMAT BADGES
     ============================================ */
  .supported-formats {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid var(--border-color);
  }
  
  .fmt-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 500; }
  .fmt-word  { background: rgba(67,97,238,0.15);  color: var(--accent); }
  .fmt-ppt   { background: rgba(231,76,60,0.15);  color: var(--danger); }
  .fmt-excel { background: rgba(46,204,113,0.15); color: var(--success); }
  .fmt-txt   { background: rgba(243,156,18,0.15); color: var(--warning); }
  .fmt-html  { background: rgba(52,152,219,0.15); color: var(--info); }
  
  /* ============================================
     ANNOTATE — fixed full-screen overlay
     Position: fixed, direct body child
     Zero interference from any parent CSS
     ============================================ */
  
  /* Hidden by default */
  #annotate-fullscreen-wrapper {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    z-index: 1000;
    overflow: hidden;
    flex-direction: column;
  }
  
  /* Shown via JS: annotateWrapper.style.display = 'flex' */
  
  /* Top bar */
  .annotate-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 56px;
    min-height: 56px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
  }
  
  .annotate-topbar h5 {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .annotate-status {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  
  .annotate-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
  }
  
  /* Main body below topbar */
  .annotate-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    flex: 1;
    min-height: 0;
    height: calc(100vh - 56px);
  }
  
  /* Syncfusion viewer — fills left column */
  #sfPdfViewer {
    width: 100% !important;
    height: 100% !important;
    display: block;
    min-height: 0;
  }
  
  /* Right preview column */
  .annotate-preview-col {
    border-left: 1px solid var(--border-color);
    background: var(--bg-card);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  
  .annotate-preview-col .preview-title {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
  }
  
  .annotate-preview-col #annotatePreviewContent {
    padding: 12px;
    flex: 1;
  }
  
  /* Open PDF button */
  .annotate-open-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
  }
  
  .annotate-open-label:hover { background: var(--accent-hover); }
  
  /* Close button */
  .annotate-close-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: var(--transition);
  }
  
  .annotate-close-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
  
  @media (max-width: 900px) {
    .annotate-body { grid-template-columns: 1fr; }
    .annotate-preview-col { display: none; }
  }
  
  /* ============================================
     ANIMATIONS
     ============================================ */
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  
  .feature-panel { animation: fadeIn 0.3s ease; }
  
  /* ============================================
     RESPONSIVE
     ============================================ */
  @media (max-width: 576px) {
    .nav-pills .nav-link { padding: 8px 14px; font-size: 13px; }
    .hero h1             { font-size: 1.6rem; }
    .drop-zone           { padding: 30px 15px; }
    .similarity-score    { flex-direction: column; text-align: center; }
  }
  /* AI Assistant text colour — controlled by colour picker */
#summaryTitle,
#summaryOverview,
#summaryKeyPoints li,
#summaryMeta,
#aiSummaryResult h6,
#aiSummaryResult .card-body {
  color: var(--ai-text-color, #000000) !important;
}

#chatThread .bg-white,
#chatThread .border {
  color: var(--ai-text-color, #000000) !important;
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

#aiSummaryResult .card,
#aiSummaryResult .bg-light {
  background: var(--bg-card) !important;
}

#chatThread {
  background: var(--bg-secondary) !important;
}
/* AI Assistant — always white card background */
#aiSummaryResult .card,
#aiSummaryResult .bg-light,
#aiSummaryResult .card-body {
  background: #ffffff !important;
}

#chatThread {
  background: #ffffff !important;
}

#chatThread .border {
  background: #ffffff !important;
}
/* Phase C — Translate panel mobile polish.
   Mode toggle: stack vertically on narrow screens so labels don't
   truncate. Format dropdown is already responsive via form-select.
   "What's the difference?" link wraps under the OUTPUT MODE label
   on phones to avoid horizontal overflow. */
@media (max-width: 480px) {
  #panel-translatePdf .btn-group[aria-label="Output mode"] {
    flex-direction: column;
  }
  #panel-translatePdf .btn-group[aria-label="Output mode"] > label.btn {
    border-radius: 10px !important;
    margin-bottom: 4px;
  }
  #panel-translatePdf #translateModeHelp {
    display: block;
    margin-top: 4px;
  }
  #panel-translatePdf #translatePreviewContent {
    font-size: 0.72rem;
  }
}
/* ============================================
   GO-AI FLASHCARDS
   ============================================ */

/* ── Config rows (Option A layout) ── */
.fc-config-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.fc-config-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 4px;
}
@media (max-width: 560px) {
  .fc-config-2col { grid-template-columns: 1fr; }
}

.fc-option-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.fc-opt-hint {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
  opacity: 0.7;
}

.fc-title-input {
  border-radius: 10px;
  font-size: 0.95rem;
  padding: 10px 14px;
}
.fc-title-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}

.fc-section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 20px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.fc-section-divider::before,
.fc-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.fc-generate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #c53030);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
}
.fc-generate-btn:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
}
.fc-generate-btn:active { transform: translateY(0); }
.fc-generate-btn:disabled { opacity: 0.5; cursor: default; }

/* Pill selectors */
.fc-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fc-pill {
  padding: 5px 13px;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.4;
}
.fc-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.fc-pill-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff !important;
}

.fc-custom-input {
  max-width: 80px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
  border-radius: 10px;
}

/* Stats bar */
.fc-stats-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fc-stat {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.fc-stat-lbl { color: var(--text-secondary); font-weight: 400; }
.fc-progress-wrap { flex: 1; }
.fc-progress-track {
  height: 7px;
  border-radius: 50px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.fc-progress-fill {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--accent), #c53030);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.fc-stat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
}
.fc-badge-know   { background: rgba(46,204,113,0.15); color: #2ecc71; }
.fc-badge-review { background: rgba(243,156,18,0.15);  color: #f39c12; }

/* 3-D flip card */
.fc-scene {
  perspective: 900px;
  width: 100%;
  height: 240px;
  cursor: pointer;
  margin: 0 auto;
  user-select: none;
}
.fc-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 16px;
}
.fc-card.is-flipped {
  transform: rotateY(180deg);
}
.fc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}
.fc-front {
  background: var(--bg-card);
}
.fc-back {
  background: linear-gradient(135deg, rgba(67,97,238,0.06), rgba(197,48,48,0.04));
  transform: rotateY(180deg);
}
.fc-face-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.fc-face-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.97rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.55;
  text-align: center;
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
}
.fc-tap-hint {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  opacity: 0.7;
}

/* Answer action buttons (inside back face) */
.fc-action-row {
  display: flex;
  gap: 8px;
}
.fc-action-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 10px;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.fc-btn-review {
  background: rgba(243,156,18,0.15);
  color: #d4820a;
}
.fc-btn-review:hover { background: rgba(243,156,18,0.28); }
.fc-btn-know {
  background: rgba(46,204,113,0.15);
  color: #27ae60;
}
.fc-btn-know:hover { background: rgba(46,204,113,0.28); }

/* Navigation row */
.fc-nav-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.fc-nav-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.fc-nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.fc-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.fc-nav-flip {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  flex: 1.4;
}
.fc-nav-flip:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Deck list */
#fcDeckList {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.fc-deck-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.fc-deck-item:hover { border-color: var(--accent); }
.fc-deck-item.fc-active-item { border-color: var(--accent); background: rgba(67,97,238,0.05); }
.fc-deck-num {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.fc-deck-q {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}
.fc-deck-a {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.35;
}
.fc-deck-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 50px;
  font-weight: 600;
  white-space: nowrap;
  align-self: flex-start;
}
.fc-status-know   { background: rgba(46,204,113,0.15); color: #27ae60; }
.fc-status-review { background: rgba(243,156,18,0.15);  color: #d4820a; }
.fc-status-unseen { background: var(--bg-primary); color: var(--text-secondary); border: 1px solid var(--border-color); }

/* Pro badge */
.fc-badge-pro {
  background: linear-gradient(135deg, #c53030, var(--accent));
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  letter-spacing: 0.03em;
}

/* Completion card */
.fc-complete-card {
  text-align: center;
  padding: 32px 24px 28px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.fc-complete-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 10px;
}
.fc-complete-num {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}
.fc-complete-lbl {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 2px;
}
.fc-col-know   { color: #2ecc71; }
.fc-col-review { color: #f39c12; }