/**
 * AI Overview Optimization Styles
 * Enhanced formatting for superior visual hierarchy and AI content extraction
 */

/* Global AI Section Styling */
.ai-answer-section,
.people-also-ask,
.statistics-section,
.topic-authority-cluster {
    position: relative;
}

/* Section Separators */
.ai-answer-section + .people-also-ask::before,
.people-also-ask + .statistics-section::before,
.statistics-section + .services::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #0ea5e9, transparent);
    z-index: 1;
}

/* Smooth section transitions */
.ai-answer-section,
.people-also-ask,
.statistics-section {
    scroll-margin-top: 100px;
}

/* AI Answer Box - Direct answers first (TIP 1) */
.ai-answer-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    position: relative;
}

.ai-answer-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0284c7, #0ea5e9, #0284c7);
}

.ai-answer-box {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e0f2fe;
    border-left: 6px solid #0284c7;
    padding: 40px;
    margin: 0 auto;
    border-radius: 16px;
    box-shadow: 
        0 10px 25px rgba(2, 132, 199, 0.08),
        0 4px 10px rgba(0, 0, 0, 0.04);
    max-width: 900px;
    position: relative;
    overflow: hidden;
}

.ai-answer-box::before {
    content: '💡';
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 1.5rem;
    opacity: 0.7;
}

.ai-answer-box h2 {
    color: #0c4a6e;
    font-size: 2rem;
    margin-bottom: 25px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.ai-answer-box .direct-answer {
    font-size: 1.25rem;
    line-height: 1.75;
    color: #0369a1;
    margin: 20px 0 25px 0;
    padding: 20px;
    background: rgba(2, 132, 199, 0.05);
    border-radius: 12px;
    border-left: 4px solid #0ea5e9;
}

.ai-answer-box .direct-answer strong {
    color: #0c4a6e;
    font-weight: 700;
    font-size: 1.05em;
}

.answer-details {
    margin-top: 25px;
    color: #334155;
    line-height: 1.7;
    font-size: 1.05rem;
    padding: 15px 0;
    border-top: 1px solid #e2e8f0;
}

.ai-answer-box .last-updated {
    font-size: 0.95rem;
    color: #64748b;
    margin-top: 20px;
    padding: 10px 15px;
    background: #f1f5f9;
    border-radius: 8px;
    border-left: 3px solid #94a3b8;
    font-style: italic;
}

/* People Also Ask Section (TIP 4) */
.people-also-ask {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 100px 0;
    position: relative;
}

.people-also-ask::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #0ea5e9, #3b82f6);
    border-radius: 2px;
}

.people-also-ask h2 {
    color: #1e293b;
    font-size: 2.5rem;
    margin-bottom: 50px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
}

.people-also-ask h2::after {
    content: '❓';
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem;
    opacity: 0.6;
}

.paa-item {
    margin-bottom: 25px;
    padding: 30px;
    background: #ffffff;
    border-radius: 16px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.paa-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #3b82f6, #0ea5e9);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.paa-item:hover::before {
    transform: scaleX(1);
}

.paa-item:hover {
    border-color: #e0f2fe;
    box-shadow: 
        0 12px 25px rgba(2, 132, 199, 0.1),
        0 4px 10px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}

.paa-item h3 {
    color: #0c4a6e;
    font-size: 1.4rem;
    margin-bottom: 18px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.paa-item p {
    color: #334155;
    line-height: 1.8;
    margin: 0;
    font-size: 1.05rem;
}

.paa-item strong {
    color: #0c4a6e;
    font-weight: 700;
    background: rgba(2, 132, 199, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Structured Service Lists (TIP 2) */
.services-structured {
    padding: 60px 0;
    background: #ffffff;
}

.services-structured h2 {
    color: #1e293b;
    font-size: 2rem;
    margin-bottom: 30px;
    font-weight: 600;
}

.ai-readable-services {
    counter-reset: service-counter;
    padding-left: 0;
    list-style: none;
}

.ai-readable-services > li {
    counter-increment: service-counter;
    margin-bottom: 25px;
    padding: 20px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    position: relative;
    padding-left: 60px;
}

.ai-readable-services > li::before {
    content: counter(service-counter);
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #0284c7;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.ai-readable-services ul {
    margin: 10px 0 0 20px;
    padding: 0;
    list-style-type: disc;
}

.ai-readable-services ul li {
    margin: 8px 0;
    color: #64748b;
}

/* Topic Clusters (TIP 7) */
.topic-authority-cluster {
    background: #f1f5f9;
    padding: 40px;
    margin: 60px 0;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
}

.topic-authority-cluster h2 {
    color: #1e293b;
    font-size: 1.75rem;
    margin-bottom: 25px;
    font-weight: 600;
}

.cluster-links {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.cluster-links li {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.cluster-links li:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-color: #0284c7;
}

.cluster-links a {
    text-decoration: none;
    color: #0369a1;
    font-weight: 500;
}

.cluster-links a:hover {
    color: #0284c7;
}

.link-desc {
    color: #64748b;
    font-size: 0.9rem;
    display: block;
    margin-top: 5px;
}

/* Statistics Section (TIP 5 & 3) */
.statistics-section {
    padding: 100px 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    position: relative;
    overflow: hidden;
}

.statistics-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(2, 132, 199, 0.1) 0%, transparent 50%);
}

.statistics-section .container {
    position: relative;
    z-index: 2;
}

.statistics-section h2 {
    text-align: center;
    color: #ffffff;
    font-size: 2.75rem;
    margin-bottom: 60px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stats-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 0;
    list-style: none;
    max-width: 1200px;
    margin: 0 auto;
}

.stats-list li {
    padding: 35px 25px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stats-list li::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.1), transparent);
    transition: left 0.6s ease;
}

.stats-list li:hover::before {
    left: 100%;
}

.stats-list li:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(2, 132, 199, 0.2),
        0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: rgba(14, 165, 233, 0.3);
}

.stats-list strong {
    display: block;
    font-size: 2.8rem;
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-weight: 900;
    line-height: 1.1;
}

.stats-list li {
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.5;
}

.stats-updated {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-top: 50px;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Citation Links (TIP 3) */
sup a {
    color: #0284c7;
    text-decoration: none;
    font-weight: normal;
    font-size: 0.75rem;
    padding: 0 2px;
}

sup a:hover {
    text-decoration: underline;
    color: #0369a1;
}

/* HowTo Section (TIP 6) */
.how-to-section {
    padding: 60px 0;
    background: #ffffff;
}

.how-to-section h2 {
    color: #1e293b;
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.how-to-steps {
    counter-reset: step-counter;
    padding-left: 0;
    list-style: none;
}

.how-to-steps li {
    counter-increment: step-counter;
    margin-bottom: 30px;
    padding: 25px;
    background: #f8fafc;
    border-left: 4px solid #0284c7;
    border-radius: 8px;
    position: relative;
}

.how-to-steps h3 {
    color: #0369a1;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.how-to-steps h3::before {
    content: "Step " counter(step-counter) ": ";
    font-weight: bold;
    color: #0284c7;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    /* AI Answer Box Mobile */
    .ai-answer-section {
        padding: 60px 0;
    }
    
    .ai-answer-box {
        padding: 25px;
        margin: 0 15px;
        border-radius: 12px;
    }
    
    .ai-answer-box h2 {
        font-size: 1.6rem;
        line-height: 1.3;
    }
    
    .ai-answer-box .direct-answer {
        font-size: 1.1rem;
        padding: 15px;
    }
    
    /* PAA Section Mobile */
    .people-also-ask {
        padding: 60px 0;
    }
    
    .people-also-ask h2 {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    .people-also-ask h2::after {
        right: -30px;
        font-size: 1.4rem;
    }
    
    .paa-item {
        padding: 20px;
        margin: 0 15px 20px 15px;
        border-radius: 12px;
    }
    
    .paa-item h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .paa-item p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Statistics Section Mobile */
    .statistics-section {
        padding: 60px 0;
    }
    
    .statistics-section h2 {
        font-size: 2rem;
        margin-bottom: 40px;
        padding: 0 20px;
    }
    
    .stats-list {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 15px;
    }
    
    .stats-list li {
        padding: 25px 20px;
    }
    
    .stats-list strong {
        font-size: 2.2rem;
    }
    
    /* Topic Clusters Mobile */
    .cluster-links {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cluster-links li {
        margin: 0 15px;
    }
    
    /* Service Lists Mobile */
    .ai-readable-services > li {
        padding-left: 45px;
        margin: 0 15px 20px 15px;
    }
    
    .ai-readable-services > li::before {
        left: 12px;
        width: 22px;
        height: 22px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .ai-answer-box {
        margin: 0 10px;
        padding: 20px;
    }
    
    .ai-answer-box h2 {
        font-size: 1.4rem;
    }
    
    .ai-answer-box .direct-answer {
        font-size: 1rem;
        padding: 12px;
    }
    
    .people-also-ask h2 {
        font-size: 1.75rem;
    }
    
    .people-also-ask h2::after {
        display: none;
    }
    
    .paa-item {
        margin: 0 10px 15px 10px;
        padding: 15px;
    }
    
    .statistics-section h2 {
        font-size: 1.75rem;
        padding: 0 15px;
    }
    
    .stats-list {
        padding: 0 10px;
    }
    
    .stats-list strong {
        font-size: 2rem;
    }
}

/* Enhanced Animations and Interactions */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(2, 132, 199, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(2, 132, 199, 0.6);
    }
}

/* Apply animations when in viewport */
.ai-answer-box {
    animation: fadeInScale 0.6s ease-out;
}

.paa-item {
    animation: slideInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.paa-item:nth-child(1) { animation-delay: 0.1s; }
.paa-item:nth-child(2) { animation-delay: 0.2s; }
.paa-item:nth-child(3) { animation-delay: 0.3s; }
.paa-item:nth-child(4) { animation-delay: 0.4s; }
.paa-item:nth-child(5) { animation-delay: 0.5s; }

.stats-list li {
    animation: slideInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.stats-list li:nth-child(1) { animation-delay: 0.1s; }
.stats-list li:nth-child(2) { animation-delay: 0.2s; }
.stats-list li:nth-child(3) { animation-delay: 0.3s; }
.stats-list li:nth-child(4) { animation-delay: 0.4s; }
.stats-list li:nth-child(5) { animation-delay: 0.5s; }

/* Focus and accessibility improvements */
.paa-item:focus-within {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

.ai-answer-box:focus-within {
    animation: pulseGlow 2s infinite;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ai-answer-box {
        border: 3px solid #000;
        background: #fff;
    }
    
    .paa-item {
        border: 2px solid #000;
        background: #fff;
    }
    
    .statistics-section {
        background: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ai-answer-box,
    .paa-item,
    .stats-list li {
        animation: none;
    }
    
    .paa-item:hover,
    .stats-list li:hover {
        transform: none;
    }
    
    .paa-item::before,
    .stats-list li::before {
        transition: none;
    }
}

/* Print Styles for AI Extraction */
@media print {
    .ai-answer-box,
    .paa-item,
    .stats-list {
        page-break-inside: avoid;
        animation: none;
    }
    
    .direct-answer {
        font-weight: bold !important;
        color: #000 !important;
    }
    
    .statistics-section {
        background: #fff !important;
        color: #000 !important;
    }
    
    .stats-list strong {
        color: #000 !important;
    }
}