/* ============================================================
   responsive.css — Mobile & tablet breakpoints
   ============================================================ */

/* ── Tablet (≤1100px) ── */
@media (max-width: 1100px) {
  .stats-row      { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Tablet portrait (≤900px) ── */
@media (max-width: 900px) {
  /* Comment panel hidden by default, slides up when toggled */
  .comment-panel { display: none; }
  .comment-panel.mobile-open {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0; top: auto;
    height: 65vh;
    border-top: 1px solid var(--border);
    border-left: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 300;
    animation: slideUpPanel 0.3s ease;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  }

  /* Dim overlay behind the panel */
  .comment-panel-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 299;
  }
  .comment-panel-backdrop.active { display: block; animation: fadeIn 0.2s ease; }

  /* Show the floating toggle button */
  .mobile-comments-btn { display: flex !important; }

  /* Reviewer vertical toolbar → replaced by bottom strip */
  .reviewer-toolbar-v { display: none; }
  .reviewer-tool-strip { display: flex !important; }

  /* Version panel repositions */
  .version-panel { right: 16px; top: auto; bottom: 80px; }
}

@keyframes slideUpPanel { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); z-index: 101; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .sidebar-overlay.active { opacity: 1; pointer-events: all; }

  .main-content { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar-hamburger { display: flex; }
  .topbar-search    { display: none; }

  .stats-row      { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .projects-grid  { grid-template-columns: repeat(2, 1fr); }
  .quick-actions  { grid-template-columns: 1fr 1fr; }
  .page-content   { padding: 16px; padding-bottom: 80px; }
  .bottom-nav     { display: flex; }
  .login-card     { padding: 28px 24px; margin: 16px; }
  .compare-body   { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .reviewer-project-name { display: none; }
  .reviewer-divider      { display: none; }
  .version-panel  { right: 8px; width: 240px; }
  .viewer-toolbar { overflow-x: auto; gap: 4px; padding: 0 12px; }
}

/* ── Small mobile (≤480px) ── */
@media (max-width: 480px) {
  .stats-row     { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value    { font-size: 22px; }
  .projects-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .folders-grid  { grid-template-columns: 1fr 1fr; }
  .login-card    { margin: 0; border-radius: 0; min-height: 100vh; }
  .pdf-area      { padding: 12px; }
  .modal         { border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; max-width: 100%; }
  .modal-overlay { align-items: flex-end; }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .viewer-toolbar, .comment-panel,
  .version-panel, .modal-overlay, .toast-container,
  .bottom-nav, .sidebar-overlay,
  .mobile-comments-btn, .reviewer-tool-strip { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
}

/* ════════════════════════════════════════════════════════
   MOBILE-ONLY COMPONENTS (hidden on desktop via display:none)
════════════════════════════════════════════════════════ */

/* Floating "Comments" button — appears in viewer + reviewer on mobile */
.mobile-comments-btn {
  display: none; /* shown via media query above */
  position: fixed;
  bottom: 76px; right: 16px;
  z-index: 290;
  align-items: center;
  gap: 8px;
  padding: 11px 18px 11px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 28px;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(59,130,246,0.45);
  transition: all 0.2s;
}
.mobile-comments-btn:hover  { transform: translateY(-2px); }
.mobile-comments-btn:active { transform: scale(0.97); }
.mobile-comments-btn .btn-badge {
  background: white;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Drag handle on top of slide-up comment panel */
.comment-panel-drag-handle {
  display: none;
  width: 100%;
  padding: 10px 0 2px;
  justify-content: center;
  flex-shrink: 0;
  cursor: grab;
}
.comment-panel-drag-handle-bar {
  width: 36px; height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
}
@media (max-width: 900px) {
  .comment-panel-drag-handle { display: flex; }
}

/* Reviewer tool strip — horizontal row replacing vertical toolbar on mobile */
.reviewer-tool-strip {
  display: none; /* shown via media query above */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 250;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.reviewer-tool-strip .tool-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-right: 4px;
}

/* ════════════════════════════════════════════════════════
   EDITOR MOBILE TOOL STRIP
════════════════════════════════════════════════════════ */

/* Editor tool strip — same style as reviewer strip */
.editor-tool-strip {
  display: none; /* shown via media query */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 250;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  overflow-x: auto;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

/* Active tool highlight synced to strip */
.editor-tool-strip .tool-btn.active,
.reviewer-tool-strip .tool-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

@media (max-width: 900px) {
  /* Show editor strip when viewer is open */
  .editor-tool-strip { display: flex; }

  /* Hide annotation tool buttons from the top toolbar on mobile
     (they live in the bottom strip instead) */
  .desktop-tool { display: none !important; }

  /* Give the PDF area bottom padding so strip doesn't cover content */
  #page-viewer .pdf-area    { padding-bottom: 70px; }
  #view-reviewer .pdf-area  { padding-bottom: 70px; }

  /* Move floating comments button above the tool strip */
  .mobile-comments-btn { bottom: 68px; }

  /* Shrink toolbar so back + title + version/share still fit */
  .viewer-toolbar {
    gap: 8px;
    padding: 0 14px;
    overflow: visible;
  }
  .viewer-toolbar-center { display: none; } /* all in strip now */
  .viewer-project-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
  }
}

@media (max-width: 480px) {
  .editor-tool-strip  { gap: 6px; padding: 0 8px; }
  .reviewer-tool-strip { gap: 6px; padding: 0 8px; }
  /* Even smaller tool buttons on tiny screens */
  .editor-tool-strip .tool-btn,
  .reviewer-tool-strip .tool-btn { width: 32px; height: 32px; font-size: 13px; }
}
