/* AI Summary Box Container */
.ai-summary-box {
    margin: 24px 0;
    padding: 24px;
    background: #fcfcfc;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    box-shadow: none;
    transition: background 0.3s, border-color 0.3s;
}

.ai-summary-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.ai-icon {
    font-size: 20px;
    margin-right: 8px;
}

.ai-title {
    font-weight: 700;
    font-size: 1rem;
    color: #333;
    margin-right: 32px;
}

.ai-desc {
    font-size: 0.85rem;
    color: #666;
}

/* 높이 애니메이션을 위한 wrapper */
.ai-summary-content {
    font-size: var(--t16);
    line-height: 1.8;
    color: #444;
    position: relative;
    overflow: hidden;
    /* height를 JS에서 동적으로 설정 */
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-summary-content > ul {
    margin-left: 0;
}

.ai-summary-content h3 {
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #1b75fd;
    color: #1b75fd;
    font-size: var(--t14);
    font-weight: 600;
    line-height: 150%;
    display: inline-block;
    margin-top: 12px;
    margin-bottom: 4px;
}

.ai-summary-content li {
    list-style: disc;
}

.ai-summary-content .description {
    margin-top: 8px;
    margin-bottom: 8px;
    font-size: var(--t13);
}

/* Fade-out effect */
.ai-summary-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, rgba(252,252,252,0), rgba(252,252,252,1));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.ai-summary-content.is-collapsed::after {
    opacity: 1;
}

/* Toggle Button Container */
.ai-summary-footer {
    display: flex;
    justify-content: center;
    margin-top: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    transition: margin-top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-summary-footer.visible {
    margin-top: 12px;
    height: 32px;
    opacity: 1;
}

.ai-toggle-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 13px;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 20px;
    background-color: #f0f0f0;
    transition: background-color 0.2s, color 0.2s;
}

.ai-toggle-btn:hover {
    background-color: #e8e8e8;
    color: #333;
}

.ai-toggle-btn .arrow-icon {
    width: 12px;
    height: 12px;
    margin-left: 4px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-toggle-btn.is-expanded .arrow-icon {
    transform: rotate(180deg);
}

/* Skim-style Skeleton Loader */
.skim-skeleton-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skim-skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skim-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skim-skeleton-line:nth-child(1) { width: 90%; }
.skim-skeleton-line:nth-child(2) { width: 100%; }
.skim-skeleton-line:nth-child(3) { width: 70%; }

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

/* Blinking Cursor */
.skim-cursor {
    display: inline-block;
    width: 6px;
    height: 15px;
    background-color: #333;
    margin-left: 4px;
    vertical-align: middle;
    animation: skim-blink 1s step-end infinite;
}

@keyframes skim-blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* Recommendations Section */
.ai-recommendations {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.ai-rec-btn {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #004EC3;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.ai-rec-btn:hover {
    background-color: #f0f7ff;
    border-color: #004EC3;
}

/* Markdown Rendering Styles */
.ai-summary-content ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.ai-summary-content li {
    margin-bottom: 4px;
}

.ai-summary-content p {
    margin-bottom: 8px;
}

.ai-summary-content strong {
    font-weight: 700;
    color: #000;
}

/* Citations [n] */
.ai-citation {
    color: #004EC3;
    font-weight: 600;
    text-decoration: none;
    margin-left: 2px;
    font-size: 0.85em;
    vertical-align: super;
}

.ai-citation:hover {
    text-decoration: underline;
}

@media screen and (max-width: 1023px) {
    .ai-summary-header {
        flex-direction: column;
        gap: 10px;
    }
    .ai-summary-header .ai-desc {
        font-size: var(--t12);
    }
}