/* ============================================================
   CheckMate — Public Plugin Index Page
   Styles for the [checkmate_index] shortcode
   ============================================================ */

/* ── Container ────────────────────────────────────────────── */

.cm-index {
    width: 100%;
    font-family: inherit;
    color: #ffffff;
}

/* ── Page title ───────────────────────────────────────────── */

.cm-index-title {
    font-size: 65px;
    font-weight: 700;
    color: #ffffff;
    margin: 56px 0 52px;
    line-height: 1.1;
    text-align: center;
}

/* ── Search bar ───────────────────────────────────────────── */

.cm-index-search-wrap {
    position: relative;
    margin-top: 0;
    margin-bottom: 64px;
}

/* ── Focus mode ───────────────────────────────────────────── */
/* While the dropdown is open, body.cm-index-search-active is
   set by checkmate-index.js — fade the surrounding sections
   so the search input and results hold visual focus. */

.cm-index-section {
    transition: opacity 0.2s ease;
}

body.cm-index-search-active .cm-index-section {
    opacity: 0.25;
    pointer-events: none;
}

.cm-index-search {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 1rem;
    border: 2px solid transparent;
    border-radius: 0;
    background: #404D72;
    color: #ffffff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}

.cm-index-search::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.cm-index-search:focus {
    border-color: #ffffff;
    box-shadow: none;
}

/* ── Dropdown ─────────────────────────────────────────────── */

.cm-index-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    background: #10193f;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: 400px;
    overflow-y: auto;
}

.cm-dd-section {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cm-dd-section:last-child {
    border-bottom: none;
}

.cm-dd-label {
    display: block;
    padding: 4px 12px 2px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.5);
}

.cm-dd-item {
    display: block;
    padding: 6px 12px;
    color: #ffffff;
    text-decoration: none;
    transition: background 0.1s;
}

.cm-dd-item:hover,
.cm-dd-item:focus {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: #ffffff;
    outline: none;
}

.cm-dd-item--plugin {
    cursor: pointer;
}

.cm-dd-item-name {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #ffffff;
}

.cm-dd-item-desc {
    display: block;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-dd-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cm-dd-item-header .cm-dd-item-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-dd-item-author {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-dd-item-verified {
    display: inline-flex;
    align-items: center;
    color: #1d9bf0;
}

.cm-dd-item-verified svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* ── Author row (label + pill) ────────────────────────────── */

.cm-author-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.cm-author-label {
    font-size: 0.6875rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
}

/* ── Sections ─────────────────────────────────────────────── */

.cm-index-section {
    margin-bottom: 64px;
}

.cm-index-heading {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 16px;
    color: #ffffff;
}

/* ── Category tag cloud ───────────────────────────────────── */

.cm-index-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cm-index-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #10193f;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.cm-index-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
    color: #ffffff;
    text-decoration: none;
}

.cm-index-tag-count {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    line-height: 1.5;
}

/* ── Vendor grid ──────────────────────────────────────────── */

.cm-index-vendor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.cm-index-vendor-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    color: #ffffff;
    text-decoration: none;
    text-align: center;
    transition: border-color 0.15s;
}

.cm-index-vendor-card:hover {
    border-color: #ffffff;
    color: #ffffff;
    text-decoration: none;
}

.cm-index-vendor-logo {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.cm-index-vendor-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.cm-index-vendor-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
}

.cm-index-vendor-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #ffffff;
    line-height: 1.4;
    word-break: break-word;
}

/* ── Hidden state ─────────────────────────────────────────── */
/* Browsers hide [hidden] elements natively; these rules
   ensure display:flex / display:grid don't override that. */

.cm-index-tag[hidden],
.cm-index-vendor-card[hidden] {
    display: none !important;
}

/* ── Spinner keyframes ────────────────────────────────────── */

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

/* ── Dropdown plugin search loading state ─────────────────── */

.cm-dd-loading {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.8125rem;
}

.cm-dd-loading::before {
    content: '';
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-top-color: rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    animation: cm-spin 0.65s linear infinite;
    flex-shrink: 0;
}

/* ── Modal loading spinner ────────────────────────────────── */

.cm-plugin-modal__desc--loading {
    position: relative;
    min-height: 52px;
    color: transparent !important;
}

.cm-plugin-modal__desc--loading::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 0;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    animation: cm-spin 0.7s linear infinite;
}
