/**
 * AI Summarization Frontend Styles
 * News-style collapsible summary component
 */

/* Main container */
.ai-summary-container {
    max-width: 780px;
    margin: 22px auto;
    border: 1px solid #e0e0e0;
    padding: 0;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Collapsible details element */
.ai-summary-details {
    max-width: 100%;
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
}

/* Summary header (clickable) */
.ai-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    border-bottom: 1px solid #e8e8e8;
    transition: background 0.2s ease;
}

.ai-summary-header:hover {
    background: linear-gradient(to bottom, #f5f5f5, #efefef);
}

/* Branding section */
.ai-summary-branding {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-summary-brand-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--ai-summary-brand-color, #d1232a);
    letter-spacing: -0.2px;
}

.ai-summary-brand-separator {
    color: #999;
    font-weight: 400;
}

.ai-summary-read-time {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Arrow icon */
.ai-summary-arrow {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: #666;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rotate arrow when open */
.ai-summary-details[open] .ai-summary-arrow {
    transform: rotate(180deg);
}

/* Content area */
.ai-summary-content {
    padding: 18px 24px 20px;
    background: #fff;
}

/* Summary list styling */
.ai-summary-content ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-summary-content li {
    position: relative;
    padding: 10px 0 10px 24px;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-size: 15px;
    line-height: 1.55;
}

.ai-summary-content li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ai-summary-content li:first-child {
    padding-top: 0;
}

/* Custom bullet points */
.ai-summary-content li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 16px;
    width: 8px;
    height: 8px;
    background: var(--ai-summary-brand-color, #d1232a);
    border-radius: 50%;
}

.ai-summary-content li:first-child::before {
    top: 6px;
}

/* Paragraph styling within content */
.ai-summary-content p {
    margin: 0 0 12px;
    color: #444;
    font-size: 15px;
    line-height: 1.6;
}

.ai-summary-content p:last-child {
    margin-bottom: 0;
}

/* Key points heading */
.ai-summary-content strong {
    display: block;
    margin-bottom: 10px;
    color: #222;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hide default marker */
.ai-summary-details > summary {
    list-style: none;
}

.ai-summary-details > summary::-webkit-details-marker {
    display: none;
}

.ai-summary-details > summary::marker {
    display: none;
    content: "";
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-summary-container {
        margin: 16px auto;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .ai-summary-header {
        padding: 12px 16px;
    }
    
    .ai-summary-content {
        padding: 14px 16px 16px;
    }
    
    .ai-summary-content li {
        font-size: 14px;
        padding-left: 20px;
    }
    
    .ai-summary-content li::before {
        width: 6px;
        height: 6px;
    }
}

/* Print styles */
@media print {
    .ai-summary-container {
        border: 1px solid #ccc;
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .ai-summary-details {
        display: block !important;
    }
    
    .ai-summary-details[open] .ai-summary-content {
        display: block !important;
    }
    
    .ai-summary-arrow {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ai-summary-container {
        border-width: 2px;
    }
    
    .ai-summary-content li::before {
        background: currentColor;
    }
}

/* Dark mode support (optional - activate if theme supports it) */
@media (prefers-color-scheme: dark) {
    .ai-summary-container.ai-summary-dark-mode {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .ai-summary-dark-mode .ai-summary-header {
        background: linear-gradient(to bottom, #252525, #1f1f1f);
        border-color: #333;
    }
    
    .ai-summary-dark-mode .ai-summary-content {
        background: #1a1a1a;
    }
    
    .ai-summary-dark-mode .ai-summary-content li {
        color: #e0e0e0;
        border-color: #333;
    }
    
    .ai-summary-dark-mode .ai-summary-read-time {
        color: #aaa;
    }
}

/* Animation for content reveal */
.ai-summary-content {
    animation: ai-summary-fade-in 0.3s ease-out;
}

@keyframes ai-summary-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Schema.org visibility helper (hidden but accessible) */
.ai-summary-schema-data {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

