/* ========================================
   Packages Pages Styles (Plugins + Themes)
   ======================================== */

.plugins-page,
.themes-page {
    background: transparent;
}

// Відступи між секціями
.plugins-stats-section,
.themes-stats-section {
    margin-bottom: 2rem;
}

.plugins-list-section,
.themes-list-section {
    margin-bottom: 0;

    .card {
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .card-body {
        padding: 0;
    }
}

.plugins-info-section,
.themes-info-section {
    margin-bottom: 0;
}

// Списки
.plugins-list,
.themes-list {
    padding: 0;

    .row {
        display: flex;
        flex-wrap: wrap;
        margin-left: -12px;
        margin-right: -12px;

        > [class*="col-"] {
            padding-left: 12px;
            padding-right: 12px;
        }
    }

    .plugin-item,
    .theme-item {
        display: flex;
        flex-direction: column;
        margin-bottom: 16px;

        &:last-child {
            margin-bottom: 0;
        }
    }
}

// Карточка (общий дизайн)
.plugin-card,
.theme-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: border-color 0.2s ease;
    position: relative;
    overflow: hidden;

    &:last-child {
        margin-bottom: 0;
    }

    &:hover {
        border-color: #d1d5db;
    }
}

.plugin-header-section,
.theme-header-section {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-shrink: 0;
    box-sizing: border-box;
}

// Preview
.plugin-preview-section,
.theme-preview-section {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    overflow: hidden;
    box-sizing: border-box;

    &.is-placeholder {
        padding: 20px;
        background: #f1f5f9;
    }
}

.plugin-preview-img,
.theme-preview-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;

    .plugin-preview-section.is-placeholder &,
    .theme-preview-section.is-placeholder & {
        object-fit: contain;
        max-width: 80px;
        max-height: 80px;
        width: auto;
        height: auto;
        opacity: 0.7;
    }
}

.plugin-preview-icon,
.theme-preview-icon {
    font-size: 3rem;
    color: #94a3b8;
    opacity: 0.6;
}

.plugin-description-section,
.theme-description-section {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-grow: 1;
    box-sizing: border-box;
}

.plugin-footer-section,
.theme-footer-section {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-height: 0;
    box-sizing: border-box;

    .plugin-meta,
    .theme-meta {
        flex: 0 0 auto;
        min-width: 0;
    }

    .plugin-actions,
    .theme-actions {
        flex: 0 0 auto;
    }
}

.plugin-name,
.theme-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.plugin-version-top,
.theme-version-top {
    font-size: 0.8125rem;
    color: #9ca3af;
    font-weight: 400;
    white-space: nowrap;
    flex-shrink: 0;
}

.plugin-description,
.theme-description {
    color: #6b7280;
    font-size: 0.8125rem;
    margin: 0;
    line-height: 1.5;
    min-height: 36px;
}

.plugin-meta,
.theme-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.plugin-author-link,
.theme-author-link {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;

    &:hover {
        color: #2563eb;
        text-decoration: underline;
    }
}

.plugin-author-text,
.theme-author-text {
    color: #94a3b8;
    font-weight: 500;
}

.plugin-actions,
.theme-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;

    .btn {
        border-radius: 4px;
        border: 1px solid transparent;
        padding: 6px 12px;
        font-weight: 500;
        font-size: 0.8125rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        white-space: nowrap;
        min-height: 32px;
        box-sizing: border-box;
        transition: background-color 0.2s ease, border-color 0.2s ease;
        line-height: 1.4;
        cursor: pointer;

        .btn-icon {
            display: inline-flex;
            align-items: center;
            line-height: 1;
            font-size: 0.875rem;
        }

        .btn-text {
            display: inline;
        }

        &.btn-primary {
            background: #3b82f6;
            border-color: #3b82f6;
            color: #ffffff;

            &:hover:not(:disabled) {
                background: #2563eb;
                border-color: #2563eb;
            }
        }

        &.btn-success {
            background: #22c55e;
            border-color: #22c55e;
            color: #ffffff;

            &:hover:not(:disabled) {
                background: #16a34a;
                border-color: #16a34a;
            }
        }

        &.btn-warning {
            background: #eab308;
            border-color: #eab308;
            color: #ffffff;

            &:hover:not(:disabled) {
                background: #ca8a04;
                border-color: #ca8a04;
            }
        }

        &.btn-danger {
            background: #dc2626;
            border-color: #dc2626;
            color: #ffffff;
            padding: 0;
            width: 32px;
            height: 32px;
            min-width: 32px;
            min-height: 32px;
            border-radius: 4px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            position: relative;

            .btn-icon {
                margin: 0;
                padding: 0;
                line-height: 1;
                display: flex;
                align-items: center;
                justify-content: center;
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
            }

            .btn-text {
                display: none;
            }

            &:hover:not(:disabled) {
                background: #b91c1c;
                border-color: #b91c1c;
            }

            &:disabled {
                opacity: 0.4;
                cursor: not-allowed;
                background: #f1f5f9;
                border-color: #e2e8f0;
                color: #94a3b8;
            }
        }

        &.btn-secondary {
            background: #f8fafc;
            border-color: #e2e8f0;
            color: #475569;
            padding: 6px 10px;
            min-width: 32px;

            &:hover:not(:disabled) {
                background: #f1f5f9;
                border-color: #cbd5e1;
                color: #334155;
            }
        }
    }
}

// Адаптивність для мобільних
@media (max-width: 767.98px) {
    .plugins-list-section,
    .themes-list-section {
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0 1rem;
        width: calc(100% + 2rem);
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;

        .card {
            background: transparent;
            border: none;
            box-shadow: none;
        }

        .card-body {
            padding: 0;
        }
    }

    .plugins-list,
    .themes-list {
        .row {
            margin-left: 0;
            margin-right: 0;

            > [class*="col-"] {
                padding-left: 0;
                padding-right: 0;
            }
        }
    }

    .plugin-card,
    .theme-card {
        margin-bottom: 12px;
    }

    .plugin-actions,
    .theme-actions {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        justify-content: flex-end;

        .btn {
            width: auto;
            padding: 8px 12px;
            min-width: 36px;
            justify-content: center;

            .btn-text {
                display: none;
            }

            .btn-icon {
                margin: 0;
            }
        }
    }
}

// На планшетах та середніх екранах приховуємо текст, залишаємо тільки іконки
@media (min-width: 768px) and (max-width: 1399.98px) {
    .plugin-actions .btn,
    .theme-actions .btn {
        .btn-text {
            display: none;
        }

        .btn-icon {
            margin: 0;
        }
    }
}

// На великих ПК показуємо іконки та текст
@media (min-width: 1400px) {
    .plugin-actions .btn,
    .theme-actions .btn {
        .btn-text {
            display: inline;
        }
    }
}
