* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-color: #f8f9fa; line-height: 1.5; }
.header { background: white; border-bottom: 1px solid #e9ecef; padding: 1rem 2rem; position: relative; z-index: 100; transition: transform 0.25s ease, opacity 0.25s ease, max-height 0.25s ease, padding 0.25s ease, margin 0.25s ease; max-height: 200px; }
.header.header-hidden { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; border-bottom: 0; overflow: hidden; }
.header h1 { font-size: 1.5rem; color: #212529; margin-bottom: 0.5rem; }
.header-meta { display: flex; gap: 2rem; font-size: 0.875rem; color: #6c757d; }
.main-container { display: grid; grid-template-columns: 1fr var(--sidebar-width, 400px); gap: 1rem; padding: 1rem 2rem; max-height: calc(100vh - 120px); }
.image-panel { background: white; border-radius: 8px; padding: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); position: relative; overflow: auto; }
.image-container { position: relative; display: block; width: 100%; }
.main-image { border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: block; width: 100%; height: auto; }
.bbox-overlay { position: absolute; border: 2px solid; border-radius: 3px; cursor: pointer; transition: all 0.2s ease; }
.bbox-overlay:hover { border-width: 3px; box-shadow: 0 0 0 2px rgba(255,255,255,0.8); }
.bbox-overlay.active { border-width: 3px; box-shadow: 0 0 0 2px rgba(255,255,255,0.9); }
.bbox-label { position: absolute; top: -24px; left: 0; background: white; color: inherit; padding: 2px 8px; font-size: 11px; font-weight: 600; border: 1px solid; border-radius: 12px; white-space: nowrap; }
.annotations-panel { background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); position: relative; overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.resize-handle { position: absolute; left: -6px; top: 0; width: 12px; height: 100%; cursor: col-resize; z-index: 5; background: transparent; }
.resize-handle::after { content: ""; position: absolute; left: 5px; top: 0; width: 2px; height: 100%; background: #e9ecef; }
.annotations-header { padding: 1rem; border-bottom: 1px solid #e9ecef; background: #f8f9fa; display: flex; flex-direction: column; align-items: stretch; gap: 0.5rem; }
.annotations-header h3 { font-size: 1.1rem; color: #212529; margin-bottom: 0.25rem; }
.header-actions { margin-left: auto; display: flex; gap: 0.5rem; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.annotations-list { flex: 1; overflow-y: auto; padding: 0.5rem; }
.issue-group { border: 1px solid #e9ecef; border-radius: 8px; margin-bottom: 0.75rem; background: #fff; }
.issue-title { padding: 0.6rem 0.75rem; font-weight: 700; color: #212529; border-bottom: 1px solid #e9ecef; background: #f8f9fa; }
.annotation-item { border: 1px solid #e9ecef; border-radius: 6px; margin-bottom: 0.5rem; transition: all 0.2s ease; cursor: pointer; }
.annotation-item:hover { border-color: #adb5bd; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.annotation-item.active { border-color: inherit; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.annotation-header { padding: 0.75rem; display: flex; align-items: center; justify-content: space-between; background: #fafafa; }
.annotation-item.expanded .annotation-header { border-bottom: 1px solid #e9ecef; }
.annotation-id { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.annotation-color-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid; }
.annotation-details { display: none; padding: 1rem 0.75rem; }
.annotation-item.expanded .annotation-details { display: block; }
.detail-section { margin-bottom: 1rem; }
.detail-label { font-weight: 600; color: #495057; font-size: 0.8rem; margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-content { font-size: 0.875rem; color: #212529; line-height: 1.4; }
.cropped-preview { width: 100%; max-width: 200px; border-radius: 4px; border: 1px solid #dee2e6; margin-top: 0.5rem; }
.position-size { display: flex; gap: 1rem; font-size: 0.8rem; color: #6c757d; margin-top: 0.5rem; }
.controls { padding: 0.75rem; border-top: 1px solid #e9ecef; background: #f8f9fa; display: flex; gap: 0.5rem; }
.btn { padding: 0.4rem 0.8rem; font-size: 0.8rem; border: 1px solid #dee2e6; border-radius: 4px; background: white; cursor: pointer; transition: all 0.2s ease; }
.btn:hover { background: #e9ecef; }
.env-warning { margin-top: 8px; font-size: 0.85rem; color: #856404; background: #fff3cd; border: 1px solid #ffeeba; padding: 0.5rem 0.75rem; border-radius: 4px; }
@media (max-width: 1200px) { .main-container { grid-template-columns: 1fr var(--sidebar-width, 350px); } }
@media (max-width: 768px) { 
  :root { --mobile-image-max-height: 45vh; }
  .header { padding: 1rem; }
  .main-container { padding: 0.5rem 1rem; grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 0.75rem; max-height: none; }
  .image-panel { position: sticky; top: 0; z-index: 50; padding: 0; background: white; box-shadow: none; overflow: visible; }
  .image-container { width: 100%; }
  .main-image { width: 100%; height: auto; object-fit: contain; max-height: var(--mobile-image-max-height); }
  .annotations-panel { max-height: none; }
  .annotations-list { overflow: visible; }
}

/* Lightbox overlay */
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 1000; }
.lightbox-backdrop.open { display: flex; }
.lightbox-content { position: relative; max-width: 92vw; max-height: 92vh; }
.lightbox-img { display: block; max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.lightbox-close { position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; border-radius: 16px; background: white; border: 1px solid #dee2e6; color: #212529; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.lightbox-close:hover { background: #f1f3f5; }

