/* ============================================================
   AI Prompt Vault — Front-End Shortcode Styles  v2.0

   Theme Integration Strategy
   ──────────────────────────
   All colors reference CSS custom properties that most modern
   WordPress themes (Twenty Twenty-One and later, GeneratePress,
   Astra, Kadence, Blocksy, Neve, OceanWP, Hello / Elementor, Divi)
   define on :root.  We cascade to sensible generic fallbacks so
   the plugin looks reasonable even on older themes that do not
   expose those variables.

   Common variable names used across themes:
     --color-primary / --wp--preset--color--primary
     --color-text    / --wp--preset--color--foreground
     --color-bg      / --wp--preset--color--background
     --color-border  / --wp--preset--color--contrast
     --global-font-family / --font-base

   Divi-specific (kennedy media / client sites):
     --et_headings_font / --et_body_font_family
     primary color is usually set as a class, so we pull from
     --et_primary which Divi writes when custom colors are active.

   ============================================================ */

/* ── Wrapper ── */
.apv-shortcode-wrap {
    max-width: 100%;
    padding: 0;
    font-family:
        var(--global-font-family,
        var(--et_body_font_family,
        var(--font-base,
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)));
    color:
        var(--color-text,
        var(--wp--preset--color--foreground,
        var(--global-palette9,       /* Blocksy */
        var(--text-color,            /* OceanWP */
        #1d2327))));
}

/* ── Responsive grid ── */
.apv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 8px 0 24px;
}

@media (max-width: 640px) {
    .apv-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ── Card ── */
.apv-card {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
    background:
        var(--color-bg,
        var(--wp--preset--color--background,
        var(--global-palette1,       /* Blocksy light */
        var(--body-bg,               /* OceanWP */
        #ffffff))));
    border: 1px solid
        var(--color-border,
        var(--wp--preset--color--contrast,
        var(--global-palette3,
        var(--main-border-color,
        #e0e0e0))));
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.apv-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px);
}

/* ── Card image ── */
.apv-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid
        var(--color-border,
        var(--wp--preset--color--contrast,
        #e0e0e0));
}

/* ── Card body ── */
.apv-card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Card title ── */
.apv-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
    color:
        var(--color-heading,
        var(--wp--preset--color--foreground,
        var(--global-palette9,
        var(--heading-color,
        inherit))));
    font-family:
        var(--heading-font,
        var(--et_headings_font,
        var(--global-heading-font-family,
        inherit)));
}

/* ── Category badge ── */
.apv-card-cat {
    display: inline-block;
    background:
        var(--color-primary,
        var(--wp--preset--color--primary,
        var(--et_primary,
        var(--global-palette4,   /* Blocksy */
        var(--ocean-link-color,  /* OceanWP */
        #2271b1)))));
    color: #fff;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
    align-self: flex-start;
}

/* ── Prompt block ── */
.apv-prompt-wrap {
    position: relative;
    margin-top: auto;
    padding-top: 12px;
}

.apv-prompt-text {
    background:
        var(--color-surface,
        var(--wp--preset--color--base,
        var(--global-palette2,   /* Blocksy */
        #f8f9fa)));
    border: 1px solid
        var(--color-border,
        var(--wp--preset--color--contrast,
        #e0e0e0));
    border-radius: 6px;
    padding: 12px 14px 40px; /* bottom padding = room for copy button */
    font-size: 13px;
    font-family: "Consolas", "Courier New", "Lucida Console", monospace;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    color:
        var(--color-text,
        var(--wp--preset--color--foreground,
        #1d2327));
    scrollbar-width: thin;
}

.apv-prompt-text::-webkit-scrollbar {
    height: 4px;
    width: 4px;
}
.apv-prompt-text::-webkit-scrollbar-track { background: transparent; }
.apv-prompt-text::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }

/* ── Copy button ── */
.apv-copy-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background:
        var(--color-primary,
        var(--wp--preset--color--primary,
        var(--et_primary,
        #2271b1)));
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    line-height: 1.6;
    letter-spacing: 0.02em;
}

.apv-copy-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.apv-copy-btn:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

/* ── Empty / no-prompts message ── */
.apv-no-prompts {
    text-align: center;
    color: #646970;
    font-style: italic;
    padding: 20px 0;
}
