/* ============================================================
   Frontend Styles — WP App Store
   Compatible with Zibi Theme (Bootstrap-based, .container)
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
    --wpas-primary:        #4a90d9;
    --wpas-primary-hover:  #357abd;
    --wpas-primary-light:  rgba(74, 144, 217, 0.08);
    --wpas-success:        #52c41a;
    --wpas-success-hover:  #45a814;
    --wpas-bg:             #f5f7fa;
    --wpas-card-bg:        #ffffff;
    --wpas-text:           #333333;
    --wpas-text-light:     #666666;
    --wpas-border:         #e8e8e8;
    --wpas-shadow:         0 2px 8px rgba(0, 0, 0, 0.08);
    --wpas-shadow-hover:   0 6px 20px rgba(0, 0, 0, 0.12);
    --wpas-radius:         8px;
    --wpas-radius-lg:      12px;
    --wpas-transition:     all 0.3s ease;
}

/* ── Main Container ── */
.wp-app-store {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* ── Page Header ── */
.wpas-page-header {
    margin-bottom: 30px;
    text-align: center;
}

.wpas-page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--wpas-text);
    margin: 0 0 10px;
    line-height: 1.3;
}

.wpas-page-desc {
    color: var(--wpas-text-light);
    font-size: 16px;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

/* ── Category Tabs ── */
.wpas-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
    padding: 16px 20px;
    background: var(--wpas-card-bg);
    border-radius: var(--wpas-radius-lg);
    box-shadow: var(--wpas-shadow);
    align-items: center;
}

.wpas-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 22px;
    border: 1px solid var(--wpas-border);
    border-radius: 50px;
    background: transparent;
    color: var(--wpas-text-light);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: var(--wpas-transition);
    white-space: nowrap;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.wpas-tab:hover {
    border-color: var(--wpas-primary);
    color: var(--wpas-primary);
    background: var(--wpas-primary-light);
}

.wpas-tab.active {
    background: var(--wpas-primary);
    color: #ffffff;
    border-color: var(--wpas-primary);
    box-shadow: 0 2px 6px rgba(74, 144, 217, 0.35);
}

/* ── App Grid ── */
.wpas-app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    transition: opacity 0.3s ease;
}

.wpas-app-grid.wpas-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ── App Card ── */
.wpas-app-card {
    background: var(--wpas-card-bg);
    border-radius: var(--wpas-radius);
    box-shadow: var(--wpas-shadow);
    transition: var(--wpas-transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.wpas-app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--wpas-shadow-hover);
}

.wpas-card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
    padding: 20px 20px 12px;
}

.wpas-card-link:focus {
    outline: 2px solid var(--wpas-primary);
    outline-offset: -2px;
    border-radius: var(--wpas-radius);
}

.wpas-card-thumb {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    border-radius: var(--wpas-radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wpas-bg);
    flex-shrink: 0;
}

.wpas-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--wpas-radius);
}

.wpas-default-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wpas-primary);
}

.wpas-default-thumb .dashicons {
    font-size: 40px;
    width: 40px;
    height: 40px;
}

.wpas-card-info {
    flex: 1;
    text-align: center;
}

.wpas-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--wpas-text);
    margin: 0 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wpas-card-excerpt {
    font-size: 13px;
    color: var(--wpas-text-light);
    margin: 0 0 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 39px;
}

.wpas-card-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--wpas-text-light);
}

.wpas-card-version,
.wpas-card-size {
    background: var(--wpas-bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.wpas-card-action {
    padding: 0 20px 20px;
    text-align: center;
}

.wpas-card-download-btn {
    display: inline-block;
    padding: 8px 28px;
    background: var(--wpas-success);
    color: #ffffff !important;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--wpas-transition);
    border: none;
    cursor: pointer;
    line-height: 1.4;
}

.wpas-card-download-btn:hover {
    background: var(--wpas-success-hover);
    color: #ffffff !important;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(82, 196, 26, 0.35);
}

/* ── No Apps ── */
.wpas-no-apps {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--wpas-text-light);
    font-size: 16px;
}

/* ── Pagination ── */
.wpas-pagination {
    margin-top: 30px;
    text-align: center;
    padding: 10px 0;
}

.wpas-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    margin: 0 3px;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--wpas-card-bg);
    color: var(--wpas-text);
    text-decoration: none;
    font-size: 14px;
    transition: var(--wpas-transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--wpas-border);
}

.wpas-pagination .page-numbers:hover {
    background: var(--wpas-primary);
    color: #ffffff;
    border-color: var(--wpas-primary);
}

.wpas-pagination .page-numbers.current {
    background: var(--wpas-primary);
    color: #ffffff;
    border-color: var(--wpas-primary);
    box-shadow: 0 2px 6px rgba(74, 144, 217, 0.35);
}

.wpas-pagination .page-numbers.dots {
    background: transparent;
    box-shadow: none;
    border: none;
    cursor: default;
}

.wpas-pagination .page-numbers.dots:hover {
    background: transparent;
    color: var(--wpas-text);
    border: none;
}

/* ============================================================
   App Detail Page
   ============================================================ */

.wpas-app-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 0;
}

/* ── Detail Header ── */
.wpas-detail-header {
    display: flex;
    gap: 30px;
    background: var(--wpas-card-bg);
    border-radius: var(--wpas-radius-lg);
    padding: 30px;
    box-shadow: var(--wpas-shadow);
    margin-bottom: 30px;
    align-items: flex-start;
}

.wpas-detail-icon {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: var(--wpas-radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wpas-bg);
}

.wpas-detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--wpas-radius-lg);
}

.wpas-default-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--wpas-primary);
}

.wpas-default-icon .dashicons {
    font-size: 60px;
    width: 60px;
    height: 60px;
}

.wpas-detail-info {
    flex: 1;
    min-width: 0;
}

.wpas-detail-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wpas-text);
    margin: 0 0 15px;
    line-height: 1.3;
}

.wpas-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.wpas-meta-item {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    color: var(--wpas-text-light);
    gap: 4px;
}

.wpas-meta-label {
    font-weight: 600;
    color: var(--wpas-text);
}

.wpas-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 36px;
    background: var(--wpas-success);
    color: #ffffff !important;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--wpas-transition);
    line-height: 1.4;
}

.wpas-download-btn:hover {
    background: var(--wpas-success-hover);
    color: #ffffff !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(82, 196, 26, 0.35);
}

.wpas-no-download {
    display: inline-block;
    padding: 10px 24px;
    background: #f0f0f0;
    color: #999;
    border-radius: 50px;
    font-size: 14px;
}

/* ── Download Section ── */
.wpas-detail-downloads {
    background: var(--wpas-card-bg);
    border-radius: var(--wpas-radius-lg);
    padding: 30px;
    box-shadow: var(--wpas-shadow);
    margin-bottom: 30px;
}

.wpas-download-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.wpas-download-list .wpas-dl-primary {
    background: var(--wpas-success);
}

.wpas-download-list .wpas-dl-primary:hover {
    background: var(--wpas-success-hover);
    box-shadow: 0 4px 12px rgba(82, 196, 26, 0.35);
}

/* Cloud drive download button */
.wpas-download-list .wpas-dl-cloud {
    background: var(--wpas-cloud-color, #4a90d9);
    padding-left: 20px;
}

.wpas-download-list .wpas-dl-cloud:hover {
    filter: brightness(0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.wpas-cloud-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Card: multi-channel download badge */
.wpas-card-multidl {
    background: var(--wpas-primary) !important;
}

.wpas-card-multidl:hover {
    filter: brightness(0.9);
    box-shadow: 0 3px 10px rgba(74, 144, 217, 0.35) !important;
}

/* ── Detail Content ── */
.wpas-detail-content {
    background: var(--wpas-card-bg);
    border-radius: var(--wpas-radius-lg);
    padding: 30px;
    box-shadow: var(--wpas-shadow);
    margin-bottom: 30px;
}

.wpas-detail-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--wpas-text);
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--wpas-border);
}

.wpas-detail-description {
    line-height: 1.8;
    color: var(--wpas-text);
    font-size: 15px;
}

.wpas-detail-description img {
    max-width: 100%;
    height: auto;
    border-radius: var(--wpas-radius);
}

.wpas-detail-description p {
    margin-bottom: 16px;
}

.wpas-detail-description h1,
.wpas-detail-description h2,
.wpas-detail-description h3,
.wpas-detail-description h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--wpas-text);
}

.wpas-detail-description ul,
.wpas-detail-description ol {
    margin-bottom: 16px;
    padding-left: 20px;
}

/* ── Back Link ── */
.wpas-detail-back {
    text-align: center;
    padding: 10px 0 30px;
}

.wpas-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--wpas-primary);
    text-decoration: none;
    font-size: 15px;
    transition: var(--wpas-transition);
    padding: 6px 12px;
    border-radius: 6px;
}

.wpas-back-btn:hover {
    color: var(--wpas-primary-hover);
    background: var(--wpas-primary-light);
}

/* ============================================================
   Shortcode Mode
   ============================================================ */

.wpas-shortcode .wpas-app-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* ============================================================
   Loading Spinner
   ============================================================ */

.wpas-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--wpas-border);
    border-top-color: var(--wpas-primary);
    border-radius: 50%;
    animation: wpas-spin 0.6s linear infinite;
}

@keyframes wpas-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   Responsive Design
   ============================================================ */

/* ── Tablet (1024px and below) ── */
@media (max-width: 1024px) {
    .wpas-app-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .wpas-shortcode .wpas-app-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Small Tablet (768px and below) ── */
@media (max-width: 768px) {
    .wpas-app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .wpas-shortcode .wpas-app-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wpas-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .wpas-detail-meta {
        justify-content: center;
    }

    .wpas-download-list {
        justify-content: center;
    }

    .wpas-category-tabs {
        justify-content: center;
    }

    .wpas-page-title {
        font-size: 24px;
    }

    .wpas-detail-title {
        font-size: 20px;
    }
}

/* ── Mobile (480px and below) ── */
@media (max-width: 480px) {
    .wp-app-store {
        padding: 10px 0;
    }

    .wpas-app-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .wpas-card-link {
        padding: 14px 14px 10px;
    }

    .wpas-card-thumb {
        width: 56px;
        height: 56px;
        margin-bottom: 10px;
    }

    .wpas-default-thumb .dashicons {
        font-size: 28px;
        width: 28px;
        height: 28px;
    }

    .wpas-card-title {
        font-size: 13px;
    }

    .wpas-card-excerpt {
        font-size: 12px;
        -webkit-line-clamp: 1;
        min-height: 18px;
    }

    .wpas-card-meta {
        gap: 4px;
    }

    .wpas-card-version,
    .wpas-card-size {
        font-size: 11px;
        padding: 1px 6px;
    }

    .wpas-card-download-btn {
        padding: 7px 18px;
        font-size: 12px;
    }

    .wpas-tab {
        padding: 7px 16px;
        font-size: 13px;
    }

    .wpas-category-tabs {
        padding: 12px 14px;
        gap: 6px;
    }

    .wpas-page-title {
        font-size: 20px;
    }

    .wpas-page-desc {
        font-size: 14px;
    }

    .wpas-detail-header {
        padding: 20px;
    }

    .wpas-detail-icon {
        width: 80px;
        height: 80px;
    }

    .wpas-default-icon .dashicons {
        font-size: 40px;
        width: 40px;
        height: 40px;
    }

    .wpas-detail-title {
        font-size: 18px;
    }

    .wpas-detail-meta {
        gap: 10px;
        font-size: 13px;
    }

    .wpas-download-btn {
        padding: 10px 28px;
        font-size: 14px;
    }

    .wpas-download-list {
        gap: 8px;
    }

    .wpas-download-list .wpas-dl-cloud {
        padding: 10px 20px;
        font-size: 14px;
    }

    .wpas-detail-content {
        padding: 20px;
    }

    .wpas-detail-section-title {
        font-size: 16px;
    }

    .wpas-detail-description {
        font-size: 14px;
    }

    .wpas-pagination .page-numbers {
        min-width: 34px;
        height: 34px;
        font-size: 13px;
    }
}
