/* Responsive Styles */

/* Large devices (desktops) */
@media (min-width: 992px) {
  .manga-container {
    padding: 30px;
  }

  .manga-title {
    font-size: 3rem;
  }

  .characters-container {
    justify-content: center;
  }

  /* Optimize section titles on desktop */
  .comic-heading h2 {
    font-size: 2rem;
    padding: 10px 25px;
  }
}

/* Medium devices (tablets) */
@media (max-width: 991.98px) {
  .header-content {
    flex-direction: column;
    padding: 15px;
  }

  .main-nav {
    margin-top: 15px;
    margin-bottom: 15px;
  }

  .logo {
    max-height: 60px;
  }

  .manga-title {
    font-size: 2.4rem;
  }

  .comic-heading h2 {
    font-size: 1.8rem;
    padding: 8px 20px;
  }

  .character-modal-content {
    max-width: 90%;
  }

  body {
    font-size: 15px;
  }
}

/* Mobile Menu Styles */
.mobile-menu-icon {
  display: none;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 8px 12px;
  color: var(--primary-color);
  border-radius: 5px;
  transition: all 0.3s ease;
  position: relative; /* This is crucial for positioning context */
}

.mobile-menu-icon:hover {
  background-color: rgba(255, 119, 0, 0.1);
}

/* Enhanced mobile menu icon animation - no movement */
.mobile-menu-icon i {
  transition: color 0.3s ease;
}

.mobile-menu-icon i.fa-times {
  color: var(--danger-color); /* Red color for X */
}

.mobile-nav {
  display: none; /* Hidden by default */
  background-color: white;
  border: 3px solid var(--manga-border-color);
  box-shadow: var(--manga-shadow);
  padding: 12px; /* Reduced padding */
  text-align: center;
  flex-direction: column;
  gap: 8px; /* Reduced gap */
  position: absolute;
  top: 100%; /* Position directly below the icon */
  right: 0; /* Align with right edge of icon */
  width: 160px; /* Smaller width (was 200px) */
  z-index: 9999;
  border-radius: 10px;
  transform-origin: top right;
  /* Comic-style speech bubble effect */
  clip-path: polygon(0 10px, 85% 10px, 85% 0, 100% 10px, 100% 100%, 0 100%);
}

/* Add speech bubble pointer */
.mobile-nav:before {
  content: "";
  position: absolute;
  top: -8px;
  right: 15px;
  width: 16px;
  height: 16px;
  background-color: white;
  transform: rotate(45deg);
  border-left: 3px solid var(--manga-border-color);
  border-top: 3px solid var(--manga-border-color);
  z-index: -1;
}

/* When active, ALWAYS display as flex with comic animation */
.mobile-nav.active {
  display: flex !important;
}

/* Enhanced comic book style buttons */
.mobile-nav .manga-btn {
  padding: 10px;
  margin: 2px 0;
  width: 100%;
  text-align: center;
  font-weight: bold;
  background-color: white; /* White background */
  color: black; /* Black text */
  border: 2px solid black; /* Black border */
  border-radius: 8px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 1); /* Comic-style shadow */
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  transform-origin: center;
  font-size: 0.9rem;
}

.mobile-nav .manga-btn:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 1);
  background-color: white; /* Keep white background on hover */
}

.mobile-nav .manga-btn:active {
  transform: translateY(2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 1);
}

/* Small devices (landscape phones) */
@media (max-width: 767.98px) {
  body {
    font-size: 14px;
    line-height: 1.5;
  }

  .manga-container {
    padding: 15px;
  }

  .manga-panel {
    padding: 15px;
  }

  /* Improved title styling for mobile */
  .manga-title {
    font-size: 2rem;
    padding: 5px 10px;
    letter-spacing: 0.01em;
    -webkit-text-stroke: 0.8px black;
    text-shadow: 2px 2px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000,
      -1px -1px 0 #000;
  }

  .manga-subtitle {
    font-size: 1.4rem;
  }

  /* Consistent headings on mobile */
  .comic-heading h2 {
    font-size: 1.4rem;
    padding: 8px 15px;
    transform: rotate(-1deg);
    -webkit-text-stroke: 0.7px var(--dark-color);
  }

  .comic-heading h2::before,
  .comic-heading h2::after {
    content: "★";
    font-size: 1.1rem;
    margin: 0 5px;
  }

  .nav-link {
    margin: 0 3px;
  }

  .news-card {
    flex-direction: column;
  }

  .news-image {
    width: 100%;
    height: 150px;
    margin-right: 0;
    margin-bottom: 10px;
  }

  .bottom-nav-item {
    font-size: 0.85rem;
    font-weight: 600;
  }

  .bottom-nav-item span {
    font-size: 0.8rem;
  }

  input,
  select,
  textarea {
    font-size: 16px !important; /* Prevent zoom on input focus in iOS */
  }

  .header-content {
    padding: 10px;
    flex-direction: row; /* Keep as row */
    justify-content: space-between;
    align-items: center;
    position: relative; /* Ensure proper positioning context */
  }

  .logo-container {
    order: 1; /* Logo first */
    text-align: left; /* Left align logo */
  }

  .main-nav {
    display: none; /* Hide standard navigation on mobile */
  }

  .mobile-menu-icon {
    display: block; /* Show mobile menu icon */
    order: 2; /* Menu icon second */
    z-index: 10000; /* Higher than the nav */
  }

  /* Mobile-optimized comic headings */
  .comic-heading::before {
    width: 90%; /* Wider line on mobile */
    left: 5%;
  }

  /* Vietnamese text optimization */
  .vietnamese-font {
    letter-spacing: 0.02em !important;
    word-spacing: 0.05em !important;
  }

  /* News section mobile fixes */
  .news-tabs-container {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    background-color: #f8f8f8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Prevent content from spilling out */
  }

  .news-tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 8px 5px;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
  }

  /* Hide scrollbar for Chrome/Safari */
  .news-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Make news tabs more compact */
  .news-tab {
    padding: 6px 10px !important;
    font-size: 0.85rem;
    margin-right: 5px;
    border-width: 1px !important;
    min-height: 30px;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
    flex: 0 0 auto;
    font-weight: normal;
  }

  .news-tab.active {
    font-weight: bold;
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
  }

  /* Isolate news content from tab scrolling */
  .news-content {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
  }

  .news-compact {
    overflow-x: hidden;
    width: 100%;
  }

  /* Make items container not affected by tab scrolling */
  .news-items-container {
    overflow-x: hidden;
    max-height: 300px !important;
    padding-top: 5px;
  }

  .news-items {
    width: 100%; /* Ensure this doesn't expand beyond container */
  }

  /* Improve news item styling */
  .news-item {
    padding: 12px 8px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  /* Make news category badges more compact */
  .news-category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-bottom: 3px;
    box-shadow: none;
    border: none;
  }

  /* Vietnamese text optimization */
  .vietnamese-font {
    letter-spacing: 0.02em !important;
    word-spacing: 0.05em !important;
  }

  /* News section mobile fixes */
  .news-tabs-container {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    background-color: #f8f8f8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Prevent content from spilling out */
  }

  .news-tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 8px 5px;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
  }

  /* Hide scrollbar for Chrome/Safari */
  .news-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Make news tabs more compact */
  .news-tab {
    padding: 6px 10px !important;
    font-size: 0.85rem;
    margin-right: 5px;
    border-width: 1px !important;
    min-height: 30px;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
    flex: 0 0 auto;
    font-weight: normal;
  }

  .news-tab.active {
    font-weight: bold;
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
  }

  /* Isolate news content from tab scrolling */
  .news-content {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
  }

  .news-compact {
    overflow-x: hidden;
    width: 100%;
  }

  /* Make items container not affected by tab scrolling */
  .news-items-container {
    overflow-x: hidden;
    max-height: 300px !important;
    padding-top: 5px;
  }

  .news-items {
    width: 100%; /* Ensure this doesn't expand beyond container */
  }

  /* Improve news item styling */
  .news-item {
    padding: 12px 8px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  /* Make news category badges more compact */
  .news-category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-bottom: 3px;
    box-shadow: none;
    border: none;
  }

  /* Vietnamese text handling for tiny screens */
  .vietnamese-font {
    letter-spacing: 0.01em !important;
    word-spacing: 0.03em !important;
    font-weight: 700;
  }

  /* Optimize comic title container for small screens */
  .comic-title-container {
    padding: 10px 5px;
    transform: rotate(0);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.7);
    border-width: 3px;
  }

  /* News section specific fixes for very small screens */
  .news-tabs {
    gap: 3px;
  }

  .news-tab {
    padding: 6px 10px !important;
    min-width: 60px;
    font-size: 0.8rem;
  }

  .news-items-container {
    max-height: 250px !important;
  }

  .news-featured-image-container {
    height: 160px;
  }

  .news-date {
    font-size: 0.75rem;
  }

  .news-title {
    margin: 0;
  }

  .news-title a {
    font-size: 0.9rem;
    line-height: 1.4;
  }
}

/* Enhanced Mobile Navigation & Social Icons */
@media (max-width: 767.98px) {
  /* Footer & Social Links Improvements */
  .manga-footer {
    padding: 20px 15px 80px; /* Add bottom padding for bottom nav */
  }

  .social-container {
    margin: 0.5rem auto;
  }

  .social-title {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  /* Optimize bottom navigation spacing */
  .bottom-nav-container {
    padding: 8px 5px;
  }

  .bottom-nav-item {
    padding: 0 5px;
  }
}

@media (max-width: 575.98px) {
  /* Make social links appear as a balanced grid */
  .social-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 80%;
    margin: 0 auto 10px;
  }

  .social-link {
    width: 100%;
    justify-content: center;
    border-radius: 20px;
  }

  .user-icon {
    width: 45px;
    height: 45px;
    border-width: 2px;
  }

  /* Ensure bottom nav displays properly */
  .bottom-nav {
    height: auto;
  }
}

/* Font fixes for mobile devices */
@media (max-width: 767.98px) {
  /* Better font rendering on mobile */
  .vietnamese-font,
  .manga-title,
  .section-title,
  .manga-footer,
  .comic-panel-footer,
  .comic-container,
  .comic-form,
  .comic-tab-panels,
  .ranking-section {
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Font fixes for all text elements on mobile */
  .copyright-text,
  .copyright-tagline,
  .comic-form-label,
  .comic-input,
  .comic-button,
  .comic-link,
  .comic-title-text,
  .comic-speech-bubble,
  .bubble-text,
  .comic-hint-balloon span,
  .comic-thought-bubble p,
  .player-name,
  .planet-cell,
  .rank-cell,
  .tabs-nav li {
    font-family: "Nunito", "Roboto", -apple-system, BlinkMacSystemFont,
      sans-serif !important;
    letter-spacing: 0.01em;
    word-spacing: 0.05em;
  }

  /* Specific font size adjustments for mobile */
  .comic-title-text {
    font-size: 1.8rem;
    letter-spacing: 0.5px;
  }

  .copyright-text {
    font-size: 1.1rem;
  }

  .copyright-tagline {
    font-size: 0.85rem;
  }

  /* Font fixes for form elements */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  select,
  textarea {
    font-family: "Nunito", "Roboto", -apple-system, BlinkMacSystemFont,
      sans-serif !important;
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    -webkit-appearance: none;
    border-radius: 0;
  }
}

/* Extra small devices (portrait phones) */
@media (max-width: 575.98px) {
  /* More aggressive font size reduction */
  .manga-title {
    font-size: 1.4rem;
  }

  .comic-title-text {
    font-size: 1.6rem;
  }

  .comic-label {
    font-size: 1.1rem;
  }

  .comic-input {
    font-size: 1rem !important;
  }

  .comic-button {
    font-size: 1.2rem;
  }

  /* Footer font adjustments */
  .copyright-text {
    font-size: 1rem;
  }

  .copyright-tagline {
    font-size: 0.8rem;
  }

  /* Rankings table font adjustments */
  .ranking-table th,
  .ranking-table td {
    font-size: 0.9rem;
  }

  .player-name {
    font-size: 0.9rem;
  }

  /* Fix Vietnamese accents display */
  .manga-container {
    text-size-adjust: 100%;
  }

  /* Reduce padding to prevent text overflow */
  .comic-panel-effect {
    padding: 20px 15px;
  }
}

/* News tabs specific fixes for mobile */
@media (max-width: 767.98px) {
  .news-tab {
    position: relative;
    z-index: 20;
  }

  .news-tab.active {
    z-index: 25;
  }

  .news-tabs-container {
    position: sticky;
    top: 0;
    z-index: 30;
    background-color: #f8f8f8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  /* Independent scrolling for news items */
  .news-content {
    display: flex;
    flex-direction: column;
  }

  /* Better scrolling experience on touch devices */
  .news-items-container::-webkit-scrollbar {
    width: 3px;
  }

  .news-item {
    margin-bottom: 5px;
  }
}

/* Fix news tab .active style that had a typo */
.news-tab.active {
  color: #333;
  background-color: var(--accent-color);
  transform: scale(1.05);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  z-index: 20;
}

/* Vietnamese text handling improvements */
.vietnamese-font {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* News section mobile layout fixes */
@media (max-width: 767.98px) {
  /* Fixed news tab container to isolate scrolling */
  .news-tabs-container {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    background-color: #f8f8f8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Prevent content from spilling out */
  }

  .news-tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 8px 5px;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
  }

  /* Hide scrollbar for Chrome/Safari */
  .news-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Make news tabs more compact */
  .news-tab {
    padding: 6px 10px !important;
    font-size: 0.85rem;
    margin-right: 5px;
    border-width: 1px !important;
    min-height: 30px;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
    flex: 0 0 auto;
    font-weight: normal;
  }

  .news-tab.active {
    font-weight: bold;
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
  }

  /* Isolate news content from tab scrolling */
  .news-content {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
  }

  .news-compact {
    display: flex;
    flex-direction: column !important; /* Force column layout */
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
  }

  .news-featured-image-container {
    flex: 0 0 auto;
    order: -1; /* Force image to top */
    height: 200px;
    max-height: 200px;
    width: 100%;
    border-bottom: 3px solid var(--manga-border-color);
    border-left: none;
    border-radius: 10px 10px 0 0;
    position: relative;
  }

  .news-content {
    flex: 1 1 auto;
    order: 0; /* Content after image */
    border-right: none;
    border-top: none;
    border-radius: 0 0 10px 10px;
    background-color: white;
  }

  .news-items-container {
    overflow-x: hidden;
    max-height: 300px !important;
    padding-top: 5px;
  }

  .news-items {
    width: 100%; /* Ensure this doesn't expand beyond container */
  }

  /* Improve news item styling */
  .news-item {
    padding: 12px 8px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  /* Make news category badges more compact */
  .news-category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-bottom: 3px;
    box-shadow: none;
    border: none;
  }
}

/* Extra small devices - further optimize tags */
@media (max-width: 575.98px) {
  .news-tab {
    padding: 4px 8px !important;
    min-width: 50px;
    font-size: 0.8rem;
    border-width: 1px !important;
  }

  .news-category-badge {
    padding: 1px 6px;
    font-size: 0.65rem;
  }
}

/* Mobile Feature Section Fixes */
@media (max-width: 767.98px) {
  /* Hero buttons mobile optimization */
  .hero-buttons {
    gap: 15px;
    flex-direction: row;
    justify-content: center;
  }

  /* Improved hero buttons balance on mobile */
  .hero-buttons-container {
    margin-top: 20px;
  }

  .hero-buttons {
    gap: 12px;
    max-width: 100%;
    padding: 0 10px;
  }

  .hero-buttons .manga-btn {
    min-width: 0; /* Override min-width to allow flexible sizing */
    flex: 1 1 0;
    padding: 12px 5px;
    font-size: 0.95rem;
    border-width: 2px;
  }

  .hero-buttons .manga-btn i {
    margin-right: 6px;
    font-size: 1em;
  }

  .hero-buttons .manga-btn span {
    white-space: nowrap; /* Prevent text wrapping */
  }
}

/* Extra small devices - further optimizations */
@media (max-width: 575.98px) {
  /* Hero section improvements for very small screens */
  .hero-buttons {
    gap: 10px;
  }

  .hero-buttons .manga-btn {
    min-width: 110px;
    font-size: 0.9rem;
    padding: 10px 8px;
  }

  .features-slider {
    padding: 0 0 25px;
  }

  .feature-image {
    border-width: 2px;
    aspect-ratio: 945/472; /* Maintain exact aspect ratio */
  }

  .feature-image.comic-rough-frame {
    border-width: 2px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  }

  /* Smaller pagination dots on very small screens */
  .features-slider .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    margin: 0 3px;
  }

  /* Set minimum height for better tiny screen display */
  .features-slider .swiper-wrapper {
    min-height: 180px;
  }
}

/* Mobile Login/Register Buttons Styling */
@media (max-width: 768px) {
  .header-panel .auth-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .header-panel .auth-buttons .comic-button {
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .header-panel .auth-buttons {
    display: flex;
    gap: 6px;
  }

  .header-panel .auth-buttons .comic-button {
    padding: 5px 8px;
    font-size: 0.75rem;
    min-width: 0;
    height: 30px;
    border-width: 2px;
  }

  .header-panel .auth-buttons .comic-button i {
    margin-right: 3px;
    font-size: 0.8rem;
  }

  .header-panel .comic-logo .logo-image {
    height: 36px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .header-panel .auth-buttons .comic-button {
    padding: 4px 6px;
    font-size: 0.7rem;
    min-width: 0;
    height: 28px;
    border-width: 1.5px;
  }

  .header-panel .auth-buttons .comic-button i {
    margin-right: 2px;
    font-size: 0.75rem;
  }

  .header-panel .comic-logo .logo-image {
    height: 32px;
  }
}

/* Ensure buttons are correctly sized and spaced */
@media (max-width: 480px) {
  .comic-button {
    transform-style: preserve-3d;
    transform: perspective(800px);
    transition: transform 0.2s ease;
  }

  .comic-button:active {
    transform: perspective(800px) translateZ(-5px);
  }

  /* Balanced spacing for elements */
  .header-panel {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
  }
}

/* Mobile Header Adjustments */
@media (max-width: 480px) {
  /* Logo size adjustment */
  .header-panel .comic-logo .logo-image {
    height: 45px;
    transition: transform 0.3s ease;
  }

  /* Add comic border effect on mobile */
  .header-panel {
    border: 3px solid #000;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.8);
    border-radius: 8px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .header-panel .comic-logo .logo-image {
    height: 40px;
  }
}

/* Header Responsive Fixes */
@media (max-width: 768px) {
  /* Fix auth buttons container */
  .auth-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    max-width: 100%;
    margin-left: auto;
  }

  /* Fix button sizing and prevent overflow */
  .auth-buttons .btn,
  .auth-buttons .btn-register,
  .auth-buttons .btn-login,
  .auth-buttons .btn-profile,
  .auth-buttons .btn-logout {
    padding: 6px 10px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    min-width: 70px;
    margin: 0 2px;
    box-sizing: border-box;
  }

  /* Ensure the header logo doesn't push buttons out of view */
  .header-logo img {
    max-height: 45px;
    width: auto;
  }

  /* Ensure consistent button styling between pages */
  .home-page .auth-buttons .btn,
  .home-page .auth-buttons .btn-register,
  .home-page .auth-buttons .btn-login,
  .home-page .auth-buttons .btn-profile,
  .home-page .auth-buttons .btn-logout {
    padding: 6px 10px;
    font-size: 0.85rem;
    min-width: 70px;
    max-width: 100px;
  }

  /* Prevent header elements from wrapping */
  .header-inner {
    flex-wrap: nowrap;
    align-items: center;
  }
}

/* Extra Small Devices */
@media (max-width: 575px) {
  .auth-buttons .btn,
  .auth-buttons .btn-register,
  .auth-buttons .btn-login,
  .auth-buttons .btn-profile,
  .auth-buttons .btn-logout {
    padding: 5px 8px;
    font-size: 0.8rem;
    min-width: 60px;
    max-width: 80px;
  }

  .header-logo img {
    max-height: 40px;
  }
}

/* Header button fixes across all screen sizes */
@media (max-width: 768px) {
  /* Make sure buttons look good on mobile */
  .auth-buttons .btn,
  .auth-buttons .btn-register,
  .auth-buttons .btn-login,
  .auth-buttons .btn-profile,
  .auth-buttons .btn-logout,
  .home-page .auth-buttons .btn,
  .home-page .auth-buttons .btn-register,
  .home-page .auth-buttons .btn-login,
  .home-page .auth-buttons .btn-profile,
  .home-page .auth-buttons .btn-logout {
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    min-width: 80px !important;
    max-width: 100px !important;
    margin: 0 2px !important;
  }

  /* Header container needs to be well-sized */
  .header-inner,
  .home-page .header-inner {
    padding: 0 10px !important;
  }

  /* Smaller logo on mobile */
  .header-logo img {
    max-height: 45px !important;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .auth-buttons .btn,
  .auth-buttons .btn-register,
  .auth-buttons .btn-login,
  .auth-buttons .btn-profile,
  .auth-buttons .btn-logout,
  .home-page .auth-buttons .btn,
  .home-page .auth-buttons .btn-register,
  .home-page .auth-buttons .btn-login,
  .home-page .auth-buttons .btn-profile,
  .home-page .auth-buttons .btn-logout {
    padding: 5px 8px !important;
    font-size: 0.8rem !important;
    min-width: 70px !important;
    max-width: 90px !important;
  }

  .header-logo img {
    max-height: 40px !important;
  }
}

/* AUTH BUTTONS RESPONSIVE STYLES */
@media (max-width: 768px) {
  .auth-buttons {
    gap: 6px;
  }

  .auth-buttons .btn,
  .auth-buttons .btn-register,
  .auth-buttons .btn-login,
  .auth-buttons .btn-profile,
  .auth-buttons .btn-logout {
    padding: 6px 12px;
    font-size: 0.85rem;
    min-width: 80px;
    margin: 0 2px;
  }

  .auth-container {
    gap: 6px;
    padding-right: 8px;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .auth-buttons .btn,
  .auth-buttons .btn-register,
  .auth-buttons .btn-login,
  .auth-buttons .btn-profile,
  .auth-buttons .btn-logout {
    padding: 5px 10px;
    font-size: 0.8rem;
    min-width: 70px;
  }

  .auth-container {
    gap: 4px;
    padding-right: 5px;
  }
}
