/* ============================================
   AI Overview Widget — Styles
   ============================================ */

.aiow-widget {
    --_accent: var(--aiow-accent, #4285F4);
    --_accent-soft: var(--aiow-accent-soft-fb, rgba(66,133,244,0.12));
    --_accent-mid: var(--aiow-accent-mid-fb, rgba(66,133,244,0.25));
    --_bg: #ffffff;
    --_bg-subtle: #f8f9fa;
    --_border: #dadce0;
    --_text: #202124;
    --_text-muted: #5f6368;
    --_radius: 16px;
    --_shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--_bg);
    border: 1px solid var(--_border);
    border-radius: var(--_radius);
    box-shadow: var(--_shadow);
    padding: 0;
    margin: 1.5em 0;
    max-width: 720px;
    overflow: hidden;
    position: relative;
    container-type: inline-size;
    transition: box-shadow 0.25s ease;
}

.aiow-widget:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,.1), 0 8px 24px rgba(0,0,0,.06);
}

/* ── Decorative top bar ── */
.aiow-widget::before {
    content: "";
    display: block;
    height: 3px;
    background: var(--_accent);
    background: linear-gradient(90deg, var(--_accent), var(--aiow-accent-mid-fb, #7B61FF));
    border-radius: var(--_radius) var(--_radius) 0 0;
}

/* ── Header ── */
.aiow-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px 0;
}

.aiow-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--_accent-soft);
    color: var(--_accent);
    flex-shrink: 0;
}

.aiow-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--_text);
    letter-spacing: -0.01em;
}

/* ── Body ── */
.aiow-body {
    padding: 14px 20px 16px;
}

.aiow-text {
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--_text);
    margin: 0;
    animation: aiow-fadeIn 0.4s ease;
}

/* ── Loading shimmer ── */
.aiow-loading {
    padding: 2px 0;
}

.aiow-shimmer-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aiow-shimmer-line {
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--_bg-subtle) 25%, #e8eaed 50%, var(--_bg-subtle) 75%);
    background-size: 400% 100%;
    animation: aiow-shimmer 1.8s ease-in-out infinite;
}

.aiow-shimmer-line:nth-child(2) { animation-delay: 0.15s; }
.aiow-shimmer-line:nth-child(3) { animation-delay: 0.3s; }

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

@keyframes aiow-fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Error state ── */
.aiow-error {
    font-size: 13px;
    line-height: 1.55;
    color: #d93025;
    margin: 0;
    padding: 8px 14px;
    background: #fce8e6;
    border-radius: 10px;
    animation: aiow-fadeIn 0.3s ease;
}

/* ── Footer ── */
.aiow-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 14px;
}

.aiow-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--_text-muted);
    background: var(--_bg-subtle);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.aiow-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--_text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.aiow-refresh:hover {
    background: var(--_accent-soft);
    color: var(--_accent);
}

.aiow-refresh.aiow-spinning svg {
    animation: aiow-spin 0.8s linear infinite;
}

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

/* ── Responsive ── */
@container (max-width: 480px) {
    .aiow-header { padding: 14px 16px 0; }
    .aiow-body   { padding: 12px 16px 14px; }
    .aiow-footer { padding: 0 16px 12px; }
    .aiow-text   { font-size: 14px; }
    .aiow-icon   { width: 28px; height: 28px; border-radius: 8px; }
    .aiow-icon svg { width: 16px; height: 16px; }
}

/* ── Dark mode support ── */
@media (prefers-color-scheme: dark) {
    .aiow-widget {
        --_bg: #1e1e1e;
        --_bg-subtle: #2a2a2a;
        --_border: #3c3c3c;
        --_text: #e8eaed;
        --_text-muted: #9aa0a6;
        --_shadow: 0 1px 3px rgba(0,0,0,.2), 0 4px 12px rgba(0,0,0,.15);
    }
    .aiow-shimmer-line {
        background: linear-gradient(90deg, #2a2a2a 25%, #3c3c3c 50%, #2a2a2a 75%);
        background-size: 400% 100%;
    }
    .aiow-error {
        background: #3c1f1f;
        color: #f28b82;
    }
}

/* ── Print ── */
@media print {
    .aiow-widget {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    .aiow-refresh { display: none; }
    .aiow-shimmer-lines { display: none; }
}
