/* ============================================================
   Extensions Page — new design
   Colors: bg #E7EDF2 | surface #F1F4F7 | text #000 |
           secondary #696969 | cta #2171B1 | icon #234C66 |
           green #10B981 | orange #E07A2D
   ============================================================ */

/* ---------- Page wrapper ---------- */
.ext-page-wrap {
    background-color: #e7edf2;
    min-height: calc(100vh - 46px);
    margin: -10px -20px 0 -20px !important;
    padding: 32px 5% 48px 5% !important;
    box-sizing: border-box;
}

@media (max-width: 782px) {
    .ext-page-wrap { padding-right: 20px !important; padding-left: 20px !important; }
}

/* Reset WP default h1 inside wrap */
.ext-page-wrap h1.ext-page-header__title {
    margin: 0;
    padding: 0;
    border: 0;
    line-height: 1.2;
}

/* ============================================================
   Upgrade banner
   ============================================================ */
.ext-banner {
    background: linear-gradient(-167deg, #2171b1 0%, #1a5a8f 100%);
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(33, 113, 177, 0.2);
    padding: 24px;
    margin-bottom: 24px;
}

.ext-banner__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ext-banner__heading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ext-banner__heading h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
    border: 0;
    padding: 0;
}

.ext-banner__crown {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.ext-banner__close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.ext-banner__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.ext-banner__desc {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #e7edf2;
    line-height: 1.5;
    max-width: 600px;
}

.ext-banner__plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .ext-banner__plans {
        grid-template-columns: 1fr;
    }
}

.ext-banner__plan {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 20px 20px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ext-banner__plan-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
    margin-bottom: 2px;
}

.ext-banner__plan-desc {
    font-size: 12px;
    color: #e7edf2;
    line-height: 1.4;
}

.ext-banner__plan-price {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-top: 4px;
}

.ext-banner__plan-amount {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.ext-banner__plan-period {
    font-size: 12px;
    color: #e7edf2;
}

.ext-banner__plan-info {
    flex: 1;
}

.ext-banner__plan-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ext-banner__plan-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #fff;
    color: #2171b1;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 10px;
    height: 40px;
    transition: background 0.2s, color 0.2s;
}

.ext-banner__plan-btn:hover {
    background: #f1f4f7;
    color: #1a5a8f;
}

/* ============================================================
   Page header
   ============================================================ */
.ext-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ext-page-header__left {
    min-width: 0;
}

.ext-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1.5px solid #2171b1;
    background: transparent;
    color: #2171b1;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.ext-refresh-btn:hover,
.ext-refresh-btn:focus {
    background: #2171b1;
    color: #fff;
    text-decoration: none;
}

.ext-refresh-btn svg {
    flex-shrink: 0;
    transition: transform 0.4s ease;
}

.ext-refresh-btn.ext-refresh-btn--loading svg {
    animation: ext-spin 0.7s linear infinite;
}

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

/* Toast notification shown after cache is cleared */
.ext-cache-toast {
    position: fixed;
    bottom: 28px;
    right: 50%;
    transform: translateX(50%) translateY(20px);
    background: #1a1a1a;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}

.ext-cache-toast--visible {
    opacity: 1;
    transform: translateX(50%) translateY(0);
}

.ext-page-header__title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #000 !important;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    line-height: 1.5 !important;
}

.ext-page-header__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ext-page-header__subtitle {
    margin: 0;
    font-size: 14px;
    color: #696969;
    line-height: 1.5;
}

.ext-page-header__count {
    display: inline-block;
    background: #f1f4f7;
    color: #696969;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 999px;
    line-height: 1.5;
    white-space: nowrap;
}

/* ============================================================
   Filter bar
   ============================================================ */
.ext-filter-bar {
    background: #f1f4f7;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Search */
.ext-search {
    position: relative;
    flex-shrink: 0;
}

.ext-search__icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #696969;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.ext-search__input {
    width: 320px;
    height: 45px;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 44px 0 36px !important;
    font-size: 14px;
    color: #000;
    box-shadow: none;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.ext-search__input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.ext-search__input:focus {
    border-color: #2171b1;
    box-shadow: 0 0 0 3px rgba(33, 113, 177, 0.1);
}

@media (max-width: 900px) {
    .ext-search__input {
        width: 220px;
    }
}

/* Filter tabs */
.ext-filter-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ext-filter-tab {
    height: 37px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #f1f4f7;
    color: #696969;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1;
}

.ext-filter-tab:hover {
    background: #e0e7ef;
    color: #333;
}

.ext-filter-tab--active {
    background: #2171b1 !important;
    color: #fff !important;
    border-color: transparent !important;
}

/* ============================================================
   Extensions grid
   ============================================================ */
.ext-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1100px) {
    .ext-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 680px) {
    .ext-grid {
        grid-template-columns: 1fr;
    }
}

/* Hidden cards (filtered out) */
.ext-card--hidden {
    display: none !important;
}

/* ============================================================
   Extension card
   ============================================================ */
.ext-card {
    background: #f1f4f7;
    border-radius: 14px;
    border: 1px solid transparent;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.ext-card:hover {
    border-color: rgba(33, 113, 177, 0.25);
    box-shadow: 0 4px 12px rgba(33, 113, 177, 0.08);
}

/* Card top row: icon + badge */
.ext-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ext-card__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #234c66;
}

.ext-card__icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* Category badge */
.ext-card__badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #e7edf2;
    color: #234c66;
    line-height: 1.5;
    flex-shrink: 0;
}

/* Card body */
.ext-card__body {
    flex: 1;
    margin-bottom: 16px;
}

.ext-card__name {
    font-size: 15px;
    font-weight: 600;
    color: #000;
    margin: 0 0 4px 0;
    line-height: 1.5;
    padding: 0;
    border: 0;
}

.ext-card__version {
    font-size: 12px;
    color: #696969;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.ext-card__desc {
    font-size: 13px;
    color: #696969;
    line-height: 1.5;
    margin: 0;
}

/* Card footer */
.ext-card__footer {
    margin-top: auto;
}

/* Action column: primary button on top, "More details" link centered below */
.ext-card__action-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.ext-card__more-details {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #2171b1;
    text-decoration: none;
    line-height: 1.5;
    transition: color 0.15s, text-decoration 0.15s;
}

.ext-card__more-details:hover {
    color: #1a5a8f;
    text-decoration: underline;
}

.ext-card__more-details svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.ext-error {
    font-size: 12px;
    color: #c0392b;
    min-height: 0;
    margin-bottom: 4px;
}

.ext-error:empty {
    display: none;
}

/* Availability label */
.ext-card__availability {
    font-size: 12px;
    font-weight: 500;
    margin: 0 0 12px 0;
    line-height: 1.5;
    text-align: center;
}

.ext-card__availability--included {
    color: #10b981;
}

.ext-card__availability--not-included {
    color: #e07a2d;
}

/* ============================================================
   Buttons
   ============================================================ */

/* Shared */
.ext-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 45px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
    box-sizing: border-box;
    line-height: 1;
}

/* Filled navy — Purchase */
.ext-btn--filled {
    background: #2171b1;
    color: #fff;
    border: 1.5px solid #2171b1;
}

.ext-btn--filled:hover {
    background: #1a5a8f;
    border-color: #1a5a8f;
    color: #fff;
}

/* Outlined — Install / Activate / Update */
.ext-btn--outline {
    background: transparent;
    color: #2171b1;
    border: 1.5px solid #2171b1;
}

.ext-btn--outline:hover {
    background: rgba(33, 113, 177, 0.06);
    color: #1a5a8f;
    border-color: #1a5a8f;
}

/* Active status (not a button) */
.ext-btn--active {
    color: #10b981;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 45px;
    width: 100%;
    cursor: default;
}

.ext-btn--active svg {
    flex-shrink: 0;
}

/* Loading state */
.ext-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Loader icon spin */
.ext-loader-icon {
    width: 16px;
    height: 16px;
    animation: ext-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes ext-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(-360deg); }
}

/* ============================================================
   Empty state
   ============================================================ */
.ext-empty {
    color: #696969;
    font-size: 14px;
    padding: 24px 0;
}

/* ============================================================
   Keep legacy .extensions-button.blue selector working for
   the AJAX handler in the old js (now rewritten, but just in case)
   ============================================================ */
.extensions-button.blue {
    /* handled via .ext-btn--outline */
}
