/* AI News Dashboard - Stili ottimizzati */


/* Search Bar Modern Layout */
.search-bar-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    min-height: 38px;
}
.search-bar-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
    opacity: 0.7;
    z-index: 2;
}
.search-bar-wrapper .search-input {
    flex: 1;
    padding: 0.4rem 1rem 0.4rem 2.5rem;
    border: none;
    border-radius: 18px 0 0 18px;
    font-size: 0.95rem;
    background: transparent;
    color: var(--text-primary);
    min-height: 38px;
    box-shadow: none;
}
.search-bar-wrapper .search-input:focus {
    outline: none;
    background: rgba(14,165,233,0.07);
}
.search-bar-wrapper .search-execute-btn {
    background: var(--control-btn-bg);
    border: none;
    color: var(--control-btn-text);
    border-radius: 0 18px 18px 0;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: var(--transition);
}
.search-bar-wrapper .search-execute-btn:focus,
.search-bar-wrapper .search-execute-btn:hover {
    background: var(--control-btn-hover-bg);
    color: #0ea5e9;
    outline: 2px solid #0ea5e9;
}
.search-bar-wrapper .search-execute-btn i {
    font-size: 1.2rem;
    margin: 0;
}
@media (max-width: 768px) {
    .search-bar-wrapper {
        flex-direction: row;
        width: 100%;
        border-radius: 14px;
    }
    .search-bar-wrapper .search-input {
        font-size: 0.9rem;
        padding-left: 2.2rem;
    }
    .search-bar-wrapper .search-execute-btn {
        min-width: 38px;
        padding: 0.4rem 0.7rem;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #333;
    --text-secondary: #666;
    --border-radius: 20px;
    --transition: all 0.3s ease;
    --filter-btn-bg: rgba(255, 255, 255, 0.9);
    --filter-btn-border: rgba(0, 0, 0, 0.1);
    --filter-btn-text: #334155;
    --filter-btn-hover-bg: rgba(226, 232, 240, 0.95);
    --filter-btn-hover-border: rgba(0, 0, 0, 0.15);
    --filter-btn-active-bg: rgba(203, 213, 225, 0.95);
    --filter-btn-active-border: rgba(0, 0, 0, 0.2);
    --filter-btn-active-text: #1e293b;
    --control-btn-bg: rgba(255, 255, 255, 0.9);
    --control-btn-border: rgba(0, 0, 0, 0.1);
    --control-btn-text: #334155;
    --control-btn-hover-bg: rgba(226, 232, 240, 0.95);
    --control-btn-hover-border: rgba(0, 0, 0, 0.15);
    --control-btn-active-bg: rgba(203, 213, 225, 0.95);
    --control-btn-active-border: rgba(0, 0, 0, 0.2);
    --control-btn-active-text: #1e293b;
}

[data-theme="dark"] {
    --primary-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    --card-bg: rgba(30, 41, 59, 0.95);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --filter-btn-bg: rgba(255, 255, 255, 0.2);
    --filter-btn-border: rgba(255, 255, 255, 0.3);
    --filter-btn-text: white;
    --filter-btn-hover-bg: rgba(255, 255, 255, 0.35);
    --filter-btn-hover-border: rgba(255, 255, 255, 0.45);
    --filter-btn-active-bg: rgba(255, 255, 255, 0.5);
    --filter-btn-active-border: rgba(255, 255, 255, 0.6);
    --filter-btn-active-text: white;
    --control-btn-bg: rgba(255, 255, 255, 0.2);
    --control-btn-border: rgba(255, 255, 255, 0.3);
    --control-btn-text: white;
    --control-btn-hover-bg: rgba(255, 255, 255, 0.35);
    --control-btn-hover-border: rgba(255, 255, 255, 0.45);
    --control-btn-active-bg: rgba(255, 255, 255, 0.5);
    --control-btn-active-border: rgba(255, 255, 255, 0.6);
    --control-btn-active-text: white;
}

/* News page specific dark-mode fix:
   style.css tools-section overrides --bg-card with tools tokens that are undefined,
   causing white header and quick-nav container. */
html[data-theme="dark"] .tools-section {
    --tools-surface: #0f172a;
    --tools-border: #334155;
    --bg-card: #0f172a;
    --border-color: #334155;
}



/* Stili specifici per News Dashboard */



.top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.7rem;
    min-height: 38px;
}

.search-container {
    position: relative;
    flex: 0 0 auto;
    max-width: 500px;
    width: 500px;
    display: flex;
    align-items: center;
    min-height: 0;
}

.search-input {
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 2px solid var(--filter-btn-border);
    padding: 0.4rem 1rem 0.4rem 2.2rem;
    border-radius: 18px 0 0 18px;
    font-size: 0.9rem;
    width: 100%;
    transition: var(--transition);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 38px;
}

.search-execute-btn {
    background: var(--control-btn-bg);
    border: 2px solid var(--control-btn-border);
    color: var(--control-btn-text);
    padding: 0.4rem 1rem;
    border-radius: 0 18px 18px 0;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-left: -2px;
    min-height: 38px;
}

.search-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.3), 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
    opacity: 0.7;
}

.action-controls {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    min-height: 38px;
}

.control-btn {
    background: var(--control-btn-bg);
    border: 2px solid var(--control-btn-border);
    color: var(--control-btn-text);
    padding: 0.4rem 0.7rem;
    border-radius: 18px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 38px;
}

.control-btn:hover {
    background: var(--control-btn-hover-bg);
    border-color: var(--control-btn-hover-border);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.control-btn.active {
    background: var(--control-btn-active-bg);
    color: var(--control-btn-active-text);
    border-color: var(--control-btn-active-border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

/* Filtri */
.filter-container {
    margin-bottom: 2rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-btn {
    background: var(--filter-btn-bg);
    border: 2px solid var(--filter-btn-border);
    color: var(--filter-btn-text);
    padding: 0.4rem 0.4rem;
    border-radius: 15px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    position: relative;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--category-color, #0ea5e9);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.filter-btn:hover::before,
.filter-btn.active::before {
    transform: scaleX(1);
}

.filter-btn i {
    opacity: 0.8;
    transition: var(--transition);
    font-size: 0.7rem;
}

.filter-btn:hover i {
    opacity: 1;
}

.filter-btn.active i {
    opacity: 1;
}

/* Stili per control-btn icons */
.control-btn i {
    opacity: 0.8;
    transition: var(--transition);
}

.control-btn:hover i {
    opacity: 1;
}

.control-btn.active i {
    opacity: 1;
}

/* Pill Style Selects (News Limit & Period) */
.action-controls .form-select.form-select-sm {
    background: var(--control-btn-bg);
    border: 2px solid var(--control-btn-border);
    color: var(--control-btn-text);
    border-radius: 18px;
    padding: 0.4rem 1.8rem 0.4rem 0.75rem; /* spazio per caret */
    font-weight: 600;
    min-height: 38px;
    line-height: 1.1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    background-image: linear-gradient(45deg, transparent 50%, var(--control-btn-text) 50%),
                      linear-gradient(135deg, var(--control-btn-text) 50%, transparent 50%);
    background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: var(--transition);
}

/* Width utilities for selects (avoid inline styles) */
.news-select-limit { min-width:120px; }
.news-select-period { min-width:140px; }
.news-select-provider { min-width:180px; }

.action-controls .form-select.form-select-sm:hover {
    background-color: var(--control-btn-hover-bg);
    border-color: var(--control-btn-hover-border);
}

.action-controls .form-select.form-select-sm:focus {
    border-color: var(--control-btn-active-border);
    box-shadow: 0 0 0 2px rgba(14,165,233,0.35);
    outline: none;
}

[data-theme="dark"] .action-controls .form-select.form-select-sm {
    background-image: linear-gradient(45deg, transparent 50%, var(--control-btn-text) 50%),
                      linear-gradient(135deg, var(--control-btn-text) 50%, transparent 50%);
}

.action-controls .form-select.form-select-sm:active {
    transform: scale(0.97);
}

.action-controls .form-select.form-select-sm option {
    color: #111;
}

[data-theme="dark"] .action-controls .form-select.form-select-sm option {
    color: #fff;
    background: #1e293b;
}

.filter-btn:hover {
    background: var(--filter-btn-hover-bg);
    border-color: var(--filter-btn-hover-border);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.filter-btn.active {
    background: var(--filter-btn-active-bg);
    color: var(--filter-btn-active-text);
    border-color: var(--filter-btn-active-border);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    font-weight: 700;
}

.filter-badge {
    background: var(--category-color, #0ea5e9);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.5rem;
    margin-left: auto;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    align-self: center;
}

.filter-btn.active .filter-badge {
    opacity: 1;
    font-weight: 600;
}

.filter-btn:hover .filter-badge {
    opacity: 0.9;
}


.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

/* Card notizie */
.news-card {
    background: var(--card-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border-top: 4px solid var(--category-color, #0ea5e9);
    display: flex;
    flex-direction: column;
    min-height: 350px; /* Altezza minima per uniformità */
}

.news-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.news-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.delete-btn {
    background: transparent;
    border: 2px solid #ef4444;
    color: #ef4444;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
    opacity: 0.7;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
    opacity: 1;
}

.delete-btn:active {
    transform: scale(0.95);
}

.news-category {
    background: var(--category-color, #0ea5e9);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.action-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.action-icon:hover {
    background: var(--category-color, #0ea5e9);
    color: white;
    transform: scale(1.1);
}

.news-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.news-summary {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.live-news-card .news-summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
    min-height: calc(1.6em * 5);
}

/* Compact link preview to avoid showing long raw URLs */
.link-preview {
    margin: 0.5rem 0 1rem 0;
}
.link-preview-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(0,0,0,0.03);
    padding: 0.45rem 0.6rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.04);
}
.link-preview-inner:hover {
    background: rgba(14,165,233,0.06);
    color: var(--category-color, #0ea5e9);
}
.link-favicon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--category-color, #0ea5e9);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.link-meta {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    line-height: 1.1;
}
.link-domain {
    font-weight: 700;
    color: var(--text-primary);
}
.link-path {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.link-external-icon {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Prevent long URL fragments from breaking layout */
.news-summary, .link-path {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Header preview styles */
.news-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.6rem;
}
.news-preview {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}
.news-preview-img {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    border: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.news-preview-fallback {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--category-color, #0ea5e9);
    color: white;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 1.2rem;
}
.news-title-block {
    max-width: calc(100% - 56px);
}
.news-title a {
    color: var(--text-primary);
    text-decoration: none;
}
.news-title a:hover {
    text-decoration: underline;
}
.news-title {
    margin: 0;
    font-size: 1.05rem;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.news-source {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.source-link {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    margin: -0.2rem -0.4rem;
}

.source-link:hover {
    color: var(--category-color, #0ea5e9);
    text-decoration: underline;
    background: rgba(14, 165, 233, 0.1);
}

.source-logo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--category-color, #0ea5e9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.news-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.news-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.news-tag {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

/* Footer cards */
.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
}

.read-more-btn {
    background: var(--category-color, #0ea5e9);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.read-more-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    color: white;
}

/* Unify button heights */
.read-more-btn, .synthesis-btn {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

/* Synthesis Buttons Styles */
.synthesis-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.synthesis-btn {
    background: transparent;
    border: 2px solid var(--category-color, #0ea5e9);
    color: var(--category-color, #0ea5e9);
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
}

.synthesis-btn:hover {
    background: var(--category-color, #0ea5e9);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(14, 165, 233, 0.3);
}

.synthesis-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.synthesis-btn.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.3rem;
}

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

/* Colori per tipi sintesi */
.synthesis-btn.short { border-color: #10b981; color: #10b981; }
.synthesis-btn.medium { border-color: #f59e0b; color: #f59e0b; }
.synthesis-btn.full { border-color: #ef4444; color: #ef4444; }

.synthesis-btn.short:hover { background: #10b981; }
.synthesis-btn.medium:hover { background: #f59e0b; }
.synthesis-btn.full:hover { background: #ef4444; }

/* Stile invertito per pulsanti con sintesi già esistente */
.synthesis-btn.synthesis-exists.short {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.synthesis-btn.synthesis-exists.short:hover {
    background: #059669;
    color: white;
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

.synthesis-btn.synthesis-exists.medium {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.synthesis-btn.synthesis-exists.medium:hover {
    background: #d97706;
    color: white;
    border-color: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 158, 11, 0.3);
}

.synthesis-btn.synthesis-exists.full {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.synthesis-btn.synthesis-exists.full:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

/* Responsive layout for mobile */
@media (max-width: 768px) {
    .news-footer {
        flex-direction: column;
        gap: 0.8rem;
        align-items: stretch;
    }

    .synthesis-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .read-more-btn, .synthesis-btn {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .synthesis-buttons {
        gap: 0.3rem;
    }

    .read-more-btn, .synthesis-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
        height: 32px;
    }
}

/* Modal Sintesi */
.synthesis-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.synthesis-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.synthesis-modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.9) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.synthesis-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.synthesis-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.synthesis-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.synthesis-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.synthesis-content {
    margin-bottom: 1.5rem;
}

.synthesis-text {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 1rem;
    margin-bottom: 1rem;
    white-space: pre-wrap;
}

.synthesis-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: rgba(14, 165, 233, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
}

.synthesis-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.synthesis-meta-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.synthesis-meta-value {
    color: var(--text-primary);
    font-weight: 500;
}

.synthesis-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.synthesis-action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.synthesis-action-btn.primary {
    background: var(--category-color, #0ea5e9);
    color: white;
}

.synthesis-action-btn.secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.synthesis-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Loading state for synthesis */
.synthesis-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    text-align: center;
    min-height: 200px;
}

.synthesis-spinner {
    width: 32px;
    height: 32px;
    border: 4px solid rgba(14, 165, 233, 0.3);
    border-top: 4px solid #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 0.5rem;
}

/* Delete Confirmation Modal */
.delete-modal {
    display: none;
    position: fixed;
    z-index: 11000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.delete-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    text-align: center;
}

.delete-modal-icon {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.delete-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.delete-modal-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.delete-modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.delete-modal-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.delete-modal-btn.cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.delete-modal-btn.cancel:hover {
    background: rgba(0, 0, 0, 0.05);
}

.delete-modal-btn.confirm {
    background: #ef4444;
    color: white;
}

.delete-modal-btn.confirm:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

/* Utilities */
.sentiment-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.sentiment-positive { color: #10b981; }
.sentiment-neutral { color: #6b7280; }
.sentiment-negative { color: #ef4444; }

.loading-container {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-left: 4px solid #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.stats-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
}

.stat-card {
    background: var(--card-bg);
    padding: 0.4rem 0.7rem;
    border-radius: 15px;
    text-align: center;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    flex: 1 1 0;
    white-space: nowrap;
}

.stat-number {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--category-color, #0ea5e9);
    margin-bottom: 0.2rem;
    white-space: nowrap;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 1rem;
    white-space: nowrap;
}

/* Category Colors */
.breaking { --category-color: #ef4444; }
.research { --category-color: #8b5cf6; }
.products { --category-color: #10b981; }
.ai { --category-color: #f59e0b; }
.robotics { --category-color: #0ea5e9; }
.regulatory { --category-color: #6b7280; }
.opensource { --category-color: #06b6d4; }
.funding { --category-color: #ec4899; }
.events { --category-color: #84cc16; }
.tools { --category-color: #f97316; }
.ethics { --category-color: #7c3aed; }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Media queries responsive */
@media (max-width: 768px) {
    .news-hero {
        padding: 0.025rem 0 0.375rem;
        margin-bottom: 1rem;
    }
    
    .news-hero h1 {
        font-size: 1.5rem !important;
    }
    
    .news-hero p {
        font-size: 0.85rem !important;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .top-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        min-width: 350px;
        max-width: 100%;
        width: 100%;
    }
}

.hidden {
    display: none !important;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

.news-card {
    animation: slideUp 0.6s ease forwards;
}

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

.refresh-btn.loading {
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bookmarked {
    color: #f59e0b !important;
}

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

.footer {
    background-color: #343a40;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

/* Gradiente speciale per News Dashboard - uniforme con KB */
.news-gradient {
    background: linear-gradient(135deg, #f8f8f5 0%, #f8f8f6 50%, #f4f3f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

/* Additional utility classes for inline style replacements */
.hero-padding {
    padding: 10px 2rem;
}

.hero-icon-color {
    color: #fffffd;
}

.hero-subtitle {
    font-size: 0.95rem;
}

.search-provider-compact {
    margin: 8px;
    max-width: 100px;
}

.search-input-wide {
    min-width: 500px;
}

.content-divider {
    margin: 2rem 0;
}

/* Ottimizzazioni per inline styles da evitare */
.padding-container {
    padding: 10px 2rem;
}

.brain-icon-white {
    color: #fffffd;
}

.small-font {
    font-size: 0.95rem;
}

.search-provider-select {
    margin: 8px;
    max-width: 100px;
}

.search-input-extended {
    min-width: 500px;
}

.hr-spacing {
    margin: 2rem 0;
}

/* ========================================
   CATEGORY MANAGEMENT MODAL
   ======================================== */

.category-info {
    margin-bottom: 1.5rem;
}

.article-title-preview {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.current-category-display {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

.current-category-display #current-category-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.auto-detected-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-style: italic;
}

.category-selector-container {
    margin: 1.5rem 0;
}

.category-selector-container label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.category-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-select:hover {
    border-color: var(--accent-color);
}

.category-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.category-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Badge categoria cliccabile */
.news-category:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.news-category {
    transition: all 0.2s ease;
}
/* ==================================================================================
   SYNTHESIS MODAL TABS & TRANSLATIONS
   ================================================================================== */

.synthesis-modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin: 0;
    padding: 0;
}

.synthesis-modal-tab-btn {
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-weight: 500;
    position: relative;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.synthesis-modal-tab-btn:hover {
    color: #374151;
}

.synthesis-modal-tab-btn.active {
    color: #0ea5e9;
    border-bottom-color: #0ea5e9;
}

.synthesis-modal-tab-content {
    display: none;
    animation: fadeInTab 0.3s ease;
}

.synthesis-modal-tab-content.active {
    display: block;
}

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

/* Translation Badge Styles */
.translation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    color: #374151;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 0.3rem;
}

.translation-badge:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
    color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.translation-badge-saved {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
    color: #059669;
}

.translation-badge-saved:hover {
    border-color: #059669;
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.translation-badge-available {
    border-color: #6366f1;
    color: #4f46e5;
}

.translation-badge i {
    font-size: 1rem;
    margin-left: 0.25rem;
}

/* Translation result cards (theme-aware, no inline hardcoded colors) */
.translation-card {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--text-primary);
}

.translation-card--loading {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}

.translation-card--success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
}

.translation-card--error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}

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

.translation-card--loading .translation-card-header {
    color: #1d4ed8;
}

.translation-card--success .translation-card-header {
    color: #15803d;
}

.translation-card--error .translation-card-header {
    color: #dc2626;
}

.translation-card-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
}

.translation-card-meta {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.translation-card-message {
    color: var(--text-primary);
}

.translation-card-message--center {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.translation-card-content {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    max-height: 300px;
    overflow-y: auto;
}

.translation-card-content * {
    color: inherit;
}

[data-theme="dark"] .translation-card-content {
    background: rgba(15, 23, 42, 0.9);
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .translation-card--loading .translation-card-header {
    color: #60a5fa;
}

[data-theme="dark"] .translation-card--success .translation-card-header {
    color: #4ade80;
}

[data-theme="dark"] .translation-card--error .translation-card-header {
    color: #f87171;
}
