.ai-overlay-wrapper {
    position: fixed;
    bottom: 24px;
    left: calc(50% + var(--ai-sidebar-offset, 0px));
    transform: translateX(-50%);
    transition: left 300ms cubic-bezier(.32,.72,0,1);
    z-index: 9999;
    max-width: 480px;
    width: calc(100% - 32px);
    animation: overlayIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ai-overlay-card-container {
    position: relative;
}

.ai-card-outer {
    position: relative;
    border-radius: 22px;
    overflow: visible;
}

.ai-card-border {
    position: absolute;
    top: -3px; right: -3px; bottom: -3px; left: -3px;
    border-radius: 25px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6, #2563eb, #4f46e5);
    animation: aiBorderHue 6s linear infinite;
    transition: all 0.3s ease;
    z-index: -1;
    pointer-events: none;
}

.ai-card-border.focused {
    animation: aiBorderHue 3s linear infinite;
}

.ai-card-body {
    background: white;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 22px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.22), 0 2px 12px rgba(59, 130, 246, 0.12), 0 1px 3px rgba(0,0,0,0.08);
    position: relative;
    z-index: 1;
}

.ai-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
}

.ai-orb {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-orb-pulse {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #4d4dff 0%, #0000ff 55%, #0000cc 100%);
    opacity: 0.15;
    animation: aiOrbPulse 2.5s ease-in-out infinite;
}

.ai-orb-core {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4d4dff 0%, #0000ff 55%, #0000cc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 255, 0.35);
    position: relative;
    z-index: 1;
}

.ai-sparkle-large  { transform-origin: 9px 10.5px;  animation: aiSparkle 4s ease-in-out infinite; }
.ai-sparkle-medium { transform-origin: 18.5px 7px;   animation: aiSparkle 4s ease-in-out 0.5s infinite; }
.ai-sparkle-small  { transform-origin: 20px 17.5px;  animation: aiSparkle 4s ease-in-out 1s infinite; }

.ai-prompt-label {
    flex: 1;
    font-size: 18px;
    font-weight: 400;
    color: #6b7280;
    letter-spacing: -0.01em;
    line-height: 1.4;
    padding: 6px 0;
    pointer-events: none;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ai-chevron-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: none;
    background: rgba(59, 130, 246, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
    padding: 0;
}

.ai-chevron-btn:hover {
    background: rgba(59, 130, 246, 0.15);
}

.ai-chevron-btn svg {
    transition: transform 0.25s ease;
}

.ai-chevron-btn.open svg {
    transform: rotate(180deg);
}

/* Suggestions panel — floats above the card */
.ai-suggestions {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    box-shadow: none;
    border: none;
}

.ai-suggestions.d-none { display: none !important; }

.ai-chip {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 11px 13px;
    background: linear-gradient(#ffffff, #ffffff) padding-box, linear-gradient(135deg, rgba(226, 232, 240, 0.95), rgba(226, 232, 240, 0.95)) border-box;
    background-repeat: no-repeat;
    background-size: 100% 100%, 200% 200%;
    background-position: 0 0, 0% 50%;
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: box-shadow 0.22s ease, transform 0.22s ease, background-position 0.22s ease;
    text-align: left;
    width: 100%;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    opacity: 1;
    position: relative;
    transform: translateY(0);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
    will-change: transform, box-shadow;
}

.ai-chip.show {
    opacity: 1;
    animation: none;
}

.ai-chip:hover,
.ai-chip:focus-visible {
    background: linear-gradient(#ffffff, #ffffff) padding-box, linear-gradient(135deg, #7dd3fc 0%, #60a5fa 28%, #3b82f6 52%, #4f46e5 76%, #a855f7 100%) border-box;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1), 0 4px 10px rgba(15, 23, 42, 0.05);
    transform: translateY(-2px);
    animation: aiChipBorderFlow 3.2s linear infinite;
}

.ai-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), 0 14px 30px rgba(15, 23, 42, 0.1);
}

.ai-chip:disabled {
    cursor: default;
}

.ai-chip.ai-chip-loading {
    justify-content: center;
}

.ai-chip.ai-chip-loading:hover {
    transform: none;
}

.ai-chip.ai-chip-loading .ai-chip-icon,
.ai-chip.ai-chip-loading .ai-chip-label,
.ai-chip.ai-chip-loading .ai-chip-desc,
.ai-chip.ai-chip-loading > div {
    opacity: 0;
}

.ai-chip.ai-chip-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    margin-left: -9px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: aiChipSpinner 0.8s linear infinite;
}

.ai-chip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: #2563eb;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
    transition: border-radius 0.22s ease, background 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.ai-chip-static-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.ai-chip-static-icon svg {
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.ai-chip-hover-orb {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    margin: auto;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    transform: scale(0.72);
    pointer-events: none;
    width: 34px;
    height: 34px;
}

.ai-chip-hover-orb .ai-orb-core {
    width: 26px;
    height: 26px;
}

.ai-chip:hover .ai-chip-icon,
.ai-chip:focus-visible .ai-chip-icon {
    border-radius: 50%;
    background: linear-gradient(135deg, #4d4dff 0%, #0000ff 55%, #0000cc 100%);
    box-shadow: 0 6px 18px rgba(0, 0, 255, 0.28);
    transform: scale(1.03);
}

.ai-chip:hover .ai-chip-static-icon,
.ai-chip:focus-visible .ai-chip-static-icon {
    opacity: 0;
    transform: scale(0.72);
}

.ai-chip:hover .ai-chip-hover-orb,
.ai-chip:focus-visible .ai-chip-hover-orb {
    opacity: 1;
    transform: scale(1);
}

.ai-chip-label {
    font-size: 13.5px;
    font-weight: 600;
    color: #253156;
    letter-spacing: -0.01em;
    display: block;
    line-height: 1.35;
}

.ai-chip-desc {
    font-size: 11.5px;
    color: #6b7280;
    font-weight: 400;
    display: block;
}

.ai-overlay-hint {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #9ca3af;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.ai-hint-dot { margin: 0 8px; opacity: 0.3; }

/* Sidebar-aware centering — mirrors body padding-left rules in style.css */
body.nav-sidebar-collapsed,
body.nav-sidebar-expanded {
    --ai-sidebar-offset: 30px; /* sidebar: 60px → offset = 60/2 */
}

@media (max-width: 565px) {
    body.nav-sidebar-collapsed,
    body.nav-sidebar-expanded {
        --ai-sidebar-offset: 0px; /* no sidebar on very small screens */
    }
}

@media (min-width: 992px) {
    body.nav-sidebar-expanded {
        --ai-sidebar-offset: 120px; /* sidebar: 240px → offset = 240/2 */
    }
}

@media (min-width: 1360px) {
    body.nav-sidebar-expanded.copilot-expanded {
        --ai-sidebar-offset: 305px; /* sidebar: 610px → offset = 610/2 */
    }
}

@keyframes overlayIn {
    0%   { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.97); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes aiOrbPulse {
    0%, 100% { transform: scale(1); opacity: 0.15; }
    50%      { transform: scale(1.35); opacity: 0.08; }
}

@keyframes aiChipIn {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes aiBorderHue {
    0%   { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes aiChipBorderFlow {
    0%   { background-position: 0 0, 0% 50%; }
    100% { background-position: 0 0, 200% 50%; }
}

@keyframes aiShimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes aiCardAttention {
    0%   { box-shadow: 0 8px 32px rgba(59, 130, 246, 0.22), 0 2px 12px rgba(59, 130, 246, 0.12), 0 1px 3px rgba(0,0,0,0.08); transform: scale(1); }
    50%  { box-shadow: 0 12px 40px rgba(59, 130, 246, 0.38), 0 4px 20px rgba(59, 130, 246, 0.22), 0 1px 3px rgba(0,0,0,0.08); transform: scale(1.015); }
    100% { box-shadow: 0 8px 32px rgba(59, 130, 246, 0.22), 0 2px 12px rgba(59, 130, 246, 0.12), 0 1px 3px rgba(0,0,0,0.08); transform: scale(1); }
}

@keyframes aiSparkle {
    0%   { opacity: 1;    transform: scale(1)   rotate(0deg); }
    25%  { opacity: 1;    transform: scale(1)   rotate(360deg); }
    50%  { opacity: 0.45; transform: scale(0.7) rotate(360deg); }
    75%  { opacity: 1;    transform: scale(1)   rotate(360deg); }
    100% { opacity: 1;    transform: scale(1)   rotate(360deg); }
}

@keyframes aiChipSpinner {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
