/* AI Assistant Styles */

.ai-message.loading .loading-dots {
    display: inline-flex;
    gap: 4px;
}

.ai-message.loading .loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #666;
    animation: loading-bounce 1.4s infinite ease-in-out;
}

.ai-message.loading .loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-message.loading .loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.ai-message.loading .loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Key Highlights Container */
.key-highlights {
    max-width: 100%;
    background: linear-gradient(135deg, #f8fafe 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    border: 1px solid #e1e8f0;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.08);
}

.todays-podcast {
    max-width: 100%;
}

/* Removed old story-highlight styles - using enhanced version below */

.page-overview {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    border-left: 4px solid #28a745;
}

.podcast-article {
    border-left: 4px solid #fd7e14;
    padding-left: 12px;
    margin: 15px 0;
}

.podcast-article h5 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 1.1em;
}

.podcast-article .page-ref {
    color: #666;
    font-style: italic;
}

.welcome-note, .concluding-note {
    background-color: #e7f3ff;
    padding: 12px;
    border-radius: 6px;
    margin: 12px 0;
    border-left: 4px solid #007bff;
}

.audio-section {
    background-color: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #e0e0e0;
}

.audio-section h5 {
    margin: 0 0 10px 0;
    color: #333;
}

.audio-section audio {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.audio-note {
    margin: 8px 0 0 0;
    color: #666;
    font-size: 12px;
    font-style: italic;
    text-align: center;
}

/* AI Assistant Modal - Base styles */
#aiAssistantModal.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

/* AI Assistant Modal - When shown */
div#aiAssistantModal.modal[style*="display: block"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* AI Assistant Modal Desktop Sizing - Override default modal styles */
@media (min-width: 1024px) {
    /* Only apply flex layout when modal is explicitly shown */
    div#aiAssistantModal.modal[style*="display: block"],
    div#aiAssistantModal.modal.show {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    div#aiAssistantModal.modal .modal-content.ai-modal {
        max-width: 75vw !important;
        width: 75vw !important;
        max-height: 85vh !important;
        height: 80vh !important;
        margin: 0 auto !important;
        overflow-y: auto !important;
        padding: 0 !important;
    }
    
    /* Ensure AI modal content takes full space */
    div#aiAssistantModal .ai-modal {
        height: 80vh !important;
        max-height: 80vh !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* 2-column layout for highlights on desktop */
    .highlights-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 24px !important;
        margin-top: 16px !important;
        align-items: start !important;
    }
}

@media (max-width: 1023px) {
    .highlights-grid {
        display: block;
    }
}

/* Crisp Key Highlights Styling */
.story-highlight {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafe 100%);
    border: 1px solid #e1e8f0;
    border-left: 4px solid #007bff;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.6s ease-out;
    animation-fill-mode: both;
}

/* Staggered animation delays for multiple highlights */
.story-highlight:nth-child(1) { animation-delay: 0s; }
.story-highlight:nth-child(2) { animation-delay: 0.1s; }
.story-highlight:nth-child(3) { animation-delay: 0.2s; }
.story-highlight:nth-child(4) { animation-delay: 0.3s; }
.story-highlight:nth-child(5) { animation-delay: 0.4s; }
.story-highlight:nth-child(6) { animation-delay: 0.5s; }

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.story-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #007bff, #0056b3);
}

.story-highlight:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
    border-color: #0056b3;
}

.story-highlight h5 {
    color: #1a202c;
    margin: 0 0 16px 0;
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px !important;
}

.story-highlight h5::before {
    content: "📌";
    font-size: 0.9em;
    opacity: 0.8;
}

.story-highlight .key-points {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.story-highlight .key-points li {
    position: relative;
    padding: 12px 16px 12px 40px;
    margin: 0;
    background: rgba(0, 123, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid #007bff;
    line-height: 1.6;
    color: #4a5568;
    font-size: 0.95em;
    transition: all 0.2s ease;
}

.story-highlight .key-points li:hover {
    background: rgba(0, 123, 255, 0.06);
    transform: translateX(2px);
}

.story-highlight .key-points li::before {
    content: "•";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #007bff;
    font-weight: 900;
    font-size: 1.2em;
}

.story-highlight .key-points li::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #007bff;
    border-radius: 50%;
    opacity: 0.3;
}

/* Podcast articles styling */
.podcast-article {
    border: 1px solid #e9ecef !important;
    border-left: 4px solid #fd7e14 !important;
    border-radius: 8px;
    padding: 15px !important;
    margin: 10px 0 !important;
    background: #fafbfc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.podcast-article h5 {
    color: #1a1a1a !important;
    margin: 0 0 10px 0 !important;
    font-size: 1.1em !important;
    font-weight: 600 !important;
}

.podcast-article .page-ref {
    color: #666 !important;
    font-style: italic !important;
    font-size: 0.85em;
}

/* Remove page overview styling - we'll hide it via JS */
.page-overview {
    display: none !important;
}

/* AI Messages container improvements */
.ai-messages {
    padding: 15px !important;
}

/* Key Highlights Header */
.key-highlights h4 {
    color: #1a202c;
    font-weight: 800;
    margin: 0 0 24px 0;
    font-size: 1.5em;
    text-align: center;
    position: relative;
    padding: 16px 0;
    background: linear-gradient(135deg, #007bff, #0056b3);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.key-highlights h4::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 2px;
}

.todays-podcast h4 {
    color: #1a1a1a !important;
    font-weight: 600 !important;
    margin: 0 0 20px 0 !important;
    font-size: 1.3em;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

/* Audio section improvements */
.audio-section {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%) !important;
    border: 1px solid #cce7ff !important;
    border-radius: 10px !important;
    padding: 20px !important;
    margin: 20px 0 !important;
}

.audio-section h5 {
    margin: 0 0 15px 0 !important;
    color: #1a1a1a !important;
    font-weight: 600 !important;
}

/* Welcome and concluding notes styling */
.welcome-note, .concluding-note {
    background: linear-gradient(135deg, #e7f3ff 0%, #cce7ff 100%) !important;
    border: 1px solid #b3d9ff !important;
    border-left: 4px solid #007bff !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin: 15px 0 !important;
    font-style: normal !important;
}

.welcome-note p, .concluding-note p {
    margin: 0 !important;
    color: #1a1a1a !important;
    line-height: 1.5;
}

.welcome-note strong, .concluding-note strong {
    color: #007bff !important;
}

/* Premium Podcast Player Styles */
.todays-podcast-player {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 0;
    margin: 20px 0;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    overflow: hidden;
    position: relative;
}

.podcast-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.podcast-icon {
    font-size: 2.5em;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.podcast-title {
    flex: 1;
    color: white;
    font-size: 1.4em;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.podcast-duration {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.premium-audio-player {
    padding: 25px;
    background: rgba(255, 255, 255, 0.05);
}

.custom-audio-player {
    width: 100% !important;
    height: 50px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 25px !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px) !important;
    margin: 15px 0 !important;
    outline: none !important;
}

.custom-audio-player::-webkit-media-controls-panel {
    background: transparent !important;
}

.audio-error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    margin: 20px;
}

/* Mobile responsiveness for highlights and podcast */
@media (max-width: 768px) {
    /* Key Highlights Mobile */
    .key-highlights {
        padding: 16px;
        margin: 16px 0;
        border-radius: 12px;
    }
    
    .key-highlights h4 {
        font-size: 1.3em;
        padding: 12px 0;
        margin: 0 0 20px 0;
    }
    
    .key-highlights h4::before {
        width: 50px;
        height: 2px;
    }
    
    .story-highlight {
        padding: 16px;
        margin: 12px 0;
        border-radius: 10px;
    }
    
    .story-highlight h5 {
        font-size: 1.1em;
        margin: 0 0 12px 0;
        padding-top: 7px;
    }
    
    .story-highlight .key-points li {
        padding: 10px 14px 10px 32px;
        font-size: 0.9em;
    }
    
    .story-highlight .key-points li::before {
        left: 12px;
        font-size: 1.1em;
    }
    
    /* Highlights grid mobile */
    .highlights-grid {
        gap: 12px !important;
    }
    
    /* Podcast Player Mobile */
    .podcast-header {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .podcast-title {
        font-size: 1.2em;
    }
    
    .premium-audio-player {
        padding: 20px;
    }
}

/* Premium Podcast Loading Animation */
.podcast-loading {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 16px;
    color: white;
    margin: 15px 0;
}

.podcast-loading-icon {
    font-size: 3em;
    animation: podcast-spin 3s linear infinite;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

@keyframes podcast-spin {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.podcast-loading-text {
    flex: 1;
}

.loading-title {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.loading-subtitle {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 15px;
    font-style: italic;
}

.loading-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5, #00d2ff);
    background-size: 200% 100%;
    animation: progress-flow 2s linear infinite;
    border-radius: 3px;
    width: 100%;
}

@keyframes progress-flow {
    0% {
        background-position: 200% 0;
        transform: translateX(-100%);
    }
    100% {
        background-position: -200% 0;
        transform: translateX(0);
    }
}

/* Mobile podcast loading */
@media (max-width: 768px) {
    .podcast-loading {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 20px;
    }
    
    .podcast-loading-icon {
        font-size: 2.5em;
    }
    
    .loading-title {
        font-size: 1.1em;
    }
    
    .loading-subtitle {
        font-size: 0.85em;
    }
}

/* AI Chat Response Styles */
.ai-chat-response {
    max-width: 100%;
    background: linear-gradient(135deg, #f8fafe 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    border: 1px solid #e1e8f0;
    box-shadow: 0 3px 15px rgba(0, 123, 255, 0.08);
}

.chat-result-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafe 100%);
    border: 1px solid #e9ecef;
    border-left: 4px solid #007bff;
    border-radius: 10px;
    padding: 16px;
    margin: 12px 0;
    transition: all 0.3s ease;
    position: relative;
}

.chat-result-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.12);
    border-color: #0056b3;
}

.result-title {
    color: #1a202c;
    margin: 0 0 10px 0;
    font-size: 1.1em;
    font-weight: 600;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-desc {
    color: #4a5568;
    margin: 0 0 8px 0;
    line-height: 1.6;
    font-size: 0.95em;
}

.result-page {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.similar-questions {
    background: rgba(0, 123, 255, 0.03);
    border: 1px solid rgba(0, 123, 255, 0.1);
    border-radius: 10px;
    padding: 16px;
    margin-top: 20px;
}

.similar-questions h6 {
    color: #1a202c;
    margin: 0 0 12px 0;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.similar-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.similar-item {
    background: white;
    border: 1px solid #e1e8f0;
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #4a5568;
    font-size: 0.9em;
    line-height: 1.4;
    position: relative;
}

.similar-item:hover {
    background: rgba(0, 123, 255, 0.05);
    border-color: #007bff;
    color: #007bff;
    transform: translateX(4px);
}

.similar-item::before {
    content: "→";
    position: absolute;
    left: -8px;
    opacity: 0;
    transition: all 0.2s ease;
    color: #007bff;
}

.similar-item:hover::before {
    opacity: 1;
    left: -4px;
}

/* Mobile responsiveness for chat response */
@media (max-width: 768px) {
    .ai-chat-response {
        padding: 16px;
        margin: 12px 0;
        border-radius: 10px;
    }
    
    .chat-result-item {
        padding: 14px;
        margin: 10px 0;
        border-radius: 8px;
    }
    
    .result-title {
        font-size: 1em;
    }
    
    .result-desc {
        font-size: 0.9em;
    }
    
    .similar-questions {
        padding: 12px;
        margin-top: 16px;
    }
    
    .similar-item {
        padding: 8px 12px;
        font-size: 0.85em;
    }
}
