/**
 * DiveWP Plugins Management Styles
 * 
 * Styling for the Plugins Management feature.
 * 
 * @package DiveWP
 * @version 1.0.0
 */

.divewp-plugins-management-dashboard {
    /* No max-width here, use global container width */
}

.divewp-plugins-intro {
    margin-bottom: 24px;
    font-size: 15px;
    color: #4a5568;
    line-height: 1.6;
}

/* Plugins Grid */
.divewp-plugins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.divewp-plugin-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.divewp-plugin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Plugin cards: compact spacing (plugin management only) */
.divewp-plugins-management-dashboard .divewp-plugin-card.recommendation-card {
    min-height: 260px;
    padding: 16px;
}

.divewp-plugins-management-dashboard .divewp-plugin-card .recommendation-top {
    margin-bottom: 12px;
}

.divewp-plugins-management-dashboard .divewp-plugin-card .recommendation-bottom {
    margin-top: 12px;
    padding-top: 12px;
}

.divewp-plugins-management-dashboard .divewp-plugin-card .recommendation-content p {
    margin-bottom: 8px;
}

.divewp-plugins-management-dashboard .divewp-plugin-meta {
    margin-top: 8px;
}

.divewp-plugin-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.divewp-plugin-version {
    font-size: 12px;
    color: #64748b;
}

.divewp-plugin-author {
    font-size: 12px;
    color: #8c8f94;
}

.divewp-plugin-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Plugin logos (wp.org CDN) — card and drawer */
.divewp-plugin-logo {
    display: block;
    object-fit: contain;
    border-radius: 6px;
    background: #f1f5f9;
}

.divewp-plugin-logo--card {
    width: 24px;
    height: 24px;
}

.divewp-plugins-management-dashboard .divewp-plugin-card .recommendation-icon .divewp-plugin-logo--card {
    width: 24px;
    height: 24px;
}

.divewp-plugin-logo--drawer {
    width: 48px;
    height: 48px;
}

.divewp-plugin-details__icon .divewp-plugin-logo--drawer {
    width: 48px;
    height: 48px;
}

.divewp-plugins-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: #646970;
    text-align: center;
}

.divewp-plugins-empty .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Drawer Modal Styles - Same as Cron but with plugins prefix */
.divewp-plugins-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s;
}

.divewp-plugins-drawer.open {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.3s;
}

.divewp-plugins-drawer__overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.divewp-plugins-drawer__panel {
    position: relative;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-width: 600px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: divewp-modal-fadein 0.3s ease-out;
}

@keyframes divewp-modal-fadein {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.divewp-plugins-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.divewp-plugins-drawer__title {
    margin: 0;
    font-family: 'Literata', serif;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.divewp-plugins-drawer__tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
    overflow-x: auto;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.divewp-plugins-drawer__tab {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.divewp-plugins-drawer__tab:hover {
    color: #1e293b;
}

.divewp-plugins-drawer__tab--active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.divewp-plugins-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    cursor: pointer;
    color: #646970;
    transition: all 0.2s;
}

.divewp-plugins-drawer__close:hover {
    background: #f0f0f1;
    color: #d63638;
    border-color: #d63638;
}

.divewp-plugins-drawer__content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.divewp-plugins-drawer__footer {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
}

.divewp-plugins-drawer__action {
    border-radius: 6px;
    padding: 8px 16px;
    height: auto;
    min-height: 32px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.divewp-plugins-drawer__action .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.divewp-plugins-drawer__update {
    background-color: #3b82f6;
    color: #fff;
    border: 1px solid #3b82f6;
}

.divewp-plugins-drawer__update:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

.divewp-plugins-drawer__update.button-success {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.divewp-plugins-drawer__update.button-danger {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

/* Plugin Details Content */
.divewp-plugin-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.divewp-plugin-details__header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.divewp-plugin-details__icon {
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    flex-shrink: 0;
}

.divewp-plugin-details__icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.divewp-plugin-details__name {
    font-family: 'Literata', serif;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px;
}

.divewp-plugin-details__author {
    font-size: 13px;
    color: #64748b;
}

.divewp-plugin-details__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.divewp-plugin-details__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.divewp-plugin-details__item-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.divewp-plugin-details__item-value {
    font-size: 13px;
    color: #1e293b;
}

.divewp-plugin-details__description {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #4a5568;
}

.divewp-plugin-details__link {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
}

.divewp-plugin-details__link:hover {
    text-decoration: underline;
}

/* Status Badges */
.divewp-plugin-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.divewp-plugin-status--active {
    background: #dcfce7;
    color: #166534;
}

.divewp-plugin-status--inactive {
    background: #fee2e2;
    color: #991b1b;
}

.divewp-plugin-status--update {
    background: #fee2e2;
    color: #991b1b;
}

/* WP.org Content Sections */
.divewp-plugin-wporg-description {
    font-size: 13px;
    line-height: 1.8;
    color: #4a5568;
}

.divewp-plugin-wporg-description p {
    margin: 0 0 12px;
}

.divewp-plugin-wporg-changelog {
    font-size: 13px;
    line-height: 1.8;
    color: #4a5568;
}

.divewp-plugin-wporg-changelog ul,
.divewp-plugin-wporg-changelog ol {
    margin: 0 0 12px;
    padding-left: 24px;
}

.divewp-plugin-wporg-changelog li {
    margin-bottom: 8px;
}

.divewp-plugin-wporg-changelog h3,
.divewp-plugin-wporg-changelog h4 {
    font-family: 'Literata', serif;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin: 16px 0 8px;
}

/* =========================================================================
   Versions / Rollback Tab
   ========================================================================= */

/* Loading state */
.divewp-versions-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
    color: #64748b;
    font-size: 13px;
}

.divewp-versions-loading .spinner {
    float: none;
    margin: 0;
}

/* Unavailable state */
.divewp-versions-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    text-align: center;
    color: #64748b;
}

.divewp-versions-unavailable .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.divewp-versions-unavailable p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

/* Versions container */
.divewp-versions-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.divewp-versions-rollback-notice {
    margin: 0 0 4px;
    font-size: 12px;
    color: #646970;
    line-height: 1.4;
}

/* Installed version header */
.divewp-versions-installed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
}

.divewp-versions-installed__label {
    font-size: 12px;
    font-weight: 600;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.divewp-versions-installed__value {
    font-size: 14px;
    font-weight: 600;
    color: #166534;
}

/* Versions list */
.divewp-versions-list {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.divewp-version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.15s ease;
}

.divewp-version-item:last-child {
    border-bottom: none;
}

.divewp-version-item:hover {
    background: #f8fafc;
}

.divewp-version-item--hidden {
    display: none;
}

.divewp-version-item--current {
    background: #f0fdf4;
}

.divewp-version-item--current:hover {
    background: #f0fdf4;
}

.divewp-version-item__label {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
}

.divewp-version-item__badge {
    font-size: 11px;
    font-weight: 600;
    color: #166534;
    background: #dcfce7;
    padding: 3px 10px;
    border-radius: 12px;
}

.divewp-version-item__install {
    font-size: 12px;
    font-weight: 500;
    color: #2563eb;
    background: transparent;
    border: 1px solid #2563eb;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.divewp-version-item__install:hover {
    background: #2563eb;
    color: #fff;
}

/* Load more button */
.divewp-versions-load-more {
    display: block;
    width: 100%;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.divewp-versions-load-more:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* Rollback confirmation */
.divewp-rollback-confirm {
    margin-top: 4px;
}

/* Rollback warning box */
.divewp-rollback-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 8px;
    margin-bottom: 12px;
}

.divewp-rollback-warning .dashicons {
    color: #a16207;
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.divewp-rollback-warning p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #854d0e;
}

/* Rollback options (reactivation checkbox) */
.divewp-rollback-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.divewp-rollback-reactivate {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.divewp-rollback-reactivate__checkbox {
    margin: 0;
}

.divewp-rollback-reactivate__label {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
}

.divewp-rollback-reactivate__hint {
    font-size: 12px;
    color: #64748b;
    padding-left: 24px;
    line-height: 1.4;
}

/* Rollback action buttons */
.divewp-rollback-actions {
    display: flex;
    gap: 8px;
}

.divewp-rollback-execute {
    min-width: 140px;
}

/* Rollback result */
.divewp-rollback-result {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
}

.divewp-rollback-result .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.divewp-rollback-result p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

.divewp-rollback-result--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.divewp-rollback-result--success .dashicons {
    color: #166534;
}

.divewp-rollback-result--success p {
    color: #166534;
}

.divewp-rollback-result--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.divewp-rollback-result--error .dashicons {
    color: #991b1b;
}

.divewp-rollback-result--error p {
    color: #991b1b;
}

.divewp-rollback-warnings {
    margin: 8px 0 0;
    padding-left: 20px;
    font-size: 12px;
    color: #a16207;
}

.divewp-rollback-warnings li {
    margin-bottom: 4px;
}

/* =========================================================================
   Rating Summary — cards + modal overview
   ========================================================================= */

.divewp-rating-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    min-height: 18px;
}

.divewp-rating-summary--loading {
    opacity: 0.4;
}

.divewp-rating-summary__placeholder {
    display: block;
    width: 100px;
    height: 14px;
    background: #e2e8f0;
    border-radius: 4px;
    animation: divewp-pulse 1.5s ease-in-out infinite;
}

@keyframes divewp-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* Stars row */
.divewp-rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    line-height: 1;
}

.divewp-star {
    font-size: 20px;
    line-height: 1;
}

.divewp-star--full {
    opacity: 1;
}

.divewp-star--half {
    opacity: 0.6;
}

.divewp-star--empty {
    opacity: 0.25;
}

/* Tier colors */
.divewp-rating--green .divewp-star {
    color: #16a34a;
}

.divewp-rating--blue .divewp-star {
    color: #2563eb;
}

.divewp-rating--orange .divewp-star {
    color: #d97706;
}

.divewp-rating--red .divewp-star {
    color: #dc2626;
}

/* Rating text */
.divewp-rating-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    color: #64748b;
    line-height: 1;
}

.divewp-rating-avg {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.divewp-rating-count {
    font-weight: 400;
}

/* Rating in overview tab */
.divewp-plugin-details__rating {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.divewp-plugin-details__rating .divewp-rating-stars {
    gap: 2px;
}

.divewp-plugin-details__rating .divewp-star {
    font-size: 20px;
}

.divewp-plugin-details__rating .divewp-rating-text {
    font-size: 18px;
}

/* =========================================================================
   Reviews Tab
   ========================================================================= */

.divewp-reviews-tab {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.divewp-reviews-tab__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.divewp-reviews-tab__summary .divewp-rating-stars {
    gap: 2px;
}

.divewp-reviews-tab__summary .divewp-star {
    font-size: 20px;
}

.divewp-reviews-tab__summary .divewp-rating-text {
    font-size: 18px;
}

.divewp-reviews-tab__summary .divewp-rating-avg {
    font-size: 18px;
}

/* wp.org reviews HTML wrapper */
.divewp-plugin-wporg-reviews {
    font-size: 13px;
    line-height: 1.7;
    color: #4a5568;
}

.divewp-plugin-wporg-reviews h4 {
    font-family: 'Literata', serif;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px;
}

.divewp-plugin-wporg-reviews p {
    margin: 0 0 16px;
}

.divewp-plugin-wporg-reviews a {
    color: #2563eb;
    text-decoration: none;
}

.divewp-plugin-wporg-reviews a:hover {
    text-decoration: underline;
}

/* Individual review blocks from wp.org HTML */
.divewp-plugin-wporg-reviews > div {
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.divewp-plugin-wporg-reviews > div:last-child {
    border-bottom: none;
}

/* View all reviews link */
.divewp-reviews-tab__link {
    text-align: center;
    padding: 12px 0;
}

.divewp-reviews-tab__link a {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid #2563eb;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.divewp-reviews-tab__link a:hover {
    background: #2563eb;
    color: #fff;
}

/* Responsive */
@media (max-width: 782px) {
    .divewp-plugins-grid {
        grid-template-columns: 1fr;
    }

    .divewp-plugins-drawer__panel {
        width: 100%;
    }

    .divewp-plugin-details__grid {
        grid-template-columns: 1fr;
    }

    .divewp-rollback-actions {
        flex-direction: column;
    }

    .divewp-rollback-execute {
        width: 100%;
    }

    .divewp-version-item__install {
        font-size: 11px;
        padding: 3px 8px;
    }

    .divewp-reviews-tab__summary .divewp-star {
        font-size: 20px;
    }

    .divewp-reviews-tab__summary .divewp-rating-text {
        font-size: 18px;
    }
}
