/* ═══════════════════════════════════════════════════════════════
   SPLIT SCREEN VIEWER LAYOUT
   ═══════════════════════════════════════════════════════════════ */

/* Modal & Container */
.image-viewer-modal {
  overflow: hidden;
}

.viewer-backdrop {
  pointer-events: none;
}

.viewer-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Custom Scrollbar Styling */
.viewer-header::-webkit-scrollbar,
.right-tools-panel::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.viewer-header::-webkit-scrollbar-track,
.right-tools-panel::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 3px;
}

.viewer-header::-webkit-scrollbar-thumb,
.right-tools-panel::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 3px;
}

.viewer-header::-webkit-scrollbar-thumb:hover,
.right-tools-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.7);
}

/* Thin scrollbar for Firefox */
.viewer-header,
.right-tools-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.5) rgba(15, 23, 42, 0.5);
}

/* ═══════════════════════════════════════════════════════════════
   HEADER - SINGLE LINE
   ═══════════════════════════════════════════════════════════════ */
.viewer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  /* Reduce padding to save space */
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  flex-shrink: 0;
  min-height: 45px;
  /* Reduce header height */
  overflow-x: auto;
  /* Allow horizontal scroll on small screens */
  overflow-y: hidden;
}

/* File Info Group */
.file-info-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.filename-input {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e2e8f0;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 120px;
  max-width: 200px;
  transition: all 0.2s;
}

.filename-input:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.9);
}

.filename-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.format-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid;
  flex-shrink: 0;
}

.format-badge.png {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.4);
}

.format-badge.jpg {
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.4);
}

.format-badge.webp {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.4);
}

.format-badge.svg {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.4);
}

/* Toolbar Menu */
.toolbar-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.toolbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.toolbar-item:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  transform: translateY(-1px);
}

.toolbar-item.primary {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.toolbar-item.primary:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.5);
  color: #93c5fd;
  transform: translateY(-1px);
}

.toolbar-item .item-icon {
  font-size: 1rem;
}

.toolbar-item .item-label {
  font-size: 0.85rem;
}

/* Export Format Dropdown */
.toolbar-item.export-format {
  padding: 0;
  background: transparent;
  border: none;
}

.format-select {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #94a3b8;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.format-select:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.format-select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
}

/* Close Button */
.close-viewer {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  color: #ef4444;
  font-size: 1.4rem;
  width: 36px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  font-weight: 300;
  line-height: 1;
}

.close-viewer:hover {
  background: rgba(239, 68, 68, 0.4);
  border-color: #ef4444;
  transform: scale(1.1);
}

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT - SPLIT SCREEN
   ═══════════════════════════════════════════════════════════════ */
.viewer-main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
  min-height: calc(100vh - 55px);
  /* Extend closer to bottom */
  height: calc(100vh - 55px);
}

/* Left Side - Image Viewer (Full Width) */
.viewer-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f172a;
  min-width: 0;
}

/* Image Display Takes Full Space */
.viewer-content .image-display-area {
  flex: 1;
  min-height: 0;
}

/* Tool Settings Panel - Floating Draggable Overlay */
.viewer-content .viewer-tools {
  position: absolute;
  right: 110px;
  top: 70px;
  width: 320px;
  max-height: calc(100vh - 70px - 90px);
  /* top offset (70) + bottom clearance (90) */
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(15, 23, 42, 0.75);
  /* More transparent to see image below */
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: 20px;
  /* Reduced - max-height now handles spacing */
}

/* Custom Scrollbar for Tools Panel */
.viewer-content .viewer-tools::-webkit-scrollbar {
  width: 8px;
}

.viewer-content .viewer-tools::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 10px;
}

.viewer-content .viewer-tools::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.6);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.viewer-content .viewer-tools::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.8);
}

/* Firefox Scrollbar */
.viewer-content .viewer-tools {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.6) rgba(15, 23, 42, 0.4);
}

.viewer-content .viewer-tools.active {
  display: block;
}

.viewer-content .viewer-tools:has(.tool-section:not(.hidden)) {
  display: block;
}

/* Draggable Header for Tools Panel */
.viewer-tools::before {
  content: '⋮⋮ Drag Here ⋮⋮';
  position: sticky;
  top: 0;
  display: block;
  padding: 10px 8px;
  text-align: center;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  cursor: move;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  z-index: 1;
  border-radius: 10px 10px 0 0;
  transition: all 0.2s;
}

.viewer-tools::before:hover {
  background: rgba(30, 41, 59, 0.95);
  color: #bfdbfe;
}

/* Tool Sections Inside Floating Panel */
.viewer-tools .tool-section {
  padding: 16px;
  background: transparent;
}

.viewer-tools .tool-section:last-child {
  padding-bottom: 20px;
  /* Reduced - max-height provides clearance */
}

.viewer-tools .tool-section h4 {
  color: #60a5fa;
  font-size: 0.95rem;
  margin: 0 0 12px 0;
  padding: 4px 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  cursor: move;
  user-select: none;
  border-radius: 4px;
  transition: all 0.2s;
}

.viewer-tools .tool-section h4:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
}

.viewer-tools .tool-section.hidden {
  display: none;
}

/* Buttons inside tool sections */
.viewer-tools button {
  background: rgba(30, 41, 59, 0.6);
  /* More transparent */
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  /* Brighter for visibility */
  transition: all 0.2s;
}

.viewer-tools button:hover {
  background: rgba(30, 41, 59, 0.85);
  /* Less transparent on hover */
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* Right Side - Tools Panel */
.right-tools-panel {
  width: 90px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 10px 80px 10px;
  /* Large bottom padding ensures last button fully visible */
  background: rgba(15, 23, 42, 0.3);
  /* Maximum transparency to see image below */
  backdrop-filter: blur(8px);
  border-left: 2px solid rgba(255, 255, 255, 0.15);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

/* Custom Scrollbar for Right Tools Panel */
.right-tools-panel::-webkit-scrollbar {
  width: 6px;
}

.right-tools-panel::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 10px;
}

.right-tools-panel::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.6);
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.right-tools-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.8);
}

/* Firefox Scrollbar for Right Tools Panel */
.right-tools-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.6) rgba(15, 23, 42, 0.4);
}

/* ═══════════════════════════════════════════════════════════════
   TOOLS ICONS SECTION
   ═══════════════════════════════════════════════════════════════ */
.tools-icons-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tools-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.tools-list.hidden {
  display: none;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  padding: 10px;
  background: rgba(30, 41, 59, 0.5);
  /* More transparent */
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #e2e8f0;
  /* Brighter for visibility on transparent bg */
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.5rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tool-btn:hover {
  background: rgba(30, 41, 59, 0.8);
  /* Less transparent on hover */
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  transform: translateX(-3px) scale(1.05);
  box-shadow: -3px 0 12px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Only show active state when tool panel is actually open (via .active class) */
.tool-btn.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.5);
  color: #60a5fa;
  box-shadow: -2px 0 8px rgba(59, 130, 246, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════════════
   ZOOM CONTROLS SECTION
   ═══════════════════════════════════════════════════════════════ */
.zoom-controls-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  padding-bottom: 10px;
  /* Reduced - main panel padding handles clearance */
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  padding: 10px;
  background: rgba(30, 41, 59, 0.5);
  /* More transparent */
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #e2e8f0;
  /* Brighter for visibility */
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1.3rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.control-btn:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.8);
  /* Less transparent on hover */
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  transform: translateX(-3px) scale(1.05);
  box-shadow: -3px 0 12px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.control-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: rgba(15, 23, 42, 0.5);
}

.zoom-level {
  font-size: 0.8rem;
  color: #93c5fd;
  /* Brighter blue for visibility */
  font-weight: 700;
  text-align: center;
  user-select: none;
  padding: 8px;
  background: rgba(30, 41, 59, 0.5);
  /* More transparent */
  backdrop-filter: blur(8px);
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  box-shadow: inset 0 1px 0 rgba(59, 130, 246, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   SVG SEND SECTION
   ═══════════════════════════════════════════════════════════════ */
.svg-send-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  padding-bottom: 10px;
  /* Reduced - main panel padding handles clearance */
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.svg-send-section.hidden {
  display: none;
}

.svg-send-section h4 {
  margin: 0 0 8px 0;
  color: #94a3b8;
  font-size: 0.7rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.send-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 12px 8px;
  background: rgba(30, 41, 59, 0.5);
  /* More transparent */
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #e2e8f0;
  /* Brighter for visibility */
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.7rem;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.send-btn span {
  font-size: 1.3rem;
}

.send-btn:hover {
  background: rgba(30, 41, 59, 0.8);
  /* Less transparent on hover */
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  transform: translateX(-3px) scale(1.05);
  box-shadow: -3px 0 12px rgba(139, 92, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   IMAGE DISPLAY AREA
   ═══════════════════════════════════════════════════════════════ */
.image-display-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Disable scrolling on image view */
  position: relative;
  background: #0f172a;
  min-height: calc(100vh - 60px);
  /* Use 90%+ of viewport height */
  padding: 0;
  width: 100%;
  height: 100%;
}

#image-content-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

#image-content-wrapper img,
#image-content-wrapper svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

#viewerImage {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   RASTER DRAW TOOL STYLES
   ═══════════════════════════════════════════════════════════════ */
.draw-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.draw-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.draw-tool-btn .tool-icon {
  font-size: 1.4rem;
}

.draw-tool-btn .tool-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.draw-tool-btn:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.draw-tool-btn.active {
  background: rgba(59, 130, 246, 0.4);
  border-color: rgba(59, 130, 246, 0.6);
  color: #93c5fd;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.draw-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.draw-options input[type="text"],
.draw-options select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.9rem;
  margin-top: 4px;
}

.draw-options select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2393c5fd' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.draw-options select option {
  background: #1e293b;
  color: #e2e8f0;
  padding: 8px;
}

.draw-options input[type="text"]:focus,
.draw-options select:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker-row input[type="color"] {
  width: 50px;
  height: 35px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(30, 41, 59, 0.5);
  cursor: pointer;
}

.color-picker-row span {
  font-family: monospace;
  font-size: 0.9rem;
  color: #93c5fd;
  padding: 4px 8px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 4px;
}

.quick-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s;
}

.quick-color-btn:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 12px currentColor;
}

.draw-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.draw-action-group {
  display: flex;
  gap: 4px;
}

.draw-actions .icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.5rem;
  font-weight: 700;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.draw-actions .icon-btn:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.draw-actions .icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.draw-actions button:not(.icon-btn) {
  flex: 1;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Drawing Canvas Overlay */
#rasterDrawCanvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  z-index: 50;
  pointer-events: none;
}

#rasterDrawCanvas.active {
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .viewer-header {
    gap: 6px;
    padding: 6px 12px;
  }

  .filename-input {
    min-width: 100px;
    max-width: 150px;
  }

  .toolbar-item .item-label {
    display: none;
  }

  .toolbar-item {
    padding: 6px 8px;
  }

  .right-tools-panel {
    width: 70px;
    padding: 10px 6px;
  }

  .tool-btn {
    height: 42px;
    font-size: 1.2rem;
  }
}

@media (max-width: 768px) {

  /* Adjust main layout height to accommodate bottom panel */
  .viewer-main-layout {
    flex-direction: column;
    height: auto;
    /* Let it adapt to content */
    min-height: auto;
  }

  /* Image content adapts to available space */
  .viewer-content {
    flex: 1;
    min-height: 0;
    height: calc(100vh - 50px - 70px);
    /* viewport - header - bottom panel */
  }

  .image-display-area {
    min-height: auto;
    height: 100%;
  }

  .right-tools-panel {
    width: 100%;
    height: auto;
    min-height: 60px;
    max-height: 70px;
    flex-direction: row;
    padding: 6px 10px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 6px;
    overflow-x: auto;
    /* Allow horizontal scroll for tools */
    overflow-y: hidden;
    flex-shrink: 0;
    /* Don't let it shrink */
  }

  .tools-icons-section,
  .zoom-controls-section {
    flex-direction: row;
    border: none;
    padding: 0;
    gap: 5px;
  }

  .svg-send-section {
    flex-direction: row;
    gap: 5px;
    border: none;
    padding: 0;
  }

  .svg-send-section h4 {
    display: none;
    /* Hide heading on mobile */
  }

  .tools-list {
    flex-direction: row;
    gap: 5px;
  }

  .tool-btn,
  .control-btn {
    width: 48px;
    min-width: 48px;
    /* Optimized for touch */
    height: 48px;
    flex-shrink: 0;
    /* Prevent buttons from disappearing */
    font-size: 1.4rem;
    border-radius: 8px;
  }

  .send-btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 6px;
    flex-shrink: 0;
    border-radius: 8px;
  }

  .send-btn span {
    font-size: 1.2rem;
  }

  /* Ensure zoom level display stays readable */
  .zoom-level {
    min-width: 55px;
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 6px;
  }

  /* Keep header buttons accessible */
  .viewer-header {
    flex-wrap: nowrap;
    /* Prevent wrapping */
    min-height: 50px;
    padding: 8px 12px;
  }

  .filename-input {
    min-width: 100px;
    max-width: 140px;
    font-size: 0.85rem;
    padding: 6px 10px;
  }

  .format-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .toolbar-menu {
    flex-wrap: nowrap;
    overflow-x: visible;
  }

  .toolbar-item {
    padding: 8px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
    /* Larger touch target */
    min-height: 36px;
  }

  .toolbar-item .item-icon {
    font-size: 1.1rem;
  }

  .file-info-group {
    flex-shrink: 0;
  }

  .close-viewer {
    flex-shrink: 0;
    width: 40px;
    height: 36px;
    font-size: 1.5rem;
  }

  /* Mobile scrollbar styling */
  .viewer-header::-webkit-scrollbar,
  .right-tools-panel::-webkit-scrollbar {
    height: 4px;
    width: 4px;
  }
}