/**
 * Responsive Design Stylesheet for Quick Accounting Documentation Site
 * Handles layout adjustments for different screen sizes
 */

/* ============================================
   Mobile Styles (< 768px)
   ============================================ */

@media (max-width: 767.98px) {
  :root {
    --sidebar-width: 100%;
  }

  /* Hide sidebar by default on mobile */
  .sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: 100%;
    max-height: calc(100vh - var(--header-height));
    z-index: 99;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  /* Show sidebar when mobile-open class is applied */
  .sidebar.mobile-open {
    display: block;
  }

  /* Adjust main content to full width on mobile */
  main {
    width: 100% !important;
    padding: 20px 15px;
  }

  article {
    max-width: 100%;
  }

  /* Adjust header for mobile */
  .navbar {
    padding: 0.5rem 0;
  }

  .navbar-brand .sitename {
    font-size: 1.1rem;
  }

  .nav-link {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.95rem;
  }

  /* Adjust sidebar for mobile */
  .sidebar-title {
    padding: 0 15px;
    font-size: 0.8rem;
  }

  .sidebar-toggle {
    padding: 0 15px;
    font-size: 0.8rem;
  }

  .sidebar-menu a {
    padding: 6px 15px;
    padding-left: 35px;
    font-size: 0.9rem;
  }

  .sidebar-menu a:hover {
    padding-left: 40px;
  }

  /* Adjust footer for mobile */
  .footer {
    padding-top: 30px !important;
    padding-bottom: 20px !important;
  }

  .footer-title {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
  }

  .footer-description {
    font-size: 0.9rem;
  }

  .footer-links,
  .footer-contact {
    font-size: 0.9rem;
  }

  /* Adjust breadcrumb for mobile */
  nav[aria-label="breadcrumb"] {
    margin-bottom: 15px;
  }

  .breadcrumb {
    font-size: 0.85rem;
  }

  /* Adjust article headings for mobile */
  article h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  article h2 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
  }

  article h3 {
    font-size: 1.1rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
  }

  article p {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
  }

  /* Adjust code blocks for mobile */
  article code {
    font-size: 0.85em;
  }

  article pre {
    padding: 10px;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  /* Adjust container for mobile */
  .container-fluid {
    padding: 0;
  }

  /* Hide sidebar toggle button on mobile (use hamburger menu instead) */
  .navbar-toggler {
    display: block;
  }
}

/* ============================================
   Tablet Styles (768px - 991px)
   ============================================ */

@media (min-width: 768px) and (max-width: 991.98px) {
  :root {
    --sidebar-width: 250px;
  }

  /* Show sidebar on tablet */
  .sidebar {
    display: block;
    width: 250px;
    position: sticky;
    top: var(--header-height);
  }

  /* Adjust main content width on tablet */
  main {
    padding: 25px 20px;
  }

  article {
    max-width: 100%;
  }

  /* Adjust sidebar for tablet */
  .sidebar-title {
    padding: 0 15px;
    font-size: 0.8rem;
  }

  .sidebar-toggle {
    padding: 0 15px;
    font-size: 0.8rem;
  }

  .sidebar-menu a {
    padding: 7px 15px;
    padding-left: 35px;
    font-size: 0.9rem;
  }

  /* Adjust article headings for tablet */
  article h1 {
    font-size: 1.75rem;
  }

  article h2 {
    font-size: 1.35rem;
  }

  article h3 {
    font-size: 1.15rem;
  }

  /* Adjust footer for tablet */
  .footer {
    padding-top: 35px !important;
  }

  .footer-title {
    font-size: 0.95rem;
  }
}

/* ============================================
   Desktop Styles (>= 992px)
   ============================================ */

@media (min-width: 992px) {
  :root {
    --sidebar-width: 300px;
  }

  /* Show sidebar on desktop */
  .sidebar {
    display: block;
    width: 300px;
    position: sticky;
    top: var(--header-height);
  }

  /* Adjust main content width on desktop */
  main {
    padding: 30px 30px;
  }

  article {
    max-width: 900px;
  }

  /* Adjust sidebar for desktop */
  .sidebar-title {
    padding: 0 20px;
    font-size: 0.875rem;
  }

  .sidebar-toggle {
    padding: 0 20px;
    font-size: 0.875rem;
  }

  .sidebar-menu a {
    padding: 8px 20px;
    padding-left: 40px;
    font-size: 0.95rem;
  }

  .sidebar-menu a:hover {
    padding-left: 45px;
  }

  /* Adjust article headings for desktop */
  article h1 {
    font-size: 2rem;
  }

  article h2 {
    font-size: 1.5rem;
  }

  article h3 {
    font-size: 1.25rem;
  }

  /* Adjust footer for desktop */
  .footer {
    padding-top: 40px !important;
  }

  .footer-title {
    font-size: 1rem;
  }
}

/* ============================================
   Large Desktop Styles (>= 1200px)
   ============================================ */

@media (min-width: 1200px) {
  main {
    padding: 40px 40px;
  }

  article {
    max-width: 1000px;
  }

  article h1 {
    font-size: 2.25rem;
  }

  article h2 {
    font-size: 1.75rem;
  }

  article h3 {
    font-size: 1.4rem;
  }
}

/* ============================================
   Extra Large Desktop Styles (>= 1400px)
   ============================================ */

@media (min-width: 1400px) {
  main {
    padding: 50px 50px;
  }

  article {
    max-width: 1100px;
  }

  article h1 {
    font-size: 2.5rem;
  }

  article h2 {
    font-size: 1.9rem;
  }

  article h3 {
    font-size: 1.5rem;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .header,
  .sidebar,
  .footer,
  nav[aria-label="breadcrumb"] {
    display: none;
  }

  main {
    padding: 0;
  }

  article {
    max-width: 100%;
  }

  article a {
    color: #000;
  }

  article a::after {
    content: " (" attr(href) ")";
  }
}

/* ============================================
   High DPI / Retina Display Styles
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .header {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .dropdown-menu {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

/* ============================================
   Reduced Motion Styles
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .sidebar-menu {
    transition: none;
  }

  .sidebar-toggle i {
    transition: none;
  }

  .nav-link,
  .sidebar-menu a,
  .footer-links a {
    transition: none;
  }
}

/* ============================================
   Dark Mode Styles (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --light-bg: #2a2a2a;
    --border-color: #404040;
  }

  html, body {
    background-color: #1a1a1a;
    color: var(--text-color);
  }

  .header {
    background-color: #1a1a1a;
    border-bottom-color: var(--border-color);
  }

  .navbar-brand {
    color: var(--text-color) !important;
  }

  .nav-link {
    color: var(--text-color) !important;
  }

  .sidebar {
    background-color: var(--light-bg);
    border-right-color: var(--border-color);
  }

  .sidebar-title {
    color: var(--text-muted);
  }

  .sidebar-menu a {
    color: var(--text-color);
  }

  .sidebar-menu a:hover {
    background-color: #3a3a3a;
  }

  .sidebar-menu a.active {
    background-color: #1a3a5a;
  }

  article code {
    background-color: var(--light-bg);
    color: #ff6b9d;
  }

  article pre {
    background-color: #2a2a2a;
    border-color: var(--border-color);
  }

  .footer {
    background-color: #0a0a0a;
    border-top-color: var(--border-color);
  }

  .dropdown-menu {
    background-color: var(--light-bg);
    border-color: var(--border-color);
  }

  .dropdown-item {
    color: var(--text-color);
  }

  .dropdown-item:hover {
    background-color: #3a3a3a;
  }
}
