/* NewsScanner Custom Styles */

/* Smooth transitions for theme switching */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Active nav link styling */
.nav-link.active {
    background-color: rgb(51, 65, 85); /* slate-700 */
    color: white;
}

/* Spinner animation for loading states */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Toast animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-enter {
    animation: slideIn 0.3s ease forwards;
}

.toast-exit {
    animation: slideOut 0.3s ease forwards;
}

/* Card hover effects */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Sentiment badge colors */
.sentiment-positive {
    background-color: rgb(22, 163, 74); /* green-600 */
    color: white;
}

.sentiment-negative {
    background-color: rgb(220, 38, 38); /* red-600 */
    color: white;
}

.sentiment-neutral {
    background-color: rgb(100, 116, 139); /* slate-500 */
    color: white;
}

.sentiment-mixed {
    background-color: rgb(217, 119, 6); /* amber-600 */
    color: white;
}

/* Source type badge colors */
.source-rss {
    background-color: rgb(249, 115, 22); /* orange-500 */
    color: white;
}

.source-reddit {
    background-color: rgb(239, 68, 68); /* red-500 */
    color: white;
}

.source-newsapi {
    background-color: rgb(59, 130, 246); /* blue-500 */
    color: white;
}

.source-youtube {
    background-color: rgb(220, 38, 38); /* red-600 */
    color: white;
}

.source-hackernews {
    background-color: rgb(234, 88, 12); /* orange-600 */
    color: white;
}

.source-arxiv {
    background-color: rgb(168, 85, 247); /* purple-500 */
    color: white;
}

.source-github {
    background-color: rgb(75, 85, 99); /* gray-600 */
    color: white;
}

/* Light mode overrides */
html:not(.dark) body {
    background-color: #f1f5f9; /* slate-100 */
    color: #1e293b; /* slate-800 */
}

html:not(.dark) .bg-dark-card {
    background-color: white;
}

html:not(.dark) .bg-dark-bg {
    background-color: #f1f5f9;
}

html:not(.dark) .border-dark-border {
    border-color: #e2e8f0; /* slate-200 */
}

html:not(.dark) .text-gray-100,
html:not(.dark) .text-white {
    color: #1e293b;
}

html:not(.dark) .text-gray-300,
html:not(.dark) .text-gray-400 {
    color: #64748b;
}

/* Scrollbar styling for dark mode */
.dark ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Expandable content transition */
.expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.expandable.expanded {
    max-height: 1000px;
}

/* Form input focus styles */
input:focus, select:focus, textarea:focus {
    outline: none;
    ring: 2px;
    ring-color: rgb(59, 130, 246);
}

/* Loading skeleton animation */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Line clamping for text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Progress bar animations */
.progress-bar {
    transition: width 0.5s ease-in-out;
}

/* Stat card number animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

[data-stat] {
    animation: countUp 0.3s ease-out;
}

/* Hover lift effect for clickable cards */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
}

/* Read Modal Styles */
#read-modal {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#read-modal > div {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prose styling for article content */
.prose p {
    line-height: 1.75;
}

.prose a {
    color: rgb(96, 165, 250); /* blue-400 */
    text-decoration: underline;
}

.prose a:hover {
    color: rgb(147, 197, 253); /* blue-300 */
}

/* Feedback button active state */
#thumbs-up-btn.active {
    background-color: rgb(22, 163, 74); /* green-600 */
    color: white;
}

#thumbs-down-btn.active {
    background-color: rgb(220, 38, 38); /* red-600 */
    color: white;
}

/* Light mode read modal overrides */
html:not(.dark) #read-modal > div {
    background-color: white;
}

html:not(.dark) #modal-content {
    color: #1e293b;
}

html:not(.dark) #modal-content .text-gray-200,
html:not(.dark) #modal-content .text-gray-300 {
    color: #374151;
}

/* Notification toast animations */
.animate-slide-in {
    animation: slideIn 0.3s ease forwards;
}

.animate-slide-out {
    animation: slideOut 0.3s ease forwards;
}

/* Notification toast styling */
.notification-toast {
    transition: all 0.2s ease;
}

.notification-toast:hover {
    transform: scale(1.02);
}

/* Notification badge pulse animation */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

#notification-badge:not(.hidden) {
    animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   Feed Grid - Enhanced Card Styles
   ============================================ */

/* Feed card base styles */
.feed-card {
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

/* Feed card hover lift effect */
.feed-card:hover {
    transform: translateY(-4px);
}

/* Feed page grid animation */
.feed-page #feed-articles {
    animation: fadeInGrid 0.3s ease-out;
}

@keyframes fadeInGrid {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Infinite scroll loading animation */
#feed-loading-more svg {
    animation: spin 1s linear infinite;
}

/* Gradient overlay for breaking news cards */
.feed-card:has(span:contains("BREAKING"))::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ef4444, #f97316, #ef4444);
    background-size: 200% 100%;
    animation: shimmerGradient 2s linear infinite;
    border-radius: 12px 12px 0 0;
}

@keyframes shimmerGradient {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Staggered animation for grid items */
#feed-articles > .feed-card:nth-child(1) { animation-delay: 0ms; }
#feed-articles > .feed-card:nth-child(2) { animation-delay: 50ms; }
#feed-articles > .feed-card:nth-child(3) { animation-delay: 100ms; }
#feed-articles > .feed-card:nth-child(4) { animation-delay: 150ms; }
#feed-articles > .feed-card:nth-child(5) { animation-delay: 200ms; }
#feed-articles > .feed-card:nth-child(6) { animation-delay: 250ms; }
#feed-articles > .feed-card:nth-child(7) { animation-delay: 300ms; }
#feed-articles > .feed-card:nth-child(8) { animation-delay: 350ms; }
#feed-articles > .feed-card:nth-child(9) { animation-delay: 400ms; }

#feed-articles > .feed-card {
    animation: cardSlideIn 0.4s ease-out backwards;
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Key points bullet styling */
.feed-card li {
    position: relative;
}

/* Topic and entity tag hover effects */
.feed-card span[class*="bg-purple-500"],
.feed-card span[class*="bg-slate-700"],
.feed-card span[class*="bg-blue-500"] {
    transition: all 0.2s ease;
}

.feed-card:hover span[class*="bg-purple-500"] {
    background-color: rgba(168, 85, 247, 0.3);
}

.feed-card:hover span[class*="bg-blue-500"] {
    background-color: rgba(59, 130, 246, 0.3);
}

/* Sentiment badge glow effects */
.feed-card .bg-green-500\/20 {
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}

.feed-card .bg-red-500\/20 {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

.feed-card:hover .bg-green-500\/20 {
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.feed-card:hover .bg-red-500\/20 {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

/* Trending badge fire animation */
.feed-card span[class*="from-orange-500"] {
    animation: fireGlow 2s ease-in-out infinite;
}

@keyframes fireGlow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(249, 115, 22, 0.4);
    }
    50% {
        box-shadow: 0 0 16px rgba(249, 115, 22, 0.6);
    }
}

/* Score badge styles */
.feed-card .text-green-400[class*="font-bold"],
.feed-card .text-blue-400[class*="font-bold"],
.feed-card .text-yellow-400[class*="font-bold"],
.feed-card .text-red-400[class*="font-bold"] {
    text-shadow: 0 0 10px currentColor;
}

/* End of feed indicator */
#feed-end {
    animation: fadeIn 0.5s ease-out;
}

/* Light mode feed card overrides */
html:not(.dark) .feed-card {
    background-color: white;
    border-color: #e2e8f0;
}

html:not(.dark) .feed-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

html:not(.dark) .feed-card h3 {
    color: #1e293b;
}

html:not(.dark) .feed-card p {
    color: #64748b;
}

/* Workers Page Styles */
.workers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.workers-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.workers-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.worker-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.worker-card:hover {
    border-color: #475569;
}

.worker-card.status-online {
    border-left: 3px solid #22c55e;
}

.worker-card.status-offline {
    border-left: 3px solid #ef4444;
}

.worker-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.worker-status {
    font-size: 1rem;
}

.worker-name {
    font-weight: 600;
    color: white;
    flex: 1;
}

.worker-status-text {
    font-size: 0.875rem;
    color: #94a3b8;
    text-transform: capitalize;
}

.worker-info {
    margin-bottom: 1rem;
}

.worker-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
}

.worker-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state p {
    margin-bottom: 0.5rem;
}

/* Modal styles for workers */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-content {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 1rem;
    width: 100%;
    max-width: 28rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-content.modal-lg {
    max-width: 36rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid #334155;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem;
    border-top: 1px solid #334155;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #e2e8f0;
}

.form-group input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #64748b;
    font-size: 0.75rem;
}

.alert {
    padding: 0.875rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fbbf24;
}

.credentials-block {
    margin-top: 1rem;
}

.credentials-block label {
    display: block;
    margin-bottom: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

.credentials-block pre {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.875rem;
    color: #22c55e;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

/* Button styles */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: #334155;
    color: #e2e8f0;
}

.btn:hover {
    background: #475569;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-danger {
    background: transparent;
    color: #f87171;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.text-muted {
    color: #64748b;
}
