/* Assistant Cortex Marketplace Display Plugin Styles */

/* Container */
.ac-marketplace-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header */
.ac-marketplace-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--wp--preset--color--third) 0%, var(--wp--preset--color--eighth) 100%);
    border-radius: 16px;
    color: var(--wp--preset--color--fourth);
    position: relative;
    overflow: hidden;
}

.ac-marketplace-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="3" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="80" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="90" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.5;
}

.ac-marketplace-header h1 {
    font-size: 2.5rem;
    margin: 0 0 15px 0;
    position: relative;
    z-index: 1;
}

.ac-marketplace-header p {
    font-size: 1.1rem;
    margin: 0 0 25px 0;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

.ac-refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: var(--wp--preset--color--fourth);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.ac-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.ac-refresh-icon {
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.5s ease;
}

.ac-refresh-btn:hover .ac-refresh-icon {
    transform: rotate(360deg);
}

/* Section Styles */
.ac-marketplace-section {
    margin-bottom: 60px;
}

.ac-section-title {
    font-size: 2rem;
    margin: 0 0 15px 0;
    color: var(--wp--preset--color--primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ac-section-icon {
    font-size: 2.2rem;
}

.ac-section-description {
    font-size: 1.05rem;
    color: var(--wp--preset--color--fifth);
    margin-bottom: 30px;
    line-height: 1.6;
    max-width: 900px;
}

/* Filter Tabs */
.ac-filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.ac-filter-btn {
    background: var(--wp--preset--color--seventh);
    border: 2px solid var(--wp--preset--color--sixth);
    color: var(--wp--preset--color--fifth);
    padding: 10px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.ac-filter-btn:hover {
    background: var(--wp--preset--color--third);
    color: var(--wp--preset--color--fourth);
    border-color: var(--wp--preset--color--third);
}

.ac-filter-btn.active {
    background: var(--wp--preset--color--third);
    color: var(--wp--preset--color--fourth);
    border-color: var(--wp--preset--color--third);
}

/* Grid Layout */
.ac-marketplace-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

/* Card Styles */
.ac-marketplace-card {
    background: var(--wp--preset--color--fourth);
    border: 1px solid var(--wp--preset--color--sixth);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ac-marketplace-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(17, 86, 155, 0.15);
    border-color: var(--wp--preset--color--third);
}

.ac-card-image {
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ac-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ac-card-content {
    padding: 25px;
}

.ac-card-title {
    font-size: 1.4rem;
    margin: 0 0 12px 0;
    color: var(--wp--preset--color--primary);
    font-weight: 600;
}

.ac-card-description {
    font-size: 0.95rem;
    color: var(--wp--preset--color--fifth);
    line-height: 1.6;
    margin-bottom: 20px;
}

.ac-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--wp--preset--color--sixth);
}

.ac-meta-item {
    font-size: 0.85rem;
    color: var(--wp--preset--color--ninth);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ac-meta-icon {
    color: var(--wp--preset--color--third);
}

.ac-view-btn {
    background: var(--wp--preset--color--third);
    color: var(--wp--preset--color--fourth);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.ac-view-btn:hover {
    background: var(--wp--preset--color--eighth);
    transform: translateY(-2px);
}

/* Application Cards (Same size as other cards) */
.ac-application-card {
    /* No special spanning - all cards same size */
}

/* Loading State */
.ac-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--wp--preset--color--fifth);
    font-size: 1.1rem;
}

.ac-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--wp--preset--color--sixth);
    border-top-color: var(--wp--preset--color--third);
    border-radius: 50%;
    animation: ac-spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Empty State */
.ac-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--wp--preset--color--fifth);
}

.ac-empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.ac-empty-message {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

/* Install Section */
.ac-install-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--wp--preset--color--sixth);
}

.ac-install-toggle-btn {
    background: linear-gradient(135deg, var(--wp--preset--color--third) 0%, var(--wp--preset--color--eighth) 100%);
    color: var(--wp--preset--color--fourth);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.ac-install-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(17, 86, 155, 0.4);
}

.ac-install-toggle-btn.active {
    background: linear-gradient(135deg, var(--wp--preset--color--secondary) 0%, #48a999 100%);
}

.ac-install-command {
    margin-top: 15px;
    padding: 20px;
    background: var(--wp--preset--color--primary);
    border-radius: 10px;
    color: var(--wp--preset--color--sixth);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
}

.ac-install-command strong {
    color: var(--wp--preset--color--third);
    display: block;
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.ac-install-command strong:first-child {
    margin-top: 0;
}

.ac-code-block {
    background: var(--wp--preset--color--eighth);
    padding: 12px 45px 12px 15px;
    border-radius: 6px;
    margin: 8px 0;
    word-break: break-all;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    border-left: 3px solid var(--wp--preset--color--secondary);
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ac-code-block:hover {
    background: var(--wp--preset--color--tenth);
}

.ac-code-block::before {
    content: '$';
    color: var(--wp--preset--color--sixth);
    margin-right: 8px;
    font-weight: bold;
}

.ac-code-block::after {
    content: '📋';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.ac-code-block:hover::after {
    opacity: 1;
}

/* Hide the old copy button - we use toast instead */
.ac-copy-btn {
    display: none;
}

/* Toast Notification */
.ac-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, var(--wp--preset--color--secondary) 0%, #48a999 100%);
    color: var(--wp--preset--color--primary);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10001;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.ac-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.ac-toast-icon {
    font-size: 1.2rem;
}

.ac-toast-message {
    font-weight: 500;
}

/* Description Truncation & Modal */
.ac-card-description {
    position: relative;
}

.ac-desc-preview {
    display: block;
}

.ac-desc-full-text {
    display: none;
}

.ac-full-description-seo {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ac-view-full-btn {
    background: var(--wp--preset--color--third);
    color: var(--wp--preset--color--fourth);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.ac-view-full-btn:hover {
    background: var(--wp--preset--color--eighth);
    transform: translateY(-2px);
}

/* Modal Styles */
.ac-full-description-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 18, 28, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ac-full-description-modal.active {
    opacity: 1;
    visibility: visible;
}

.ac-modal-content {
    background: var(--wp--preset--color--fourth);
    border-radius: 12px;
    max-width: 700px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ac-full-description-modal.active .ac-modal-content {
    transform: scale(1);
}

.ac-modal-header {
    padding: 20px 25px;
    background: var(--wp--preset--color--third);
    color: var(--wp--preset--color--fourth);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ac-modal-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.ac-modal-close {
    background: none;
    border: none;
    color: var(--wp--preset--color--fourth);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ac-modal-close:hover {
    color: var(--wp--preset--color--secondary);
    transform: rotate(90deg);
}

.ac-modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
    color: var(--wp--preset--color--fifth);
    line-height: 1.7;
}

.ac-modal-body p {
    margin-bottom: 15px;
}

.ac-modal-body p:last-child {
    margin-bottom: 0;
}

/* Animations */
@keyframes ac-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ac-marketplace-card {
    animation: ac-fade-in 0.5s ease forwards;
}

/* Responsive Design */
@media (max-width: 900px) {
    .ac-marketplace-grid {
        grid-template-columns: 1fr;
    }
    
    .ac-marketplace-header {
        padding: 30px 15px;
    }
    
    .ac-marketplace-header h1 {
        font-size: 2rem;
    }
    
    .ac-section-title {
        font-size: 1.6rem;
    }
    
    .ac-toast {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
}

/* ===================== Install cart ===================== */
.ac-cart-actions { margin-top: 14px; }

.ac-cart-install-btn {
    padding: 9px 20px;
    border-radius: 22px;
    border: 2px solid #667eea;
    background: #fff;
    color: #667eea;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
.ac-cart-install-btn:hover { background: #667eea; color: #fff; }
.ac-cart-install-btn .ac-cart-btn-added { display: none; }
.ac-cart-install-btn.selected { background: #667eea; color: #fff; }
.ac-cart-install-btn.selected .ac-cart-btn-add { display: none; }
.ac-cart-install-btn.selected .ac-cart-btn-added { display: inline; }

/* floating cart */
.ac-cart-fab {
    position: fixed;
    right: 26px;
    bottom: 26px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(102, 126, 234, 0.45);
    cursor: pointer;
    z-index: 99998;
}
.ac-cart-fab.show { display: flex; }
.ac-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    background: #e53e3e;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* dialog */
.ac-cart-dialog {
    position: fixed;
    inset: 0;
    background: rgba(7, 18, 28, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}
.ac-cart-dialog.open { display: flex; }
.ac-cart-dialog-card {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 26px 28px;
    box-shadow: 0 24px 60px rgba(7, 18, 28, 0.3);
}
.ac-cart-dialog-header { display: flex; align-items: center; justify-content: space-between; }
.ac-cart-dialog-header h3 { margin: 0; font-size: 1.3em; }
.ac-cart-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}
.ac-cart-dialog-hint { color: #666; font-size: 0.92em; margin: 10px 0 14px; }
.ac-cart-dialog .ac-cart-items { overflow-y: auto; }
.ac-cart-dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}
.ac-cart-clear {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    font-size: 0.92em;
    padding: 8px 0;
}
.ac-cart-continue {
    padding: 10px 22px;
    border-radius: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
}

/* selection rows (dialog + inline list) */
.ac-cart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(7, 18, 28, 0.08);
}
.ac-cart-row-type {
    flex-shrink: 0;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 12px;
    background: #ebf4ff;
    color: #2b6cb0;
}
.ac-cart-type-ai_ability { background: #e6fffa; color: #2c7a7b; }
.ac-cart-type-agent { background: #faf5ff; color: #6b46c1; }
.ac-cart-row-label { flex: 1; font-weight: 600; color: #2d3748; }
.ac-cart-remove {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}
.ac-cart-remove:hover { color: #e53e3e; }
.ac-cart-empty { color: #666; font-size: 0.95em; padding: 8px 0; }

/* install bar on marketing pages */
.ac-install-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 22px;
    /* the theme's constrained-layout rules zero child margins, so these need
       the important to actually create air around the bar; landing pages that
       zero the post-content padding otherwise leave it flush against the
       page-title band above */
    margin-top: 40px !important;
    margin-bottom: 48px !important;
    border: 1px solid rgba(102, 126, 234, 0.35);
    border-radius: 14px;
    background: rgba(102, 126, 234, 0.06);
}
.ac-install-bar-text { color: #2d3748; }

/* try-now inline selection list */
.ac-install-selected { margin-top: 20px; }
.ac-install-selected h4 { margin: 0 0 8px; }
