/* =================================================================
   RESPONSIVE.CSS - Responsive Design Breakpoints
   
   This file contains all responsive design rules:
   - Mobile-first responsive breakpoints
   - Tablet and desktop optimizations
   - Formatting toolbar responsive adjustments
   - Layout changes for different screen sizes
   ================================================================= */

/* ===== LARGE SCREENS (1400px+) ===== */
/* Desktop and large displays - show full interface */
@media (min-width: 1400px) {
  .github-text {
    display: inline;
  }
  
  .formatting-toolbar {
    gap: 4px;
    padding: 7px 10px 10px 10px;
    justify-content: center;
  }
  
  .format-button {
    padding: 6px 8px;
    min-width: 30px;
    height: 30px;
    font-size: 12px;
  }
  
  .format-button i {
    font-size: 14px;
  }
  
  #format-h1, #format-h2, #format-h3 {
    min-width: 32px;
    font-size: 12px;
    font-weight: 700;
  }
  
  .toolbar-separator {
    height: 20px;
    margin: 0 4px;
  }
}

/* ===== MEDIUM SCREENS (1200px - 1399px) ===== */
/* Laptop and medium displays */
@media (max-width: 1399px) and (min-width: 1200px) {
  .header-container {
    gap: 1.5rem;
  }
  
  .header-actions {
    gap: 1rem;
  }
  
  .formatting-toolbar {
    gap: 3px;
    padding: 7px 10px 10px 10px;
    justify-content: center;
  }
  
  .format-button {
    padding: 5px 7px;
    min-width: 27px;
    height: 27px;
    font-size: 11px;
  }
  
  .format-button i {
    font-size: 13px;
  }
  
  #format-h1, #format-h2, #format-h3 {
    min-width: 29px;
    font-size: 11px;
    font-weight: 700;
  }
  
  .toolbar-separator {
    height: 18px;
    margin: 0 3px;
  }
}

/* ===== SMALL SCREENS (1080px - 1199px) ===== */
/* Compact laptop displays */
@media (max-width: 1199px) and (min-width: 1080px) {
  .formatting-toolbar {
    padding: 7px 10px 10px 10px;
    justify-content: center;
  }
  
  .format-button {
    padding: 4px 5px;
    min-width: 24px;
    height: 24px;
    font-size: 10px;
  }
  
  .format-button i {
    font-size: 12px;
  }
  
  #format-h1, #format-h2, #format-h3 {
    min-width: 26px;
    font-size: 10px;
    font-weight: 700;
  }
  
  .toolbar-separator {
    height: 16px;
    margin: 0 2px;
    width: 0.8px;
  }
}

/* ===== TABLET LAYOUT (769px - 1200px) ===== */
/* Tablet displays - show hamburger menu */
@media (max-width: 1200px) and (min-width: 769px) {
  .header-actions {
    display: none;
  }

  .mobile-menu {
    display: block !important;
  }

  .mobile-menu-panel,
  .mobile-menu-overlay {
    display: block !important;
  }
}

/* ===== MOBILE LAYOUT (768px and below) ===== */
/* Mobile devices - simplified interface */
@media (max-width: 768px) {
  .header-container {
    padding: 0.75rem 1rem;
    gap: 1rem;
  }
  
  .header-divider {
    display: none;
  }
  
  .github-badge {
    display: none;
  }
  
  .header-actions {
    display: none;
  }
  
  .mobile-menu {
    display: block !important;
  }

  .mobile-menu-panel,
  .mobile-menu-overlay {
    display: block !important;
  }

  .mobile-brand-title {
    font-size: 1.4rem;
  }

  .mobile-brand-subtitle {
    font-size: 0.72rem;
  }

  .mobile-version-badge {
    font-size: 0.6rem;
  }

  .mobile-stats-line {
    font-size: 0.95rem;
  }

  .mobile-menu-item {
    font-size: 0.95rem;
  }

  .mobile-menu-footer {
    font-size: 1rem;
  }

  /* On mobile, use full inner width for balanced left/right padding */
  .mobile-stats-line,
  .mobile-menu-items,
  .mobile-menu-footer {
    width: 100% !important;
    margin-right: 0 !important;
  }

  .mobile-menu-footer {
    width: calc(100% - 1.6rem) !important;
  }
  
  /* Ensure preview content is properly centered on small mobile screens */
  .markdown-body {
    max-width: 98% !important;
    margin: 0 auto !important;
    padding: 20px !important;
  }
}

@media (max-width: 420px) {
  .mobile-menu-panel {
    width: calc(100vw - 20px);
    --mobile-panel-inset: 10px;
    left: var(--mobile-panel-inset);
    top: 10px;
    height: calc(100vh - 20px);
    border-radius: 10px;
  }

  .mobile-brand-title {
    font-size: 1.25rem;
  }

  .mobile-brand-icon {
    width: 38px;
    height: 38px;
  }

  .mobile-github-btn {
    width: 36px;
    height: 36px;
  }

  .mobile-close-btn {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 420px) and (max-height: 740px) {
  .mobile-menu-panel {
    width: calc(100vw - 12px);
    --mobile-panel-inset: 6px;
    left: var(--mobile-panel-inset);
    top: 6px;
    height: calc(100dvh - 12px);
    padding: 0.55rem 0.6rem 0.8rem;
  }

  .mobile-menu-header {
    margin-bottom: 0.35rem;
    padding: 0.2rem 0.1rem 0.35rem;
  }

  .mobile-brand-title {
    font-size: 1.12rem;
  }

  .mobile-brand-subtitle {
    font-size: 0.64rem;
  }

  .mobile-version-badge {
    font-size: 0.56rem;
    padding: 0.11rem 0.34rem;
  }

  .mobile-brand-icon {
    width: 34px;
    height: 34px;
  }

  .mobile-github-btn,
  .mobile-close-btn {
    width: 32px;
    height: 32px;
  }

  .mobile-stats-line {
    font-size: 0.88rem;
    padding: 0.52rem 0.05rem;
    margin-bottom: 0.45rem;
    gap: 0.4rem;
  }

  .mobile-menu-items {
    gap: 0.42rem;
    padding: 0.2rem 0 0.45rem;
  }

  .mobile-menu-item {
    font-size: 0.88rem;
    padding: 0.62rem 0.78rem;
    border-radius: 8px;
  }

  .mobile-menu-footer {
    font-size: 0.9rem;
    padding-top: 0.65rem;
    margin-top: 0.35rem;
  }
}

/* Force-hide mobile menu controls on desktop widths */
@media (min-width: 1201px) {
  .mobile-menu {
    display: none !important;
  }

  .mobile-menu-panel,
  .mobile-menu-overlay {
    display: none !important;
  }
}

/* ===== MOBILE/TABLET LAYOUT ADJUSTMENTS (1080px and below) ===== */
/* Switch to vertical layout for smaller screens */
@media (max-width: 1080px) {
  /* Switch to vertical layout */
  .content-container {
    flex-direction: column;
  }
  
  .editor-pane, .preview-pane {
    flex: none;
    height: 50%;
    border-right: none;
  }
  
  .editor-pane {
    border-bottom: 1px solid var(--border-color);
  }
  
  /* Hide formatting toolbar on mobile */
  .formatting-toolbar {
    display: none !important;
  }
  
  .editor-wrapper {
    height: 100%; /* Remove toolbar height offset on mobile */
  }
  
  /* Ensure preview content stays centered on mobile */
  .markdown-body {
    max-width: 95% !important;
    margin: 0 auto !important;
  }
  

}

/* ===== WHAT'S NEW MODAL RESPONSIVE ADJUSTMENTS ===== */
@media (hover: hover) and (pointer: fine) {
  #markdown-preview .code-block-header-actions [data-marktide-tip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 520px) {
  .whats-new-overlay {
    padding: 0.65rem;
  }

  .whats-new-dialog {
    padding: 0.95rem 0.95rem 0.85rem;
    border-radius: 14px;
    max-height: calc(100vh - 1.3rem);
    max-height: calc(100dvh - 1.3rem);
  }

  .whats-new-title {
    font-size: 1.05rem;
    line-height: 1.22;
    margin-bottom: 0.25rem;
  }

  .whats-new-subtitle {
    font-size: 0.84rem;
    line-height: 1.38;
  }

  .whats-new-hero {
    width: 52px;
    height: 52px;
    margin-bottom: 0.45rem;
  }

  .whats-new-hero-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.3rem;
  }

  .whats-new-hero-glow {
    inset: -10px;
    filter: blur(9px);
  }

  .whats-new-header {
    margin-bottom: 0.7rem;
  }

  .whats-new-badge {
    margin-bottom: 0.45rem;
    font-size: 0.62rem;
    padding: 0.18rem 0.5rem;
  }

  .whats-new-list {
    gap: 0.4rem;
    margin-bottom: 0.75rem;
  }

  .whats-new-item {
    padding: 0.5rem 0.65rem;
    gap: 0.6rem;
    border-radius: 10px;
  }

  .whats-new-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.82rem;
  }

  .whats-new-item-title {
    font-size: 0.85rem;
    margin-bottom: 0.08rem;
  }

  .whats-new-item-text {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .whats-new-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0.35rem;
  }

  .whats-new-primary {
    justify-content: center;
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
  }

  .whats-new-link {
    justify-content: center;
    padding: 0.25rem 0.15rem;
    font-size: 0.8rem;
  }

  .whats-new-close {
    width: 32px;
    height: 32px;
    top: 0.5rem;
    right: 0.5rem;
  }
}

/* Extra short phones (iPhone SE class, old small devices) */
@media (max-width: 520px) and (max-height: 700px) {
  .whats-new-hero {
    width: 44px;
    height: 44px;
    margin-bottom: 0.35rem;
  }

  .whats-new-hero-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.1rem;
  }

  .whats-new-hero-sparkle {
    display: none;
  }

  .whats-new-title {
    font-size: 1rem;
  }

  .whats-new-subtitle {
    font-size: 0.8rem;
  }

  .whats-new-list {
    gap: 0.32rem;
  }

  .whats-new-item {
    padding: 0.42rem 0.6rem;
  }
}

/* Short viewports (laptops, small windows, tablets in landscape) */
@media (min-width: 521px) and (max-height: 820px) {
  .whats-new-dialog {
    padding: 1.1rem 1.5rem 1rem;
  }

  .whats-new-hero {
    width: 56px;
    height: 56px;
    margin-bottom: 0.55rem;
  }

  .whats-new-hero-logo {
    width: 50px;
    height: 50px;
    border-radius: 15px;
    font-size: 1.35rem;
  }

  .whats-new-hero-glow {
    inset: -12px;
    filter: blur(10px);
  }

  .whats-new-header {
    margin-bottom: 0.7rem;
  }

  .whats-new-badge {
    margin-bottom: 0.45rem;
    font-size: 0.66rem;
    padding: 0.18rem 0.5rem;
  }

  .whats-new-title {
    font-size: 1.18rem;
  }

  .whats-new-subtitle {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .whats-new-list {
    gap: 0.42rem;
    margin-bottom: 0.85rem;
  }

  .whats-new-item {
    padding: 0.55rem 0.8rem;
    gap: 0.7rem;
  }

  .whats-new-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.9rem;
  }

  .whats-new-item-title {
    font-size: 0.92rem;
    margin-bottom: 0.1rem;
  }

  .whats-new-item-text {
    font-size: 0.82rem;
    line-height: 1.38;
  }

  .whats-new-primary {
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
  }

  .whats-new-link {
    font-size: 0.84rem;
    padding: 0.3rem 0.15rem;
  }
}

/* Very short viewports (landscape mobile, tiny laptop windows) */
@media (max-height: 560px) {
  .whats-new-overlay {
    padding: 0.5rem;
    align-items: flex-start;
  }

  .whats-new-dialog {
    padding: 0.8rem 1.1rem 0.8rem;
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    margin-top: 0.5rem;
  }

  .whats-new-hero {
    width: 40px;
    height: 40px;
    margin-bottom: 0.35rem;
  }

  .whats-new-hero-logo {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 1rem;
  }

  .whats-new-hero-sparkle,
  .whats-new-hero-glow {
    display: none;
  }

  .whats-new-title {
    font-size: 0.98rem;
  }

  .whats-new-subtitle {
    font-size: 0.78rem;
  }

  .whats-new-list {
    gap: 0.3rem;
    margin-bottom: 0.6rem;
  }

  .whats-new-item {
    padding: 0.42rem 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .whats-new-overlay,
  .whats-new-dialog,
  .whats-new-primary,
  .whats-new-item {
    transition: none !important;
  }

  .whats-new-overlay .whats-new-dialog,
  .whats-new-overlay.open .whats-new-hero-logo,
  .whats-new-overlay.open .whats-new-hero-logo i,
  .whats-new-overlay.open .whats-new-hero-glow,
  .whats-new-overlay.open .whats-new-hero-sparkle {
    animation: none !important;
  }

  .whats-new-overlay.open .whats-new-hero-logo {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }

  .whats-new-overlay.open .whats-new-hero-glow {
    opacity: 0.7;
    transform: scale(1);
  }
}
  
