/**
 * AEI Content Generator - Frontend Styles
 * Styles ONLY for specific components added by the generator
 * Does NOT override theme typography - respects user's theme styling
 * Version: 4.0 - Component-Only Styling
 */

/* ========================================
   CALL-TO-ACTION BOX
   Class: .premium-cta or .premium-cta-box
   ======================================== */

/* Premium Call-to-Action */
.premium-cta-box,
.premium-cta {
    margin: 40px auto;
    padding: 30px;
    max-width: 700px;
    background: linear-gradient(135deg, #FF8C00 0%, #FFA500 100%);
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(255, 140, 0, 0.3);
    text-align: center;
    color: #fff;
    font-weight: 600;
    font-size: 20px;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.premium-cta-box:hover,
.premium-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.premium-cta-box::before,
.premium-cta::before {
    content: '💬';
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    animation: ctaBounce 2s infinite ease-in-out;
}

@keyframes ctaBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Shimmer effect on hover */
.premium-cta-box::after,
.premium-cta::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
}

.premium-cta-box:hover::after,
.premium-cta:hover::after {
    left: 100%;
}

/* CTA Text Styling */
.premium-cta-box p,
.premium-cta p {
    margin: 0;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.premium-cta-box strong,
.premium-cta strong {
    color: #fff;
    font-weight: 700;
}

/* ========================================
   HIGHLIGHTED INTRO BOX
   Class: .premium-intro
   ======================================== */

.premium-intro {
    font-size: 1.15em;
    font-weight: 500;
    color: #2d3748;
    padding: 25px 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 5px solid #FF8C00;
    border-radius: 8px;
    margin-bottom: 2em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* ========================================
   CONCLUSION BOX
   Class: .premium-conclusion
   ======================================== */

/* Conclusion Styling */
.premium-conclusion {
    margin: 3em 0 2em;
    padding: 25px 30px;
    background: linear-gradient(to right, #fff5e6, #fff);
    border-left: 5px solid #FF8C00;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1.8;
}

/* ========================================
   RESPONSIVE - Component adjustments only
   ======================================== */

@media (max-width: 768px) {
    .premium-cta-box,
    .premium-cta {
        padding: 25px 20px;
        font-size: 18px;
        margin: 30px 10px;
    }
    
    .premium-cta-box::before,
    .premium-cta::before {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .premium-intro {
        padding: 20px;
        font-size: 1.05em;
    }
    
    .premium-conclusion {
        padding: 20px;
    }
}

/* Dark Mode - Component adjustments only */
@media (prefers-color-scheme: dark) {
    .premium-intro {
        background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
        color: #e0e0e0;
        border-left-color: #FF8C00;
    }
    
    .premium-conclusion {
        background: linear-gradient(to right, #2a2a2a, #1a1a1a);
        color: #e0e0e0;
    }
    
    .premium-cta-box,
    .premium-cta {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    }
}

/* Print Styles */
@media print {
    .premium-cta-box,
    .premium-cta {
        background: #f0f0f0 !important;
        color: #333 !important;
        box-shadow: none !important;
        border: 2px solid #667eea !important;
    }
    
    .premium-cta-box::before,
    .premium-cta::before,
    .premium-cta-box::after,
    .premium-cta::after {
        display: none !important;
    }
    
    .premium-cta-box p,
    .premium-cta p {
        color: #333 !important;
    }
}

/* Accessibility Enhancements */
.premium-cta-box:focus,
.premium-cta:focus {
    outline: 3px solid #ffc107;
    outline-offset: 3px;
}

/* ========================================
   BADGE
   Class: .premium-badge
   ======================================== */
.premium-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading Animation for Dynamic Content */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.premium-loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
    height: 20px;
    margin: 10px 0;
}

/* ========================================
   REFERENCES SECTION
   Class: .premium-references
   ======================================== */
.premium-references {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 12px;
    margin: 3em 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.premium-references li {
    padding: 12px 0;
    border-bottom: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.premium-references li:last-child {
    border-bottom: none;
}

.premium-references li:hover {
    padding-left: 10px;
    background: rgba(102, 126, 234, 0.05);
}

.premium-references a {
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.premium-references a:hover {
    color: #764ba2;
    transform: translateX(5px);
}

.premium-references a::after {
    content: '→';
    margin-left: 8px;
    opacity: 0;
    transition: all 0.3s ease;
}

.premium-references a:hover::after {
    opacity: 1;
    margin-left: 12px;
}

/* ========================================
   INLINE CITATIONS
   Class: .premium-citation, .ai-citation, or links starting with #ref-
   ======================================== */

a.premium-citation,
a[href^="#ref-"] {
    display: inline;
    color: #FF8C00 !important;
    font-size: 0.75em;
    font-weight: 600;
    text-decoration: none;
    vertical-align: super;
    line-height: 0;
    margin-left: 2px;
    border-bottom: none !important;
    background: none !important;
    padding: 0 !important;
}

a.premium-citation:hover,
a[href^="#ref-"]:hover {
    color: #FFA500 !important;
    text-decoration: underline;
}

/* AI-Generated Citations (Perplexity Sonar style) */
.ai-citation {
    display: inline;
    font-size: 0.85em;
    font-weight: 500;
    white-space: nowrap;
    margin: 0 2px;
}

.ai-citation a {
    color: #667eea !important;
    text-decoration: none !important;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    border-bottom: none !important;
}

.ai-citation a:hover {
    color: #764ba2 !important;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    text-decoration: none !important;
}

/* Superscript style variant */
.ai-citation-super {
    display: inline;
    vertical-align: super;
    font-size: 0.7em;
    line-height: 0;
}

.ai-citation-super a {
    color: #667eea !important;
    font-weight: 600;
    text-decoration: none !important;
    padding: 1px 4px;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 3px;
}

.ai-citation-super a:hover {
    background: rgba(102, 126, 234, 0.3);
}

/* Print - Component adjustments */
@media print {
    .premium-cta-box,
    .premium-cta {
        background: #f0f0f0 !important;
        color: #333 !important;
        box-shadow: none !important;
    }
    
    .premium-references {
        background: #f8f9fa !important;
        box-shadow: none !important;
    }
}

/* ========================================
   REFERENCES SECTION - COLLAPSIBLE
   ======================================== */

/* References Container */
.premium-references-container {
    margin: 40px 0;
    padding: 0;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.premium-references-container:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* References Header (Toggle Button) */
.premium-references-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.premium-references-header:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}

.premium-references-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 18px;
    font-weight: 600;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-references-icon {
    font-size: 20px;
}

.premium-references-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 8px;
}

.premium-references-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
}

.premium-references-toggle-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.premium-references-header.collapsed .premium-references-toggle-icon {
    transform: rotate(-90deg);
}

/* References Content */
.premium-references-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 24px;
    background: #fff;
}

.premium-references-content.expanded {
    max-height: 2000px;
    padding: 24px;
}

/* References List */
.premium-references {
    list-style: none !important;
    counter-reset: reference-counter;
    margin: 0 !important;
    padding: 0 !important;
}

.premium-references li {
    counter-increment: reference-counter;
    position: relative;
    padding: 14px 0 14px 45px !important;
    margin: 0 !important;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s ease;
}

.premium-references li:last-child {
    border-bottom: none;
}

.premium-references li:hover {
    background: #f7fafc;
}

.premium-references li::before {
    content: counter(reference-counter);
    position: absolute;
    left: 0;
    top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.premium-references li a {
    color: #2d3748 !important;
    text-decoration: none !important;
    font-size: 15px;
    line-height: 1.6;
    display: inline;
    transition: color 0.2s ease;
    word-break: break-word;
}

.premium-references li a:hover {
    color: #667eea !important;
    text-decoration: underline !important;
}

/* External Link Icon */
.premium-references li a::after {
    content: "↗";
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.premium-references li a:hover::after {
    opacity: 1;
}

/* Collapsed State Hint */
.premium-references-hint {
    padding: 16px 24px;
    background: #fff;
    color: #718096;
    font-size: 14px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .premium-references-header {
        padding: 16px 18px;
    }
    
    .premium-references-header h3 {
        font-size: 16px;
    }
    
    .premium-references-count {
        min-width: 24px;
        height: 24px;
        font-size: 12px;
        padding: 0 8px;
    }
    
    .premium-references-toggle {
        font-size: 13px;
    }
    
    .premium-references-content.expanded {
        padding: 18px;
    }
    
    .premium-references li {
        padding: 12px 0 12px 40px !important;
        font-size: 14px;
    }
    
    .premium-references li::before {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Print: Always show references expanded */
@media print {
    .premium-references-header {
        background: #667eea !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .premium-references-content {
        max-height: none !important;
        padding: 24px !important;
    }
    
    .premium-references-toggle {
        display: none;
    }
}
