/* Story Feature Styles */

/* Story Badge */
.story-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 1.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
    margin-left: 0.5rem;
}

.story-badge:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.story-badge:active {
    transform: translateY(0);
}

.story-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Adjust article metadata layout for story badge */
.article-metadata {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-source {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Story Modal Overlay */
.story-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* Story Modal */
.story-modal {
    background: white;
    border-radius: 1rem;
    max-width: 90vw;
    max-height: 90vh;
    width: 1000px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.story-modal-overlay.active .story-modal {
    transform: scale(1);
}

/* Story Modal Header */
.story-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}

.story-modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.story-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Story Modal Content */
.story-modal-content {
    padding: 2rem;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* Story Loading State */
.story-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6b7280;
}

.story-loading .spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #7C3AED;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Story Content Sections */
.story-headline {
    font-size: 2rem;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 2rem 0;
    line-height: 1.2;
}

.story-section {
    margin-bottom: 2.5rem;
}

.story-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #374151;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.story-section-title svg {
    width: 20px;
    height: 20px;
    color: #7C3AED;
}

/* Facts Section */
.story-facts {
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border-left: 4px solid #10b981;
}

.story-facts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.story-facts li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.story-facts li:last-child {
    margin-bottom: 0;
}

.story-facts li::before {
    content: "✓";
    color: #10b981;
    font-weight: bold;
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* Perspectives Grid */
.story-perspectives {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.story-perspective {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-top: 4px solid;
}

.story-perspective.left {
    border-top-color: #3b82f6;
}

.story-perspective.center {
    border-top-color: #6b7280;
}

.story-perspective.right {
    border-top-color: #dc2626;
}

.story-perspective-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.story-perspective-label {
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.story-perspective.left .story-perspective-label {
    color: #3b82f6;
}

.story-perspective.center .story-perspective-label {
    color: #6b7280;
}

.story-perspective.right .story-perspective-label {
    color: #dc2626;
}

.story-perspective-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.story-perspective-content li {
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    position: relative;
    line-height: 1.6;
}

.story-perspective-content li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: inherit;
    font-weight: bold;
}

.story-perspective-content li:last-child {
    margin-bottom: 0;
}

.story-perspective-sources {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
    color: #6b7280;
}

.story-perspective-sources strong {
    color: #374151;
}

/* Connected Articles Section */
.story-articles {
    background: #fafafa;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.story-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.story-article-item {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.story-article-item:hover {
    border-color: #7C3AED;
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.1);
}

.story-article-link {
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.4;
}

.story-article-link:hover {
    color: #7C3AED;
}

/* Error State */
.story-error {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.story-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.story-error-message {
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.story-retry-btn {
    background: #7C3AED;
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.story-retry-btn:hover {
    background: #6D28D9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .story-modal {
        width: 95vw;
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .story-modal-header {
        padding: 1rem 1.5rem;
    }
    
    .story-modal-content {
        padding: 1.5rem;
    }
    
    .story-headline {
        font-size: 1.5rem;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .story-perspectives {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .story-perspective {
        padding: 1rem;
    }
    
    .story-badge span {
        display: none;
    }
    
    .story-badge {
        padding: 0.25rem 0.5rem;
        min-width: 2rem;
        justify-content: center;
    }
    
    .story-articles-grid {
        grid-template-columns: 1fr;
    }
}

/* Dark theme support - only when body has dark class (not automatic) */
body.dark-theme .story-modal {
    background: #1f2937;
    color: #f9fafb;
}

body.dark-theme .story-modal-header {
    background: linear-gradient(135deg, #374151, #4b5563);
    border-bottom-color: #4b5563;
}

body.dark-theme .story-modal-title {
    color: #f9fafb;
}

body.dark-theme .story-modal-close {
    color: #d1d5db;
}

body.dark-theme .story-modal-close:hover {
    background: #4b5563;
    color: #f3f4f6;
}

body.dark-theme .story-headline {
    color: #f9fafb;
}

body.dark-theme .story-section-title {
    color: #f3f4f6;
}

body.dark-theme .story-facts {
    background: #374151;
}

body.dark-theme .story-facts li {
    background: #4b5563;
    color: #f9fafb;
}

body.dark-theme .story-perspective {
    background: #374151;
    color: #f9fafb;
}

body.dark-theme .story-perspective-content li {
    color: #e5e7eb;
}

body.dark-theme .story-perspective-sources {
    border-top-color: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
}

body.dark-theme .story-perspective-sources strong {
    color: #d1d5db;
}

body.dark-theme .story-articles {
    background: #374151;
}

body.dark-theme .story-article-item {
    background: #4b5563;
    border-color: #6b7280;
}

body.dark-theme .story-article-link {
    color: #d1d5db;
}

body.dark-theme .story-article-link:hover {
    color: #818CF8;
}

body.dark-theme .story-loading {
    color: #d1d5db;
}

body.dark-theme .story-error {
    color: #d1d5db;
}