/* Saved Queries Panel Styles (Journalist Standard) */
.day-entries-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.day-entries-popup.show {
    opacity: 1;
    visibility: visible;
}

.day-entries-popup .popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.day-entries-popup .popup-content {
    position: relative;
    z-index: 2;
    background: var(--bg-card, #fff);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 80vw;
    max-width: 80vw;
    max-height: 80vh;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.2s ease;
}

.day-entries-popup.show .popup-content {
    transform: translateY(0) scale(1);
}

.day-entries-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary, #667eea) 0%, #764ba2 100%);
    color: white;
}

.day-entries-popup .popup-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.day-entries-popup .popup-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.day-entries-popup .popup-body {
    padding: 16px 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Entry preview items */
.entries-preview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.entry-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.entry-preview-item:hover {
    background: var(--bg-primary, #fff);
    border-color: var(--primary, #667eea);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.mood-dot-lg {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-top: 4px;
}
.mood-dot-lg.mood-query { background-color: #6366f1; } /* Indigo for queries */

.entry-preview-content {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.entry-preview-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
}

.entry-preview-meta {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex: 0 0 auto;
}

.entry-preview-meta .badge {
    font-size: 10px;
    padding: 3px 8px;
    font-weight: 500;
}

.entry-preview-arrow {
    flex-shrink: 0;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: all 0.2s ease;
    padding: 4px;
}

.entry-preview-item:hover .entry-preview-arrow {
    opacity: 1;
}

.entry-preview-arrow:hover {
    color: #ef4444; /* Red for trash on hover */
    transform: scale(1.2);
}

/* Dark mode adjustments */
[data-theme="dark"] .day-entries-popup .popup-content {
    background: var(--bg-card, #1f2937);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .entry-preview-item {
    background: var(--bg-secondary, #374151);
}

[data-theme="dark"] .entry-preview-item:hover {
    background: var(--bg-primary, #1f2937);
}

@media (max-width: 992px) {
    .day-entries-popup .popup-content {
        width: 90vw;
        max-width: 90vw;
    }

    .entry-preview-content {
        display: block;
    }

    .entry-preview-title {
        margin-bottom: 6px;
    }

    .entry-preview-meta {
        flex-wrap: wrap;
    }
}
    border: none;
    padding: 0 0 0 8px;
    cursor: pointer;
    outline: none;
    margin-left: 4px;
    display: flex;
    align-items: center;
}
.saved-query-box .delete-saved-query-btn i {
    color: #e11d48;
    font-size: 1.1em;
}
.saved-queries-list li:last-child {
    border-bottom: none;
}

    /* 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;
    }

    .translation-badge:hover {
        border-color: #6366f1;
        background: rgba(99, 102, 241, 0.05);
        color: #4f46e5;
    }

    .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);
    }

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

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

    /* Synthesis Modal Tabs */
    .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;
    }

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

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

    /* Separatore pipe tra tab buttons */
    .synthesis-modal-tabs> :not(:last-child)::after {
        content: '|';
        margin: 0 0.5rem;
        color: #d1d5db;
        font-weight: 300;
        display: inline-block;
        line-height: 1;
    }

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

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

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    /* Synthesis Content Formatting */
    .synthesis-content {
        padding: 2rem;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.02), rgba(30, 41, 59, 0.02));
        border-radius: 8px;
        margin-bottom: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* Synthesis Modal Specific - NO overflow in content, only in body */
    .synthesis-content.modal-content {
        max-height: none;
        overflow-y: visible;
    }

    /* DEPRECATED: Ora gestito da override specifici in fondo al file */
    /* #synthesis-modal-body {
        padding: 2rem;
        max-height: 60vh;
        overflow-y: auto;
        background: white;
        border-radius: 6px;
    } */

    .synthesis-text {
        font-size: 1rem;
        line-height: 1.8;
        color: #1f2937;
        word-wrap: break-word;
        white-space: pre-wrap;
        overflow-wrap: break-word;
        text-align: left;
        margin-bottom: 1.5rem;
        padding: 1.5rem;
        background: white;
        border-radius: 6px;
        border-left: 4px solid #0ea5e9;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        max-width: 100%;
        display: block;
        letter-spacing: 0.3px;
    }

    /* Markdown rendering styles */
    .synthesis-text h1,
    .synthesis-text h2,
    .synthesis-text h3,
    .synthesis-text h4,
    .synthesis-text h5,
    .synthesis-text h6 {
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
        font-weight: 700;
        color: #0f172a;
        line-height: 1.3;
    }

    .synthesis-text h1 {
        font-size: 1.875rem;
        border-bottom: 2px solid #0ea5e9;
        padding-bottom: 0.5rem;
    }

    .synthesis-text h2 {
        font-size: 1.5rem;
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 0.25rem;
    }

    .synthesis-text h3 {
        font-size: 1.25rem;
    }

    .synthesis-text h4 {
        font-size: 1.1rem;
    }

    .synthesis-text h5,
    .synthesis-text h6 {
        font-size: 1rem;
    }

    .synthesis-text p {
        margin-bottom: 1rem;
    }

    .synthesis-text p:last-child {
        margin-bottom: 0;
    }

    .synthesis-text strong,
    .synthesis-text b {
        font-weight: 700;
        color: #0ea5e9;
    }

    .synthesis-text em,
    .synthesis-text i {
        font-style: italic;
        color: #6366f1;
    }

    .synthesis-text a {
        color: #0ea5e9;
        text-decoration: underline;
        cursor: pointer;
        transition: color 0.2s ease;
    }

    .synthesis-text a:hover {
        color: #0284c7;
        text-decoration: underline;
    }

    .synthesis-text ul,
    .synthesis-text ol {
        margin: 1rem 0 1rem 2rem;
        padding: 0;
    }

    .synthesis-text li {
        margin-bottom: 0.5rem;
        line-height: 1.6;
    }

    .synthesis-text code {
        background: rgba(15, 23, 42, 0.1);
        color: #dc2626;
        padding: 0.25rem 0.5rem;
        border-radius: 3px;
        font-family: 'Courier New', monospace;
        font-size: 0.9rem;
    }

    .synthesis-text pre {
        background: rgba(15, 23, 42, 0.05);
        border: 1px solid rgba(15, 23, 42, 0.1);
        border-radius: 6px;
        padding: 1rem;
        overflow-x: auto;
        margin: 1rem 0;
        line-height: 1.4;
    }

    .synthesis-text pre code {
        background: transparent;
        color: #1f2937;
        padding: 0;
        border-radius: 0;
    }

    .synthesis-text blockquote {
        border-left: 4px solid #6366f1;
        padding-left: 1rem;
        margin: 1rem 0;
        color: #4b5563;
        font-style: italic;
        background: rgba(99, 102, 241, 0.05);
        padding: 0.75rem 1rem;
        border-radius: 4px;
    }

    .synthesis-text table {
        border-collapse: collapse;
        width: 100%;
        margin: 1rem 0;
        border: 1px solid #e5e7eb;
    }

    .synthesis-text th {
        background: rgba(15, 23, 42, 0.05);
        padding: 0.75rem;
        text-align: left;
        font-weight: 700;
        border: 1px solid #e5e7eb;
    }

    .synthesis-text td {
        padding: 0.75rem;
        border: 1px solid #e5e7eb;
    }

    .synthesis-text hr {
        border: none;
        border-top: 2px solid #e5e7eb;
        margin: 2rem 0;
    }

    .synthesis-meta {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
        margin-top: 1rem;
    }

    .synthesis-meta-item {
        padding: 0.75rem 1rem;
        background: rgba(15, 23, 42, 0.05);
        border-radius: 6px;
        border: 1px solid rgba(15, 23, 42, 0.1);
    }

    .synthesis-meta-label {
        font-size: 0.75rem;
        font-weight: 600;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 0.25rem;
    }

    .synthesis-meta-value {
        font-size: 0.9rem;
        color: #1f2937;
        font-weight: 500;
    }

/* News card title wrapping - prevent overflow */
.news-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.news-preview {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1 1 auto;
}

.news-title-block {
    min-width: 0;
    flex: 1 1 auto;
}

.news-title {
    margin: 0;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.news-title a {
    color: inherit;
    text-decoration: none;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.news-title a:hover {
    text-decoration: underline;
}

/* Ensure synthesis button text is readable on hover */
.synthesis-btn:hover,
.synthesis-btn:hover span,
.synthesis-btn:hover i {
    color: #ffffff;
}

/* ========================================
   SYNTHESIS MODAL - OPTIMIZED SPACING
   Override D-One modal defaults for better content readability
   ======================================== */

/* Synthesis Modal: Larger container (80% viewport) */
#synthesis-modal .d-one-modal-container {
    max-width: 80%;
    max-height: 80vh;
}

/* Synthesis Modal: Reduced body padding for more content space */
#synthesis-modal .d-one-modal-body {
    padding: var(--space-3); /* Ridotto da --space-6 */
}

/* Synthesis Modal: NO padding on inner content container */
#synthesis-modal-body {
    padding: 0 !important;
    max-height: none; /* Scrolling gestito dal d-one-modal-body */
    overflow-y: visible;
    background: transparent;
}

/* Synthesis Modal: Language selector compact spacing */
#synthesis-modal .mb-3 {
    margin-bottom: var(--space-3) !important;
}

/* Synthesis Modal: Ensure scrolling works on modal body only */
#synthesis-modal .d-one-modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Responsive: Mobile adjustments */
@media (max-width: 768px) {
    #synthesis-modal .d-one-modal-container {
        max-width: 95%;
        max-height: 90vh;
    }
    
    #synthesis-modal .d-one-modal-body {
        padding: var(--space-2);
    }
}
