/* =============================================
   MAIN.CSS — Ninja Prompts (ФИНАЛЬНАЯ ВЕРСИЯ)
   ============================================= */

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    background: #f8f9fa;
    color: #111;
    line-height: 1.5;
}

/* ====================== HEADER ====================== */
header {
    background: white;
    padding: 20px 40px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1760px;
    margin: 0 auto;
}

.left-categories {
    flex: none !important;
    display: flex;
}

.header-right {
    margin-left: auto !important;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    height: 58px;
    width: auto;
    display: block;
    transition: transform 0.2s ease;
}

.logo:hover { transform: scale(1.05); }

.user-panel {
    display: flex;
    align-items: center;
    gap: 16px;
}

.add-btn {
    background: #faaf2d;
    color: black;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.add-btn:hover { background: #fcd34d; }

.social-divider {
    width: 1px;
    height: 22px;
    background-color: #d1d5db;
    margin: 0 4px;
    align-self: center;
}

.social-icon {
    font-size: 1.8rem;
    color: #000;
    transition: transform 0.2s ease, color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
}

.social-icon:hover { transform: scale(1.12); }

.top-categories {
    display: flex;
    gap: 28px;
}

.top-category {
    font-weight: 600;
    color: #333;
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.top-category:hover,
.top-category.active {
    color: #000;
    border-bottom: 3px solid #faaf2d;
}

/* ====================== FILTERS ====================== */
.filters {
    display: flex;
    gap: 10px;
    padding: 20px 40px;
    background: white;
    border-bottom: 1px solid #eee;
    overflow-x: auto;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 8px 22px;
    border-radius: 9999px;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    color: #555;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
}

.filter-chip:hover { background: #f1f1f1; }
.filter-chip.active {
    background: #111;
    color: white;
    border-color: #111;
}

/* ====================== GRID & CARDS ====================== */
.grid {
    display: grid;
    gap: 26px;
    max-width: 1760px;
    margin: 0 auto;
    padding: 40px 40px 80px;
}

/* СТРОГО 1 КАРТОЧКА В РЯД НА МОБИЛЬНОМ */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
        padding: 20px 16px 60px;
    }
}

@media (min-width: 769px) and (max-width: 899px) {
    .grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (min-width: 900px) and (max-width: 1249px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1250px) {
    .grid { grid-template-columns: repeat(4, 1fr); }
}

/* ====================== CARD ====================== */
.card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

/* ====================== PHOTO CONTAINER (ВЕРТИКАЛЬНЫЕ!) ====================== */
.photo-container {
    position: relative;
    width: 100%;
    height: auto !important;
    aspect-ratio: 4 / 5 !important;
    max-height: 480px;
    background: #f8f9fa;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ====================== ВНУТРЕННИЕ ЭЛЕМЕНТЫ КАРТОЧКИ ====================== */
/* ====================== CATEGORY BADGE ====================== */
.category-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 9999px;
    z-index: 30;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.group-name-badge {
    display: inline-block;
    background: #f1f1f1;
    color: #2C2C2C;
    padding: 7px 18px;
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-decoration: none;
    transition: all 0.25s ease;
    border: 1px solid #e0e0e0;
}

.group-name-badge:hover {
    background: #2C2C2C;
    color: #E5E5E5;
    border-color: #2C2C2C;
}

.copy-btn {
    margin-top: auto;
    width: 100%;
    background: #111;
    color: white;
    border: none;
    padding: 14px 0;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #000;
    transform: translateY(-1px);
}

/* ====================== MAIN PHOTO ====================== */
.main-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ====================== UGC КАРУСЕЛЬ ====================== */
.ugc-swiper {
    width: 100% !important;
    height: 100% !important;
    border-radius: 20px;
}

.ugc-swiper .swiper-slide {
    width: 100%;
    height: 100%;
}

.ugc-swiper .swiper-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

.ugc-swiper .swiper-button-prev,
.ugc-swiper .swiper-button-next {
    color: white;
    background: transparent !important;
    width: 44px;
    height: 44px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 0;
    transition: all 0.2s ease;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ugc-swiper .swiper-button-prev:hover,
.ugc-swiper .swiper-button-next:hover {
    color: #faaf2d;
}

/* ====================== МОБИЛЬНОЕ МЕНЮ ====================== */
.mobile-menu {
    display: none;
    background: white;
    border-top: 1px solid #eee;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.mobile-menu.open {
    display: block;
}

.mobile-menu-content {
    max-width: 1760px;
    margin: 0 auto;
    padding: 16px 40px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-nav-link {
    display: block;
    padding: 14px 20px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: #f8f9fa;
    color: #000;
}

.mobile-divider {
    height: 1px;
    background: #eee;
    margin: 8px 0;
}

/* ====================== БУРГЕР ====================== */
.burger-btn {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #111;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.burger-btn:hover {
    background: #f1f1f1;
}

/* ====================== СКРЫТИЕ ДЕСКТОПНЫХ ЭЛЕМЕНТОВ НА МОБИЛЬНОМ ====================== */
@media (max-width: 768px) {
    .left-categories,
    .header-right .top-categories {
        display: none !important;
    }
    
    .burger-btn {
        display: flex !important;
    }
    
    .header-inner {
        padding: 16px 20px;
    }
    
    .logo {
        height: 48px;
    }
}


/* ====================== SCREENSHOT PROTECTION ====================== */
.screenshot-detected .card img {
    filter: blur(12px) brightness(0.4) !important;
}

/* ====================== PAGINATION ====================== */
.pagination {
    text-align: center;
    margin: 80px 0 60px;
}

.pagination a {
    display: inline-block;
    padding: 0 24px;
    height: 48px;
    line-height: 48px;
    background: #faaf2d;
    color: black;
    border-radius: 12px;
    margin: 0 6px;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: #fcd34d;
    transform: translateY(-1px);
}


/* === ФИНАЛЬНЫЕ ПРАВИЛА (добавь в конец файла) === */

/* Скрываем десктопное меню на мобильных */
@media (max-width: 768px) {
    .left-categories,
    .header-right .top-categories {
        display: none !important;
    }
    
    .burger-btn {
        display: flex !important;
    }
}

/* Строго вертикальные карточки */
.photo-container {
    height: auto !important;
    aspect-ratio: 4 / 5 !important;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    .photo-container {
        max-height: 420px !important;
    }
}

/* === ФИНАЛЬНЫЕ ПРАВИЛА (добавь в конец файла) === */

/* Скрываем десктопное меню на мобильных */
@media (max-width: 768px) {
    .left-categories,
    .header-right .top-categories {
        display: none !important;
    }
    
    .burger-btn {
        display: flex !important;
    }
}

/* Строго вертикальные карточки */
.photo-container {
    height: auto !important;
    aspect-ratio: 4 / 5 !important;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    .photo-container {
        max-height: 420px !important;
    }
}
/* === Исправление высоты хедера и иконок на мобильном === */

/* Соцсети в ряд */
.social-icons-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Уменьшаем высоту хедера на телефоне */
@media (max-width: 768px) {
    header {
        padding: 12px 16px !important;
    }

    .logo {
        height: 58px !important;
    }

    .header-right {
        gap: 12px !important;
    }

    .mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 20px;                    /* как gap-x-5 в home.html */
    }

    .social-icon {
        font-size: 22px !important;   /* точно как text-[22px] */
        width: auto !important;
        height: auto !important;
    }

    .burger-btn {
        width: 40px !important;       /* w-10 */
        height: 40px !important;      /* h-10 */
        font-size: 20px !important;   /* text-xl */
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* === Infinite Scroll Skeleton === */
.skeleton-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-photo {
    height: 280px;
    width: 100%;
}

.skeleton-line {
    height: 14px;
    margin: 10px 16px;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

.load-more-btn {
    display: block;
    margin: 30px auto;
    padding: 14px 32px;
    background: #111;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #222;
    transform: translateY(-1px);
}

.infinite-scroll-container {
    position: relative;
}

.htmx-indicator {
    margin-top: 20px;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

/* === Infinite Scroll - финальная версия === */
.infinite-scroll-trigger {
    display: block;
    height: 20px;
    margin-top: -20px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.infinite-scroll-fullwidth {
    grid-column: 1 / -1;
    width: 100%;
}

/* Кнопка fallback */
.load-more-btn {
    display: none;
    width: 100%;
    max-width: 220px;
    margin: 30px auto 10px;
    padding: 14px 32px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
}

.load-more-btn:hover {
    background: #222;
}

/* Skeleton показывается только при загрузке */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
    display: block;
}

/* === Slider  === */
.comparison-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.comparison-slider img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.before-img { z-index: 2; }
.after-img  { z-index: 1; }

.divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: #ffffff;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    cursor: ew-resize;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.handle {
    width: 42px;
    height: 42px;
    background: #111;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* === Видео-карточки === */
.video-card {
    background: white;
    border: 1px solid #eee;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.video-container {
    background: #f1f1f1;
    border-radius: 20px 20px 0 0;
}

.instruction-header {
    color: #333;
}

.instruction-header:hover {
    color: black;
}

.prompt-description {
    background: #f8f9fa !important;
    color: #333 !important;
    border: 1px solid #eee !important;
}

.references {
    padding: 12px 16px;
    border-top: 1px solid #eee;
}

.references-title {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.references-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
}

.references-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #444;
}