/* Responsive Design Styles */

/* Large Desktop - 1200px and up */
@media (min-width: 1200px) {
.hero-container {
grid-template-columns: 1fr 1fr;
gap: 4rem;
}

.hero-title {
font-size: 3.5rem;
}

.category-grid {
grid-template-columns: repeat(3, 1fr);
}

.features-grid {
grid-template-columns: repeat(4, 1fr);
}
}

/* Desktop - 992px and up */
@media (min-width: 992px) {
.top-nav {
display: flex !important;
}

.search-container {
display: flex;
}

.menu-toggle {
display: none;
}

.hero-container {
grid-template-columns: 1fr 1fr;
align-items: center;
}

.newsletter-form {
flex-direction: row;
}

/* Hide mobile menu elements on desktop */
.mobile-menu,
.mobile-overlay {
display: none !important;
}
}

/* Tablet - 768px and up */
@media (min-width: 768px) {
.container {
padding: 0 2rem;
}

.header-container {
padding: 1rem 2rem;
}

.hero {
padding: 5rem 0;
}

.hero-title {
font-size: 3rem;
}

.hero-actions {
justify-content: flex-start;
}

.category-grid {
grid-template-columns: repeat(2, 1fr);
}

.features-grid {
grid-template-columns: repeat(2, 1fr);
}

.footer-content {
grid-template-columns: repeat(2, 1fr);
}
}

/* Mobile Large - 576px and up */
@media (min-width: 576px) {
.hero-actions {
flex-direction: row;
}

.newsletter-form {
flex-direction: row;
max-width: 500px;
}
}

/* Mobile - 575px and below */
@media (max-width: 575px) {
.container {
padding: 0 1rem;
}

.header-container {
padding: 1rem;
}

.hero {
padding: 3rem 0;
text-align: center;
}

.hero-title {
font-size: 2rem;
line-height: 1.2;
}

.hero-subtitle {
font-size: 1rem;
}

.hero-actions {
flex-direction: column;
align-items: center;
}

.btn {
width: 100%;
justify-content: center;
max-width: 300px;
}

.section-title {
font-size: 2rem;
}

.category-grid {
grid-template-columns: 1fr;
gap: 1.5rem;
}

.category-card {
padding: 1.5rem;
}

.features-grid {
grid-template-columns: 1fr;
}

.newsletter-form {
flex-direction: column;
gap: 1rem;
}

.newsletter-input {
width: 100%;
}

.footer-content {
grid-template-columns: 1fr;
text-align: center;
}

.social-links {
justify-content: center;
}

/* Code blocks on mobile */
.code-preview {
margin: 0 -1rem;
border-radius: 0;
border-left: none;
border-right: none;
}

.code-preview pre {
font-size: 0.75rem;
padding: 0.75rem;
}
}

/* Mobile Menu Styles */
@media (max-width: 991px) {
/* Hide regular navigation on mobile */
.top-nav {
display: none;
}

/* Show menu toggle button on mobile */
.menu-toggle {
display: block;
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
color: var(--text-color);
margin-left: 1rem;
}

.mobile-menu {
position: fixed;
top: 0;
left: -100%;
width: 280px;
height: 100vh;
background-color: var(--bg-primary);
border-right: 1px solid var(--border-color);
transition: left 0.3s ease-in-out;
z-index: 200;
overflow-y: auto;
}

.mobile-menu.active {
left: 0;
}

.mobile-menu-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
border-bottom: 1px solid var(--border-color);
}

.mobile-menu-close {
background: none;
border: none;
color: var(--text-secondary);
font-size: 1.5rem;
cursor: pointer;
padding: 0.5rem;
}

.mobile-nav-menu {
list-style: none;
padding: 1rem 0;
margin: 0;
}

.mobile-nav-menu li {
margin-bottom: 0.5rem;
}

.mobile-nav-menu a {
display: block;
padding: 0.75rem 1rem;
color: var(--text-secondary);
text-decoration: none;
transition: var(--transition);
}

.mobile-nav-menu a:hover,
.mobile-nav-menu a.active {
background-color: var(--bg-secondary);
color: var(--primary-color);
}

.mobile-search {
padding: 1rem;
border-top: 1px solid var(--border-color);
}

.mobile-search .search-input {
width: 100%;
}

.mobile-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 150;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease-in-out;
}

.mobile-overlay.active {
opacity: 1;
visibility: visible;
}
}

/* Tutorial Page Responsive Styles */
.tutorial-layout {
display: grid;
grid-template-columns: 280px 1fr;
gap: 2rem;
max-width: 1200px;
margin: 0 auto;
padding: 2rem 1rem;
}

@media (max-width: 991px) {
.tutorial-layout {
grid-template-columns: 1fr;
gap: 1rem;
}

.tutorial-sidebar {
order: 2;
}

.tutorial-content {
order: 1;
}
}

/* Sidebar Responsive */
.sidebar {
position: sticky;
top: 100px;
height: fit-content;
max-height: calc(100vh - 120px);
overflow-y: auto;
}

@media (max-width: 991px) {
.sidebar {
position: static;
max-height: none;
background-color: var(--bg-secondary);
border-radius: var(--radius-lg);
padding: 1rem;
}
}

/* Table Responsive */
.table-container {
overflow-x: auto;
margin: 1rem 0;
border-radius: var(--radius-md);
border: 1px solid var(--border-color);
}

table {
width: 100%;
border-collapse: collapse;
font-size: 0.875rem;
}

@media (max-width: 575px) {
table {
font-size: 0.75rem;
}
}

/* Print Styles */
@media print {
.header,
.footer,
.mobile-menu,
.mobile-overlay,
.newsletter,
.theme-toggle,
.menu-toggle,
.search-container {
display: none !important;
}

.main-content {
margin: 0;
padding: 0;
}

.hero {
background: none;
border: none;
}

.category-card,
.feature-item {
break-inside: avoid;
page-break-inside: avoid;
}

a[href]:after {
content: " (" attr(href) ")";
font-size: 0.8em;
color: #666;
}

.btn {
border: 1px solid #333;
background: none !important;
color: #333 !important;
}
}

/* High DPI / Retina Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.logo-link i,
.category-icon i,
.feature-icon i {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}

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

.category-card:hover {
transform: none !important;
}

.category-link:hover {
gap: 0.5rem !important;
}
}

/* Focus Management for Accessibility */
@media (any-hover: hover) {
.btn:focus-visible,
.nav-link:focus-visible,
.search-input:focus-visible,
.theme-toggle:focus-visible,
.menu-toggle:focus-visible {
outline: 2px solid var(--primary-color);
outline-offset: 2px;
}
}

/* Dark Mode Media Query Support */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg-primary: #0f172a;
--bg-secondary: #1e293b;
--bg-tertiary: #334155;
--bg-code: #1e293b;

--text-primary: #f8fafc;
--text-secondary: #cbd5e1;
--text-muted: #94a3b8;
--text-inverse: #0f172a;

--border-color: #334155;
--border-hover: #475569;
}
}

/* Landscape Orientation on Mobile */
@media (max-width: 768px) and (orientation: landscape) {
.hero {
padding: 2rem 0;
}

.hero-title {
font-size: 1.75rem;
}

.categories,
.features {
padding: 3rem 0;
}
}

/* Very Small Screens */
@media (max-width: 320px) {
.container {
padding: 0 0.75rem;
}

.hero-title {
font-size: 1.75rem;
}

.hero-subtitle {
font-size: 0.875rem;
}

.category-card {
padding: 1rem;
}

.btn {
padding: 0.625rem 1rem;
font-size: 0.875rem;
}

}




/* Mobile fix: move sidebar above content */
@media (max-width: 768px) {
  .tutorial-layout {
    display: flex;
    flex-direction: column;
  }

  .tutorial-sidebar {
    order: -1; /* Sidebar appears before content */
    margin-bottom: 1.5rem;
  }
}


/* Fix: Keep sidebar above content on mobile */
@media (max-width: 991px) {
  .tutorial-sidebar {
    order: 1 !important;
  }
  .tutorial-content {
    order: 2 !important;
  }
}
