/* --- Coloring Gallery: Main Styles --- */

/* Gallery Controls Section */
.coloring-gallery-controls {
    text-align: center;
    margin-bottom: 20px;
  }
  
  #gallery-search {
    width: 90%;
    max-width: 400px;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #D4C7B4;
    font-size: 1rem;
  }
  
  #gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
  }
  
  .filter-btn {
    background-color: #f2c94c;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
  }
  
  .filter-btn.active {
    background-color: #e0b63e;
    color: #fff;
  }
  
  /* Coloring Pages Section - Main Container */
  .coloring-gallery-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 40px 0;
  }
  
  /* Each Folder Group */
  .coloring-folder-group {
    background: #F9F1E6;
    border: 2px dashed #FFFCF9;
    border-radius: 20px;
    padding: 10px 20px;
    display: flex; /* Keep as flex */
    flex-wrap: nowrap; /* Don't wrap the main items */
    align-items: flex-start;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: relative;
    margin-bottom: 0; /* Add this */
    margin-top: 0;    /* Add this */
  }

    /* GALLERY PAGE SPECIFIC CLASSES - NO CONFLICTS */
  .coloring-gallery-section .gallery-page-card {
    /* Different from .coloring-page-card */
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 350px; /* Smaller than homepage */
  }

  .coloring-gallery-section .gallery-image-container {
    /* Different from homepage image container */
    position: relative;
    width: 100%;
    aspect-ratio: 832/1216;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
  }

  .coloring-gallery-section .gallery-page-thumbnail {
    /* Different from .coloring-page-thumbnail */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
  }

  .coloring-gallery-section .gallery-page-actions {
    /* Different from .coloring-page-actions */
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 10px;
    margin-top: auto;
    min-height: 50px;
    align-items: center;
  }

  .coloring-gallery-section .gallery-btn {
    /* NEW CLASS - not .btn */
    padding: 4px 8px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
    justify-content: center;
    max-width: 80px; /* Much smaller than homepage */
  }

  .coloring-gallery-section .gallery-btn-color {
    background: #ff6b6b;
    color: white;
  }

  .coloring-gallery-section .gallery-btn-download {
    background: #4caf50;
    color: white;
  }
  
  /* Vertical Folder Label */
  .folder-label-vertical {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Nunito', sans-serif;
    color: #478559;
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 10px;
  }
  
  .gallery-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: calc(100% - 60px); /* Account for vertical label */
  }
  /* Horizontal Scroll Container for Images */
  .coloring-folder-gallery {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    width: 100%; /* Take full width of wrapper */
  }
  
  /* Each Image Card */
  
  
  
  

  
  /* Category Description */
  .category-description {
    font-size: 0.85rem;
    color: #777;
    margin: 8px 0 0;
    padding: 0;
    text-align: left;
    width: 100%;
    line-height: 1.3;
  }
  
  /* Download Button */
  .coloring-page-actions {
    margin-top: 8px;
  }
  
  
  /* Scroll Hint */
  .has-scroll-hint {
    position: relative;
    overflow-x: auto;
  }
  
  .has-scroll-hint::after {
    content: "⬅️  Scroll";
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: rgba(255, 253, 249, 0.9);
    color: #666;
    font-size: 1rem;
    padding: 6px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    pointer-events: none;
    animation: fade-scroll-hint 2s ease-in-out infinite alternate;
  }
  
  /* Subtle animation for scroll hint */
  @keyframes fade-scroll-hint {
    from { opacity: 0.7; }
    to { opacity: 0.3; }
  }
  
  /* No Results Message */
  .no-results-message {
    display: none;
    text-align: center;
    padding: 20px;
    font-size: 1.2rem;
    color: #666;
  }
  
  /* Show message when no results */
  .no-results .no-results-message {
    display: block;
  }
  
  /* FancyBox Styling for Coloring Page Viewer */
  .fancybox__container {
    background: rgba(0,0,0,0.7); /* soft dark background around popup */
  }
  
  .fancybox__content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    overflow: hidden;
  }
  
  .fancybox-zoomIn {
    animation: zoomIn 0.4s ease;
  }
  
  .fancybox-zoomOut {
    animation: zoomOut 0.3s ease;
  }
  
  @keyframes zoomIn {
    from {
      opacity: 0;
      transform: scale(0.8);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
  
  @keyframes zoomOut {
    from {
      opacity: 1;
      transform: scale(1);
    }
    to {
      opacity: 0;
      transform: scale(0.8);
    }
  }
  
  /* FancyBox overrides */
  .fancybox__slide {
    padding: 0 !important;
  }
  
  .fancybox__content {
    width: 98vw !important;
    height: 98vh !important;
    max-width: 98vw !important;
    max-height: 98vh !important;
    flex: 1 1 auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .fancybox__iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
  }
  
  .fancybox__carousel {
    padding: 0 !important;
  }
  
  .fancybox__carousel .carousel__slide {
    padding: 0 !important;
  }
  
  @media all and (min-width: 1024px) {
    .fancybox__slide {
      padding: 0 !important;
    }
  }
  
  /* Mobile Responsiveness */
  @media screen and (max-width: 768px) {
    /* Convert to vertical layout */
    .coloring-folder-group {
      flex-direction: column;
      align-items: flex-start;
      overflow-x: visible;
      padding: 15px;
    }
    
    .folder-label-vertical {
      writing-mode: horizontal-tb;
      transform: none;
      width: 100%;
      text-align: center;
      padding: 8px 0;
      margin-right: 0;
      margin-bottom: 10px;
    }
    
    .gallery-content-wrapper {
        width: 100%;
      }

    .category-description {
        text-align: center;
      }
    
    .coloring-folder-gallery {
      width: 100%;
      flex-direction: column;
      overflow-x: visible;
      gap: 15px;
      padding-bottom: 0;
    }
    
    
    
    
    /* Center the download button */
    .coloring-page-actions {
      display: flex;
      justify-content: center;
    }
    
    /* Remove horizontal scroll indicators on mobile */
    .has-scroll-hint::after {
      display: none;
    }
    
    /* Filter buttons for mobile */
    #gallery-filters {
      gap: 5px;
    }
    
    .filter-btn {
      padding: 6px 12px;
      font-size: 0.9rem;
    }
  }
  
  /* Stronger mobile adjustments for very small screens */
  @media screen and (max-width: 480px) {
    #gallery-search {
      width: 100%;
    }
    
    #gallery-filters {
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: center;
    }
    
    .filter-btn {
      margin-bottom: 5px;
      flex: 0 0 auto;
    }
  }