/* ComparePesca - Responsive Stylesheet */

/* Tablet and below */
@media (max-width: 1024px) {
  :root {
    font-size: 15px;
  }

  .container {
    padding: 0 var(--spacing-sm);
  }

  .items-container {
    grid-template-columns: 1fr;
  }

  .filters-sidebar {
    margin-bottom: var(--spacing-md);
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  /* Mapa - altura intermediária em tablets */
  #fishing-map {
    height: 450px !important; /* Era 600px */
  }
}

/* Mobile */
@media (max-width: 768px) {
  body {
    padding-top: 135px; /* Garante espaço para header e nav fixos no mobile */
  }

  .hero-slideshow {
    height: 350px;
  }

  .slide-content h1 {
    font-size: 2rem;
  }

  .slide-content p {
    font-size: 1rem;
  }

  .iqp-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .page-header-content {
    flex-direction: column;
    text-align: center;
  }

  .page-header-content button {
    width: 100%;
  }

  .mobile-menu-toggle {
    display: block !important;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 32px; /* Abaixo do header (91px) + nav (~44px) */
    left: 0;
    right: 0;
    background: var(--primary-color);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    z-index: 998;
    max-height: calc(100vh - 135px);
    overflow-y: auto;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-link {
    width: 100%;
    justify-content: flex-start;
  }

  /* Profile button mobile adjustments */
  #profile-btn {
    font-size: 1.75rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .btn-icon {
    padding: 0.4rem;
  }

  /* Mapa - altura reduzida no mobile */
  #fishing-map {
    height: 350px !important; /* Era 600px */
  }

  .map-container {
    margin-bottom: var(--spacing-md);
  }

  /* Facilitar navegação no mapa mobile */
  .leaflet-control-zoom {
    margin: 8px !important;
  }

  .leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  :root {
    font-size: 14px;
  }

  /* Reduzir padding lateral do container geral */
  .container {
    padding: 0 0.5rem !important;
  }

  .header-content {
    padding: 0.5rem 0;
  }

  .logo-image {
    height: 65px;
    width: auto;
    object-fit: contain;
  }

  .logo-text {
    display: none;
  }

  .slide-content h1 {
    font-size: 1.5rem;
  }

  .selected-items {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .btn {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }

  /* Weather Info Grid - Mobile Fix */
  .weather-info-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.4rem !important;
    padding: 0 !important;
    margin: 1rem 0 0 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .weather-info-grid > div {
    min-width: 0 !important;
    padding: 0.2rem 0 !important;
    box-sizing: border-box !important;
  }

  .weather-info-grid i {
    font-size: 1.25rem !important;
  }

  .weather-info-grid > div > div:first-of-type {
    font-size: 0.95rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.15rem !important;
    box-sizing: border-box !important;
  }

  .weather-info-grid > div > div:last-of-type {
    font-size: 0.65rem !important;
  }

  /* Fishing Date Info - Mobile Padding */
  .fishing-date-info {
    padding: 1rem 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  /* Assistant Results - Reduzir margens laterais do card */
  #assistant-results .card {
    padding: 0.75rem 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  #assistant-results > .card {
    padding: 0.75rem 0.5rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

/* IQP Display - Alargar */
.iqp-display {
  padding: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.iqp-score {
  display: flex;           /* Habilita o Flexbox */
  flex-direction: column;
  justify-content: center; /* Centraliza horizontalmente */
  align-items: center;     /* Centraliza verticalmente */
  text-align: center;
  width: 100%;             /* Garante que ocupe a largura total para o centro ser real */
}

.iqp-score-large {
  padding: 1rem 0.5rem !important;
  margin: 0 auto;          /* Margem automática nas laterais como redundância */

  .score-label {
    margin-top: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

  /* Hierarchical Catalog Responsive */
  .groups-grid {
    grid-template-columns: 1fr;
  }

  .group-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .items-grid-catalog {
    grid-template-columns: 1fr;
  }

  .items-filter-bar {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .filter-search {
    min-width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .breadcrumb-nav {
    font-size: 0.85rem;
  }

  /* Item Details Modal Responsive */
  .item-details-grid {
    grid-template-columns: 1fr;
  }

  .item-image-large {
    height: 250px;
  }

  .item-details-info h2 {
    font-size: 1.5rem;
  }

  .item-price-large {
    font-size: 2rem;
  }

  .specs-grid {
    grid-template-columns: 1fr;
  }

  .item-actions-large {
    flex-direction: column;
  }

  /* Toast Responsive */
  .toast {
    bottom: 20px;
    right: 20px;
    left: 20px;
    min-width: auto;
  }

  /* Comparison Responsive */
  .selected-items {
    grid-template-columns: repeat(2, 1fr);
  }

  .item-slot {
    min-height: 150px;
    padding: var(--spacing-md);
  }

  .comparison-header {
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: flex-start;
  }

  .comparison-table-wrapper {
    padding: var(--spacing-md);
  }

  .comparison-table {
    font-size: 0.85rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: var(--spacing-sm);
  }

  .comparison-table th.spec-column {
    width: 120px;
  }

  .item-header strong {
    font-size: 0.9rem;
  }

  .item-header .price {
    font-size: 1rem;
  }

  /* Sidebar Responsive */
  .items-layout {
    grid-template-columns: 1fr;
  }

  .categories-sidebar {
    position: fixed;
    left: -100%;
    top: 80px; /* Space for header */
    bottom: 0;
    z-index: 999;
    width: 280px;
    max-height: calc(100vh - 80px);
    border-radius: 0;
    transition: left 0.3s ease;
    box-shadow: none;
    overflow-y: auto;
    padding-top: 0;
  }

  .categories-sidebar.active {
    left: 0;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
  }

  .sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  /* Floating menu button for mobile catalog */
  .mobile-catalog-menu {
    display: flex !important;
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), #0a7ea4);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 998;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .mobile-catalog-menu:active {
    transform: scale(0.95);
  }

  .mobile-catalog-menu:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  }

  /* Backdrop overlay for sidebar */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .sidebar-backdrop.active {
    display: block;
    opacity: 1;
  }

  .items-content {
    width: 100%;
  }

  .sidebar-category-item {
    padding: 1rem;
  }

  .category-item-name {
    font-size: 1rem;
  }

  /* Logbook button positioning fix */
  .floating-add-btn {
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }

  .captures-header {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: stretch;
  }

  .captures-header .btn {
    width: 100%;
    justify-content: center;
  }

  /* Profile tabs mobile */
  .profile-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .profile-tabs::-webkit-scrollbar {
    display: none;
  }

  .profile-tab {
    flex-shrink: 0;
    min-width: 120px;
    font-size: 0.9rem;
  }

  /* Inventory mobile */
  .inventory-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .inventory-actions {
    width: 100%;
    justify-content: space-between;
  }

  /* Comparison mobile improvements */
  .floating-compare-btn {
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
  }

  /* Items grid mobile */
  .items-grid-catalog {
    grid-template-columns: 1fr;
  }

  /* Catalog item cards */
  .item-card-catalog {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .item-image-catalog {
    width: 100%;
    height: 200px;
    flex-shrink: 0;
    position: relative;
  }

  /* Adjust favorite button for mobile */
  .btn-favorite {
    width: 36px;
    height: 36px;
    top: 8px;
    left: 8px;
  }

  .btn-favorite i {
    font-size: 1rem;
  }

  /* Adjust release date badge for mobile */
  .item-card-catalog .item-badge {
    top: 8px;
    right: 8px;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    max-width: calc(100% - 60px); /* Space for favorite button */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .item-info-catalog {
    flex: 1;
  }

  .item-content-catalog {
    padding: var(--spacing-sm);
  }

  /* Search results mobile */
  .search-results-dropdown {
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 60vh;
  }

  /* Notification dropdown mobile */
  .notifications-dropdown {
    left: 10px;
    right: 10px;
    width: auto;
  }

  /* IQP display mobile */
  .iqp-display {
    padding: var(--spacing-md);
  }

  .iqp-gauge {
    width: 120px;
    height: 120px;
  }

  /* Tools Category Grid - Mobile */
  .tools-category-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .category-card {
    padding: var(--spacing-lg);
  }

  .category-icon {
    font-size: 2.5rem;
  }

  /* Calculator Mode Forms - Mobile */
  .capacity-mode .form-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }

  /* Bidirectional Converter - Mobile */
  .converter-bidirectional {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .converter-arrow {
    padding-top: 0;
    transform: rotate(90deg);
    font-size: 1.2rem;
  }

  .converter-info {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }

  /* Fixes for landscape orientation on mobile */
  @media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
      max-height: 90vh;
      padding: var(--spacing-sm);
    }

    .capture-form .form-grid {
      grid-template-columns: 1fr 1fr;
    }
  }
}
