/**
 * Responsive Styles
 * AMR Label Maker V2
 */

/* ===== Tablet (768px - 1024px) ===== */
@media screen and (max-width: 1024px) {
  :root {
    --sidebar-width: 320px;
    --preview-scale: 2;
  }

  .brand__logo {
    width: 50px;
    height: 50px;
  }

  .brand__title {
    font-size: var(--text-base);
  }
}

/* ===== Mobile (< 768px) ===== */
@media screen and (max-width: 768px) {
  :root {
    --preview-scale: 1.8;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
  }

  /* Sidebar transforms */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 360px;
    height: 100vh;
    margin: 0;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    z-index: var(--z-modal);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar__toggle {
    display: flex;
  }

  /* Mobile header */
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-panel);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
  }

  .mobile-header__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
  }

  /* Preview area */
  .preview {
    margin: 0;
    border-radius: 0;
    min-height: calc(100vh - 60px - var(--action-bar-height));
  }

  /* Overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    transition: opacity var(--transition-slow);
  }

  .sidebar-overlay.is-visible {
    display: block;
    opacity: 1;
  }

  /* Action bar */
  .action-bar {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    justify-content: center;
  }

  .btn span {
    display: none;
  }

  .btn {
    padding: var(--space-3);
  }

  /* Footer */
  .app-footer {
    bottom: calc(var(--action-bar-height) + var(--space-2));
  }

  .app-footer__text {
    font-size: 10px;
    padding: var(--space-1) var(--space-2);
  }
}

/* ===== Small Mobile (< 480px) ===== */
@media screen and (max-width: 480px) {
  :root {
    --preview-scale: 1.5;
  }

  .sidebar {
    width: 100%;
    max-width: none;
    border-radius: 0;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .preview .sheet-label {
    transform: scale(calc(var(--preview-scale) / 4.5));
  }
}

/* ===== Large Desktop (> 1440px) ===== */
@media screen and (min-width: 1440px) {
  :root {
    --sidebar-width: 400px;
    --preview-scale: 3;
  }

  .brand__logo {
    width: 70px;
    height: 70px;
  }

  .brand__title {
    font-size: var(--text-xl);
  }
}

/* ===== Print Media - No Responsive ===== */
@media print {
  .sidebar,
  .mobile-header,
  .sidebar-overlay {
    display: none !important;
  }

  /* Batch print */
  body.batch-printing * {
    visibility: hidden !important;
  }

  body.batch-printing #batchPrintContainer,
  body.batch-printing #batchPrintContainer * {
    visibility: visible !important;
  }
}

/* ===== Accessibility - Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== High Contrast Mode ===== */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --text-muted: #333;
  }

  .btn {
    border: 2px solid currentColor;
  }
}
