/* Responsive styles for the website */

/* ============================================
   NEW SITE HEADER RESPONSIVE OVERRIDES
   ============================================ */

/* Ensure category pills scroll properly on all devices */
.category-pills,
.category-scroll-container,
.sub-category-scroll-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-pills::-webkit-scrollbar,
.category-scroll-container::-webkit-scrollbar,
.sub-category-scroll-container::-webkit-scrollbar {
    display: none;
    height: 0;
    width: 0;
}

/* ============================================
   TABLET BREAKPOINT (768px and below)
   ============================================ */
@media (max-width: 768px) {
    /* New Site Header - Tablet */
    .site-header .header-row-1 {
        height: 46px;
    }
    
    .site-header .header-container {
        padding: 0 12px;
        gap: 10px;
    }
    
    .site-header .brand-logo {
        width: 30px;
        height: 30px;
    }
    
    .site-header .brand-text {
        font-size: 0.95rem;
    }
    
    .site-header .header-search {
        max-width: 300px;
    }
    
    .site-header .header-search .search-input-wrapper {
        height: 40px;
    }
    
    .site-header .header-row-2 {
        height: 42px;
    }
    
    .site-header .category-pill {
        padding: 7px 12px;
        font-size: 12px;
    }
    
    /* Old Header - Tablet (legacy support) */
    .floating-header {
        position: sticky;
        top: 0;
        width: 100%;
    }

    .floating-navbar {
        padding: 0.4rem 0.75rem;
        border-radius: 0;
        min-height: 48px;
        max-height: 60px;
    }

    .floating-navbar .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0 0.5rem;
    }

    .nav-brand {
        font-size: 0.85rem;
        flex-shrink: 0;
        gap: 0.3rem;
    }
    
    .brand-logo {
        width: 28px;
        height: 28px;
    }

    .nav-search {
        flex: 1;
        max-width: 280px;
        min-width: 120px;
    }

    .nav-search .search-input-wrapper {
        padding: 0.35rem 0.65rem;
        border-radius: 18px;
        height: 32px;
    }

    .nav-search #searchInput {
        font-size: 0.8rem;
    }

    .nav-search #searchInput::placeholder {
        font-size: 0.75rem;
    }
    
    .nav-search .search-icon {
        font-size: 0.7rem;
        margin-right: 0.3rem;
    }

    .nav-actions {
        gap: 0.3rem;
        flex-shrink: 0;
    }
    
    .nav-about-btn {
        padding: 0.28rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 16px;
    }
    
    .nav-about-btn i {
        font-size: 0.65rem;
    }
    
    .theme-toggle {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    /* Category Section - Tablet */
    .sticky-category-wrapper {
        top: 48px;
    }

    .sticky-category-wrapper.scrolled {
        top: 48px;
    }

    .sticky-category-bar {
        padding: 0;
    }
    
    .category-filter-section {
        padding: 0.35rem 0;
    }
    
    .category-filters {
        gap: 0.25rem;
    }
    
    .category-scroll-container, .sub-category-scroll-container {
        padding: 0.1rem 0.5rem;
        gap: 0.35rem;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .category-chip {
        padding: 5px 12px;
        font-size: 0.73rem;
        gap: 0.25rem;
        border-radius: 18px;
    }
    
    .category-icon {
        font-size: 0.75rem;
    }
    
    .category-icon[src] {
        width: 13px;
        height: 13px;
    }
    
    .category-text {
        font-size: 0.73rem;
    }
    
    /* Sub-categories - Tablet */
    .sub-category-scroll-container .category-chip {
        padding: 4px 10px;
        font-size: 0.68rem;
        gap: 0.2rem;
    }
    
    .sub-category-scroll-container .category-icon {
        font-size: 0.65rem;
    }
    
    .sub-category-scroll-container .category-icon[src] {
        width: 11px;
        height: 11px;
    }
    
    .sub-categories {
        margin-top: 0.15rem;
        padding-top: 0.15rem;
    }

    /* Main content spacing */
    main {
        padding-top: 0;
    }
    
    /* Hero compact on tablet */
    .hero {
        padding: 0.4rem 0;
    }
}

/* ============================================
   LARGE MOBILE BREAKPOINT (480px and below)
   ============================================ */
@media (max-width: 480px) {
    /* New Site Header - Mobile */
    .site-header .header-row-1 {
        height: 44px;
    }
    
    .site-header .header-container {
        padding: 0 10px;
        gap: 8px;
    }
    
    .site-header .brand-logo {
        width: 28px;
        height: 28px;
    }
    
    .site-header .brand-text {
        display: none;
    }
    
    .site-header .header-search {
        flex: 1;
        max-width: none;
    }
    
    .site-header .header-search .search-input-wrapper {
        height: 38px;
        padding: 0 12px;
    }
    
    .site-header .header-row-2 {
        height: 40px;
    }
    
    .site-header .category-pills-container {
        padding: 0 10px;
    }
    
    .site-header .category-pill {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .site-header .menu-toggle,
    .site-header .compact-search-btn {
        width: 34px;
        height: 34px;
    }
    
    .site-header.compact .header-row-1 {
        height: 38px;
    }
    
    .site-header.compact .header-row-2 {
        height: 34px;
    }
    
    /* Old Header - Mobile (legacy support) */
    .floating-header {
        position: sticky;
        top: 0;
        width: 100%;
    }

    .floating-navbar {
        padding: 0.35rem 0.5rem;
        min-height: 44px;
        max-height: 52px;
    }

    .floating-navbar .container {
        gap: 0.4rem;
    }

    .nav-brand span {
        display: none; /* Hide text on small screens */
    }
    
    .brand-logo {
        width: 26px;
        height: 26px;
    }

    .nav-search {
        flex: 1;
        max-width: 100%;
    }

    .nav-search .search-input-wrapper {
        padding: 0.3rem 0.55rem;
        border-radius: 16px;
        height: 30px;
    }
    
    .nav-search .search-icon {
        font-size: 0.65rem;
    }
    
    .nav-search #searchInput {
        font-size: 0.78rem;
    }
    
    .nav-about-btn span {
        display: none;
    }
    
    .nav-about-btn {
        padding: 0.25rem 0.4rem;
        border-radius: 14px;
    }
    
    .theme-toggle {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }

    /* Category Section - Large Mobile */
    .sticky-category-wrapper {
        top: 44px;
    }

    .sticky-category-wrapper.scrolled {
        top: 44px;
    }
    
    .category-filter-section {
        padding: 0.3rem 0;
    }

    .category-chip {
        padding: 5px 10px;
        font-size: 0.7rem;
        border-radius: 16px;
        gap: 0.2rem;
    }
    
    .category-icon[src] {
        width: 12px;
        height: 12px;
    }
    
    .category-scroll-container, .sub-category-scroll-container {
        padding: 0.1rem 0.4rem;
        gap: 0.3rem;
    }
    
    .sub-category-scroll-container .category-chip {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
    
    .hero {
        padding: 0.3rem 0;
    }

    main {
        padding-top: 0;
    }
}

/* ============================================
   EXTRA SMALL MOBILE BREAKPOINT (360px and below)
   ============================================ */
@media (max-width: 360px) {
    .floating-navbar {
        padding: 0.3rem 0.4rem;
        min-height: 40px;
        max-height: 48px;
    }
    
    .brand-logo {
        width: 24px;
        height: 24px;
    }
    
    .nav-search .search-input-wrapper {
        padding: 0.25rem 0.45rem;
        height: 28px;
        border-radius: 14px;
    }
    
    .nav-search #searchInput {
        font-size: 0.72rem;
    }
    
    .nav-about-btn {
        padding: 0.2rem 0.35rem;
    }
    
    .theme-toggle {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }
    
    .sticky-category-wrapper {
        top: 40px;
    }
    
    .category-chip {
        padding: 4px 8px;
        font-size: 0.65rem;
        border-radius: 14px;
    }
    
    .category-icon[src] {
        width: 11px;
        height: 11px;
    }
    
    .sub-category-scroll-container .category-chip {
        padding: 3px 7px;
        font-size: 0.6rem;
    }
}

/* ============================================
   MOBILE LAYOUT FIXES
   ============================================ */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    /* Single column layout for mobile */
    .trending-prompts,
    .prompts-grid {
        grid-template-columns: 1fr !important;
        gap: 0.625rem;
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    /* Trending section mobile adjustments */
    .prompts-section {
        margin-bottom: 1.5rem;
    }
    
    .prompts-section-grid {
        grid-template-columns: 1fr !important;
        gap: 0.625rem;
    }
    
    .remaining-prompts-grid {
        grid-template-columns: 1fr !important;
        gap: 0.625rem;
        margin-top: 1.5rem;
    }
    
    .section-label {
        font-size: 0.8125rem;
        padding: 0.2rem 0.625rem;
    }

    /* Stack prompt cards vertically */
    .prompt-card {
        max-width: 100%;
        margin: 0 auto;
        padding: 0.75rem;
    }
    
    /* Compact prompt header for mobile */
    .prompt-header {
        margin-bottom: 0.5rem;
        gap: 0.25rem;
    }
    
    .prompt-title {
        font-size: 0.9375rem;
        line-height: 1.3;
    }
    
    .prompt-badges {
        gap: 0.25rem;
    }
    
    .category-badge,
    .trending-badge,
    .new-badge {
        padding: 0.1rem 0.375rem;
        font-size: 0.5625rem;
        letter-spacing: 0.2px;
    }
    
    /* Compact image for mobile */
    .prompt-image-wrapper {
        width: calc(100% + 1.5rem);
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .prompt-image-wrapper[data-aspect="portrait"] {
        max-height: 400px;
    }
    
    .prompt-image-wrapper[data-aspect="square"] {
        max-height: 320px;
    }
    
    .prompt-image-wrapper[data-aspect="landscape"],
    .prompt-image-wrapper[data-aspect="wide"] {
        max-height: 250px;
    }
    
    .prompt-image-wrapper:not([data-aspect]) {
        max-height: 280px;
    }
    
    /* Text visibility - ensure 4 lines on mobile */
    .prompt-text {
        font-size: 0.8125rem;
        line-height: 1.45;
        margin-bottom: 0.375rem;
    }
    
    .prompt-text.collapsed {
        -webkit-line-clamp: 4;
        line-clamp: 4;
    }
    
    .show-more-btn {
        font-size: 0.75rem;
        margin-top: 0.25rem;
    }
    
    /* Compact action area for mobile */
    .prompt-actions {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        gap: 0.375rem;
        flex-wrap: nowrap;
    }
    
    .copy-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
        gap: 0.25rem;
    }
    
    .copy-btn i {
        font-size: 0.7rem;
    }
    
    .action-buttons {
        gap: 0.25rem;
    }
    
    .action-btn {
        padding: 0.3rem 0.5rem;
        height: 28px;
        font-size: 0.6875rem;
        gap: 0.2rem;
    }
    
    .action-btn i {
        font-size: 0.625rem;
    }
    
    .action-btn img {
        width: 12px;
        height: 12px;
    }
    
    .action-btn-text {
        font-size: 0.625rem;
    }

    .search-bar {
        width: 100%;
        max-width: 100%;
        margin: 0.5rem 0;
    }
    
    .container {
        padding: 0 0.5rem;
        max-width: 100%;
    }
    
    .section-title {
        font-size: 1.5rem;
        text-align: left;
        justify-content: flex-start;
    }
    
    .section-header {
        justify-content: flex-start;
        text-align: left;
        margin-bottom: 1.25rem;
    }
    
    .trending-icon {
        font-size: 1.5rem;
    }

    /* Category buttons stack */
    .categories {
        flex-direction: column;
        gap: 0.5rem;
    }

    .category-btn {
        width: 100%;
        text-align: center;
    }
    
    .category-filter-section .container {
        padding: 0 0.5rem;
    }

    /* Category filters already responsive in main CSS */
}

/* Extra small mobile - optimize single column */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .trending-prompts,
    .prompts-grid {
        gap: 0.5rem;
        padding: 0 0.375rem;
    }

    .container {
        padding: 0 0.375rem;
    }

    .prompt-card {
        padding: 0.625rem;
    }
    
    .prompt-header {
        margin-bottom: 0.375rem;
        gap: 0.2rem;
    }
    
    .prompt-title {
        font-size: 0.875rem;
    }
    
    .category-badge,
    .trending-badge,
    .new-badge {
        padding: 0.0625rem 0.3125rem;
        font-size: 0.5rem;
    }
    
    .prompt-image-wrapper {
        width: calc(100% + 1.25rem);
        margin-left: -0.625rem;
        margin-right: -0.625rem;
        margin-bottom: 0.375rem;
    }
    
    .prompt-image-wrapper[data-aspect="portrait"] {
        max-height: 360px;
    }
    
    .prompt-image-wrapper[data-aspect="square"] {
        max-height: 280px;
    }
    
    .prompt-image-wrapper[data-aspect="landscape"],
    .prompt-image-wrapper[data-aspect="wide"] {
        max-height: 220px;
    }
    
    .prompt-image-wrapper:not([data-aspect]) {
        max-height: 240px;
    }
    
    .prompt-text {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    .show-more-btn {
        font-size: 0.6875rem;
    }
    
    .prompt-actions {
        margin-top: 0.375rem;
        padding-top: 0.375rem;
        gap: 0.25rem;
    }
    
    .copy-btn {
        padding: 0.3125rem 0.5rem;
        font-size: 0.6875rem;
    }
    
    .action-btn {
        padding: 0.25rem 0.375rem;
        height: 26px;
        font-size: 0.625rem;
    }
    
    .action-btn img {
        width: 10px;
        height: 10px;
    }
    
    .action-btn-text {
        font-size: 0.5625rem;
    }

    /* Smaller trending section heading for small mobile */
    .section-title {
        font-size: 1.25rem;
        text-align: left;
        justify-content: flex-start;
        gap: 0.35rem;
    }
    
    .section-header {
        justify-content: flex-start;
        text-align: left;
        margin-bottom: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .trending-icon {
        font-size: 1.125rem;
    }
}

/* Extra small mobile (360px and below) */
@media (max-width: 360px) {
    .prompt-card {
        padding: 0.5rem;
    }
    
    .prompt-image-wrapper {
        width: calc(100% + 1rem);
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .prompt-image-wrapper[data-aspect="portrait"] {
        max-height: 340px;
    }
    
    .prompt-image-wrapper[data-aspect="square"] {
        max-height: 260px;
    }
    
    .prompt-image-wrapper[data-aspect="landscape"],
    .prompt-image-wrapper[data-aspect="wide"] {
        max-height: 200px;
    }
    
    .prompt-image-wrapper:not([data-aspect]) {
        max-height: 220px;
    }
    
    .prompt-title {
        font-size: 0.8125rem;
    }
    
    .prompt-text {
        font-size: 0.6875rem;
    }
    
    .copy-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.625rem;
    }
    
    .action-btn {
        padding: 0.2rem 0.3rem;
        height: 24px;
        font-size: 0.5625rem;
    }
    
    .action-btn-text {
        font-size: 0.5rem;
    }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
    body {
        font-size: 16px;
    }

    .navbar {
        flex-direction: row;
    }

    .trending-prompts,
    .prompts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Trending section tablet adjustments */
    .prompts-section-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    
    .remaining-prompts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
        margin-top: 2rem;
    }

    .search-bar {
        width: 80%;
    }
    
    /* Tablet image wrapper adjustments */
    .prompt-card {
        padding: 1.25rem;
    }
    
    .prompt-image-wrapper {
        width: calc(100% + 2.5rem);
        margin-left: -1.25rem;
        margin-right: -1.25rem;
    }
    
    .prompt-image-wrapper[data-aspect="portrait"] {
        max-height: 480px;
    }
    
    .prompt-image-wrapper[data-aspect="square"] {
        max-height: 400px;
    }
    
    .prompt-image-wrapper[data-aspect="landscape"] {
        max-height: 320px;
    }
}

/* Desktop styles */
@media (min-width: 1025px) {
    body {
        font-size: 18px;
    }

    .trending-prompts {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
    
    /* Single continuous grid for all prompts */
    .prompts-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        justify-content: center;
    }
    
    /* Full-width label spans all columns */
    .grid-label-item {
        grid-column: 1 / -1;
    }

    .search-bar {
        width: 60%;
    }
    
    /* Desktop image wrapper adjustments */
    .prompt-card {
        padding: 1rem;
    }
    
    .prompt-image-wrapper {
        width: calc(100% + 2rem);
        margin-left: -1rem;
        margin-right: -1rem;
    }
    
    .prompt-image-wrapper[data-aspect="portrait"] {
        max-height: 500px;
    }
    
    .prompt-image-wrapper[data-aspect="square"] {
        max-height: 420px;
    }
    
    .prompt-image-wrapper[data-aspect="landscape"] {
        max-height: 340px;
    }
}