/* ===== App Detail Page Styles ===== */
/* Migrated from product.css for apps.html decoupling */

/* ===== Skeleton System ===== */
#app-detail-skeleton {
    position: relative;
}

#app-detail-skeleton .pd-hero {
    animation: none;
}

.sk {
    background: linear-gradient(110deg,
            rgba(255, 255, 255, 0.03) 8%,
            rgba(139, 92, 246, 0.12) 38%,
            rgba(255, 255, 255, 0.03) 54%);
    background-size: 200% 100%;
    animation: sk-pulse 1.5s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
    border-radius: 8px;
    color: transparent !important;
    overflow: hidden;
}

@keyframes sk-pulse {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== Main Container ===== */
.product-detail {
    position: relative;
    padding-top: calc(var(--navbar-h) + 40px);
    padding-bottom: 60px;
    max-width: 900px;
    margin: 0 auto;
}

/* ===== Skeleton Fade-Out ===== */
.pd-skeleton-fade-out {
    animation: pdSkeletonFadeOut 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    position: absolute !important;
    width: calc(100% - 32px);
    z-index: 2;
    pointer-events: none;
}

@keyframes pdSkeletonFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
        filter: blur(8px);
    }
}

/* Staggered reveal for real content children */
#app-detail-content.pd-revealing {
    opacity: 1 !important;
}

#app-detail-content.pd-revealing>* {
    opacity: 0;
    transform: translateY(20px);
    animation: pdRevealIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#app-detail-content.pd-revealing>*:nth-child(1) {
    animation-delay: 0.05s;
}

#app-detail-content.pd-revealing>*:nth-child(2) {
    animation-delay: 0.12s;
}

#app-detail-content.pd-revealing>*:nth-child(3) {
    animation-delay: 0.19s;
}

#app-detail-content.pd-revealing>*:nth-child(4) {
    animation-delay: 0.26s;
}

#app-detail-content.pd-revealing>*:nth-child(5) {
    animation-delay: 0.33s;
}

#app-detail-content.pd-revealing>*:nth-child(6) {
    animation-delay: 0.40s;
}

#app-detail-content.pd-revealing>*:nth-child(7) {
    animation-delay: 0.47s;
}

#app-detail-content.pd-revealing>*:nth-child(8) {
    animation-delay: 0.54s;
}

@keyframes pdRevealIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== Hero Section ===== */
.pd-hero {
    position: relative;
    display: flex;
    gap: 16px;
    align-items: stretch;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    padding: 36px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    margin-bottom: 32px;
}

.pd-hero-icon {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    flex-shrink: 0;
}

.pd-hero-info {
    flex: 1;
    min-width: 0;
}

.pd-badges {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.pd-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pd-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.2;
}

.pd-desc {
    font-size: 0.92rem;
    color: rgba(240, 238, 246, 0.6);
    margin-bottom: 14px;
    line-height: 1.6;
}

.pd-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.pd-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
    text-transform: capitalize;
}

/* ===== Back Button ===== */
.pd-back-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f0eef6;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pd-back-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateX(-2px);
}

.pd-back-btn i,
.pd-back-btn svg {
    width: 20px;
    height: 20px;
}

/* ===== Buy/Download Button ===== */
.pd-buy-btn {
    width: 100%;
    min-height: 48px;
    padding: 14px 24px;
    font-size: 0.9rem;
    background: var(--gradient-primary) !important;
    border: none;
    color: #fff !important;
}

/* ===== Info Grid ===== */
.pd-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}

.pd-info-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.pd-info-card:hover {
    border-color: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.pd-info-icon {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.pd-info-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.pd-info-text {
    font-size: 0.78rem;
    color: rgba(240, 238, 246, 0.5);
    line-height: 1.5;
}

/* ===== Sections ===== */
.pd-section {
    margin-bottom: 36px;
}

.pd-section-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== Screenshots Gallery ===== */
.pd-screenshots-section {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 28px;
}

.pd-screenshots-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

.pd-screenshots-scroll::-webkit-scrollbar {
    height: 6px;
}

.pd-screenshots-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.pd-screenshots-scroll::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 100px;
}

.pd-screenshot-item {
    flex-shrink: 0;
    height: 350px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    scroll-snap-align: start;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    cursor: zoom-in;
}

.pd-screenshot-item:first-child {
    margin-left: auto;
}

.pd-screenshot-item:last-child {
    margin-right: auto;
}

.pd-screenshot-item:hover {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.25), 0 8px 24px rgba(0, 0, 0, 0.3);
}

.pd-screenshot-item img {
    height: 100%;
    width: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pd-screenshot-item:hover img {
    transform: scale(1.04);
}

/* ===== Image Lightbox ===== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: zoom-out;
    padding: 40px;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.08);
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-overlay.active .lightbox-img {
    transform: scale(1);
    opacity: 1;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    line-height: 1;
}

.lightbox-close:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.08);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .pd-hero {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        padding: 20px;
        gap: 16px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .pd-hero-icon {
        width: 64px;
        height: 64px;
        font-size: 2rem;
        border-radius: 16px;
    }

    .pd-hero-info {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .pd-meta {
        justify-content: flex-start;
        margin-bottom: 0;
    }

    .pd-buy-btn {
        width: 100%;
        min-height: 48px;
        padding: 14px 24px;
    }

    .product-detail {
        padding-bottom: 60px;
    }

    .pd-title {
        font-size: 1.35rem;
    }

    .pd-desc {
        font-size: 0.85rem;
        margin-bottom: 0;
    }

    .pd-section-title {
        font-size: 1.05rem;
        margin-bottom: 14px;
    }

    .pd-screenshots-section {
        padding: 18px;
        border-radius: 16px;
    }

    .pd-screenshot-item {
        width: auto;
        height: 250px;
    }

    .pd-screenshots-scroll {
        gap: 10px;
    }
}

/* ===== Desktop ===== */
@media (min-width: 768px) {
    .pd-hero {
        flex-direction: row;
        align-items: flex-start;
        gap: 32px;
    }

    .pd-buy-btn {
        width: auto;
    }
}