/* ============================================================
   AI Summary System – Combined front-end skins  v13.0
   Two switchable designs, selected from the backend:
     .ai-theme-classic  – light card, solid button, status label
     .ai-theme-gradient – gradient border, icon button, chevron
   Accent color is driven by --ai-accent (set inline per block).
   ============================================================ */

/* ---------- Shared base ---------- */
.ai-summary-block {
    margin: 28px 0;
    font-family: inherit;
}

.ai-summary-output {
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.ai-error {
    margin: 0;
    font-size: 13px;
    color: #dc2626;
}

@keyframes ai-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

@keyframes ai-reveal {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ai-ping {
    0%   { box-shadow: 0 0 0 0   rgba(34,197,94,0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0);    }
    100% { box-shadow: 0 0 0 0   rgba(34,197,94,0);    }
}

.menu-item-0 .ai-summary-block { display: none; }


/* ============================================================
   THEME: CLASSIC
   ============================================================ */
.ai-theme-classic .ai-summary-inner {
    border-radius: 14px;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    overflow: hidden;
}

.ai-theme-classic .ai-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    gap: 10px;
}

.ai-theme-classic .ai-summary-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b;
}

.ai-theme-classic .ai-summary-label::before {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,0.5);
    animation: ai-ping 1.8s ease-in-out infinite;
}

.ai-theme-classic .ai-summary-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    border-radius: 8px;
    padding: 9px 18px 9px 14px;
    font-size: 19px;
    font-weight: 600;
    color: #fff;
    background: var(--ai-accent, #0073aa);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.1);
    letter-spacing: 0.01em;
}

.ai-theme-classic .ai-summary-btn::before {
    content: "⚡";
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.ai-theme-classic .ai-summary-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2), 0 8px 20px rgba(0,0,0,0.12);
}

.ai-theme-classic .ai-summary-btn:active {
    transform: translateY(0);
    filter: brightness(0.96);
    box-shadow: 0 1px 3px rgba(0,0,0,0.16);
}

.ai-theme-classic .ai-summary-btn:disabled,
.ai-theme-classic .ai-summary-btn[aria-busy="true"] {
    opacity: 0.7;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.ai-theme-classic .ai-summary-btn[aria-busy="true"]::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ai-spin 0.65s linear infinite;
    flex-shrink: 0;
}

/* Open/close arrow */
.ai-theme-classic .ai-summary-btn::after {
    content: "";
    order: 2;
    width: 8px;
    height: 8px;
    margin-left: 2px;
    border-right: 2px solid rgba(255,255,255,0.9);
    border-bottom: 2px solid rgba(255,255,255,0.9);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.ai-theme-classic .ai-summary-btn[aria-expanded="true"]::after {
    transform: rotate(225deg) translateY(-2px);
}

.ai-theme-classic .ai-summary-btn[aria-busy="true"]::after {
    display: none;
}

.ai-theme-classic .ai-summary-output {
    padding: 0 16px 16px;
}

.ai-theme-classic .ai-summary-output-inner {
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    animation: ai-reveal 0.22s ease both;
}

.ai-theme-classic .ai-summary-output p {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.72;
    color: #334155;
}

.ai-theme-classic .ai-summary-output h4 {
    margin: 10px 0 5px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #94a3b8;
}

.ai-theme-classic .ai-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-theme-classic .ai-summary-list li {
    display: inline;
    gap: 10px;
    font-size: 14px;
    line-height: 1.65;
    color: #334155;
    padding: 9px 12px;
    margin-left: 0;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}

.ai-theme-classic .ai-summary-list li::before {
    content: "";
    flex-shrink: 0;
    margin-top: 8px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ai-accent, #22c55e);
}

.ai-theme-classic .ai-skeleton {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ai-theme-classic .ai-skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e8edf3 50%, #f1f5f9 75%);
    background-size: 300% 100%;
    animation: ai-shimmer 1.5s ease-in-out infinite;
}
.ai-theme-classic .ai-skeleton-line:nth-child(1) { width: 100%; }
.ai-theme-classic .ai-skeleton-line:nth-child(2) { width: 85%; }
.ai-theme-classic .ai-skeleton-line:nth-child(3) { width: 68%; }

@media (max-width: 600px) {
    .ai-theme-classic .ai-summary-header { flex-direction: column; align-items: stretch; }
    .ai-theme-classic .ai-summary-btn { justify-content: center; width: 100%; }
}


/* ============================================================
   THEME: GRADIENT
   ============================================================ */
.ai-theme-gradient { margin: 10px 0; }

.ai-theme-gradient .ai-summary-inner {
    border-radius: 0.5rem;
    background: linear-gradient(90deg, var(--ai-accent-start, #9333ea), var(--ai-accent-end, #ec4899));
    padding: 2px;
    overflow: hidden;
}

.ai-theme-gradient .ai-summary-header {
    background: #ffffff;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 0.5rem;
}

.ai-theme-gradient .ai-summary-btn {
    all: unset;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    flex: 1;
}

.ai-theme-gradient .ai-summary-btn-main {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    background: linear-gradient(90deg, var(--ai-accent-start, #9333ea), var(--ai-accent-end, #ec4899));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-theme-gradient .ai-summary-icon {
    font-size: 20px;
}

.ai-theme-gradient .ai-summary-btn-sub {
    color: #94a3b8;
    font-size: 11px;
    margin-top: 2px;
}

.ai-theme-gradient .ai-summary-chevron {
    color: var(--ai-accent-start, #9333ea);
    font-size: 24px;
    transition: transform 0.2s;
    line-height: 1;
}

.ai-theme-gradient .ai-summary-output {
    background: #fff;
    padding: 0 16px 16px;
    border-radius: 0 0 0.5rem 0.5rem;
}

.ai-theme-gradient .ai-summary-output-inner {
    border-top: 1px solid #eef0f3;
    padding-top: 14px;
}

.ai-theme-gradient .ai-summary-output p {
    color: #666666;
    font-size: 14px;
    line-height: 1.72;
    margin: 10px 0;
}

.ai-theme-gradient .ai-summary-output h4 {
    margin: 10px 0 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #666666;
}

.ai-theme-gradient .ai-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-theme-gradient .ai-summary-list li {
    position: relative;
    padding: 10px 12px 10px 16px;
    margin-left: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #666666;
}

.ai-theme-gradient .ai-summary-list li::before {
    content: "";
    position: absolute;
    left: 1px;
    top: 17px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ai-accent, #c084fc);
}

.ai-theme-gradient .ai-skeleton {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-top: 14px;
}

.ai-theme-gradient .ai-skeleton-line {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(117deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.10) 50%, rgba(0,0,0,0.04) 75%), #ececec;
    background-size: 300% 100%;
    animation: ai-shimmer 0.9s linear infinite;
}
.ai-theme-gradient .ai-skeleton-line:nth-child(1) { width: 100%; }
.ai-theme-gradient .ai-skeleton-line:nth-child(2) { width: 85%; }
.ai-theme-gradient .ai-skeleton-line:nth-child(3) { width: 70%; }

@media (max-width: 600px) {
    .ai-theme-gradient .ai-summary-header { padding: 12px; }
}


/* ============================================================
   THEME: PRO AI  (dark glass panel, glowing orb, AI badge)
   ============================================================ */
.ai-theme-proai { margin: 24px 0; }

.ai-theme-proai .ai-summary-inner {
    border-radius: 16px;
    padding: 1.5px;
    background: linear-gradient(135deg, var(--ai-accent-start, #9333ea), var(--ai-accent-end, #ec4899));
    box-shadow: 0 18px 40px -18px var(--ai-accent-start, #9333ea), 0 2px 8px rgba(2,6,23,0.4);
    overflow: hidden;
}

.ai-theme-proai .ai-summary-header {
    display: flex;
    background: radial-gradient(120% 160% at 0% 0%, #131a2e 0%, #0b1020 55%, #080b16 100%);
    border-radius: 14.5px;
    padding: 14px 16px;
}

.ai-theme-proai .ai-summary-btn {
    all: unset;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    box-sizing: border-box;
}

/* Glowing gradient orb with the spark icon */
.ai-theme-proai .ai-summary-orb {
    position: relative;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ai-accent-start, #9333ea), var(--ai-accent-end, #ec4899));
    box-shadow: 0 0 0 0 var(--ai-accent-start, #9333ea);
    animation: ai-orb-pulse 2.4s ease-in-out infinite;
}

@keyframes ai-orb-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(147,51,234,0.45); }
    70%  { box-shadow: 0 0 0 10px rgba(147,51,234,0); }
    100% { box-shadow: 0 0 0 0 rgba(147,51,234,0); }
}

.ai-theme-proai .ai-summary-icon {
    font-size: 18px;
    line-height: 1;
    color: #fff;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.6));
}

.ai-theme-proai .ai-summary-btn-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.ai-theme-proai .ai-summary-text {
    font-weight: 600;
    font-size: 15.5px;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-theme-proai .ai-summary-btn-sub {
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #7c8aa5;
}

/* "AI" badge */
.ai-theme-proai .ai-summary-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #fff;
    padding: 3px 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--ai-accent-start, #9333ea), var(--ai-accent-end, #ec4899));
    box-shadow: 0 2px 10px -2px var(--ai-accent-end, #ec4899);
}

.ai-theme-proai .ai-summary-chevron {
    flex-shrink: 0;
    color: #9aa6bf;
    font-size: 22px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.ai-theme-proai .ai-summary-output {
    background: #0b1020;
    padding: 0 18px 18px;
    border-radius: 0 0 14.5px 14.5px;
}

.ai-theme-proai .ai-summary-output-inner {
    border-top: 1px solid rgba(148,163,184,0.14);
    padding-top: 16px;
    animation: ai-reveal 0.22s ease both;
}

.ai-theme-proai .ai-summary-output p {
    color: #c3cad8;
    font-size: 14px;
    line-height: 1.75;
    margin: 10px 0;
}

.ai-theme-proai .ai-summary-output h4 {
    margin: 12px 0 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8b96ad;
}

.ai-theme-proai .ai-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.ai-theme-proai .ai-summary-list li {
    position: relative;
    margin-left: 0;
    padding: 11px 14px 11px 34px;
    font-size: 14px;
    line-height: 1.6;
    color: #d4dae6;
    background: rgba(148,163,184,0.06);
    border: 1px solid rgba(148,163,184,0.1);
    border-radius: 10px;
}

.ai-theme-proai .ai-summary-list li::before {
    content: "✦";
    position: absolute;
    left: 12px;
    top: 11px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--ai-accent-end, #ec4899);
}

.ai-theme-proai .ai-summary-list li strong { color: #ffffff; }

.ai-theme-proai .ai-skeleton {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-top: 16px;
}

.ai-theme-proai .ai-skeleton-line {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(117deg, rgba(148,163,184,0.06) 25%, rgba(148,163,184,0.18) 50%, rgba(148,163,184,0.06) 75%), #131a2e;
    background-size: 300% 100%;
    animation: ai-shimmer 0.9s linear infinite;
}
.ai-theme-proai .ai-skeleton-line:nth-child(1) { width: 100%; }
.ai-theme-proai .ai-skeleton-line:nth-child(2) { width: 85%; }
.ai-theme-proai .ai-skeleton-line:nth-child(3) { width: 68%; }

@media (max-width: 600px) {
    .ai-theme-proai .ai-summary-btn-sub { display: none; }
}
