/* ═══════════════════════════════════════════════════════════════════════════
   ADVANCEMENTS FOR ME — Magazine-Style Research Feed
   ═══════════════════════════════════════════════════════════════════════════ */

.adv-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
.adv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.adv-header-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}
.adv-header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #4b5563;
}
.adv-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.adv-refresh-btn:hover { background: linear-gradient(135deg, #0f766e, #0a5f55); box-shadow: 0 2px 8px rgba(74,144,217,0.3); }
.adv-refresh-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.adv-refresh-btn.refreshing .adv-refresh-icon { animation: adv-spin 1s linear infinite; }
@keyframes adv-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.adv-settings-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
}
.adv-settings-btn:hover { background: #e5e7eb; border-color: #6b7280; }

/* Refresh progress banner */
.adv-progress {
    background: linear-gradient(135deg, #f0fdfa, #f3e5f5);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.adv-progress-bar {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}
.adv-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #7c4dff);
    border-radius: 3px;
    transition: width 0.5s ease;
    animation: adv-shimmer 1.5s infinite;
}
@keyframes adv-shimmer {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}
.adv-progress-text {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}

/* Category tabs */
.adv-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}
.adv-tabs::-webkit-scrollbar { height: 3px; }
.adv-tabs::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.adv-tab {
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.adv-tab:hover { border-color: #6b7280; color: #333; }
.adv-tab.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.adv-tab-badge {
    display: inline-block;
    background: #f44336;
    color: #fff;
    font-size: 12px;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 600;
}

/* Philosophy filter pills */
.adv-philosophy-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.adv-philosophy-label {
    font-size: 12px;
    color: #4b5563;
    font-weight: 500;
}
.adv-philosophy-pill {
    padding: 4px 12px;
    border: 1px solid #ddd;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    color: #666;
    transition: all 0.15s;
}
.adv-philosophy-pill:hover { border-color: #4b5563; }
.adv-philosophy-pill.active { background: #e8f5e9; color: #2e7d32; border-color: #81c784; }

/* Feed grid */
.adv-feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Article card */
.adv-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
    position: relative;
}
.adv-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-1px); }

/* Category color stripe */
.adv-card--management { border-top: 3px solid #0d9488; }
.adv-card--home_management { border-top: 3px solid #66bb6a; }
.adv-card--quality_of_life { border-top: 3px solid #ab47bc; }
.adv-card--symptom_management { border-top: 3px solid #ff7043; }
.adv-card--understanding { border-top: 3px solid #26c6da; }
.adv-card--ai_insight { border-top: 3px solid #ffd54f; }

.adv-card-body { padding: 14px 16px; }

/* Source badge */
.adv-card-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}
.adv-source--pubmed { background: #f0fdfa; color: #0d9488; }
.adv-source--arxiv { background: #fce4ec; color: #c62828; }
.adv-source--biorxiv { background: #e8f5e9; color: #2e7d32; }
.adv-source--medrxiv { background: #fff3e0; color: #e65100; }
.adv-source--news { background: #f3e5f5; color: #7b1fa2; }
.adv-source--ai { background: linear-gradient(135deg, #ffd54f, #ffb74d); color: #5d4037; }

/* Unread dot */
.adv-card-unread {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: #0d9488;
    border-radius: 50%;
}

.adv-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.adv-card-summary {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.adv-card-relevance {
    font-size: 12px;
    color: #0d9488;
    font-style: italic;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #f0fdfa;
    border-radius: 6px;
    border-left: 2px solid #0d9488;
}

/* Condition pills */
.adv-card-conditions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.adv-condition-pill {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 8px;
    background: #f0f0f0;
    color: #666;
}

/* Card footer (date + actions) */
.adv-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}
.adv-card-date {
    font-size: 12px;
    color: #4b5563;
}
.adv-card-actions {
    display: flex;
    gap: 8px;
}
.adv-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
    color: #4b5563;
}
.adv-action-btn:hover { background: #eee; color: #333; }
.adv-action-btn.saved { color: #f57f17; }
.adv-action-btn.discuss:hover { color: #0d9488; }

/* AI Insight card (special) */
.adv-card--insight {
    grid-column: span 2;
    border: 2px solid transparent;
    background: linear-gradient(#fff, #fff) padding-box,
                linear-gradient(135deg, #ffd54f, #7c4dff, #0d9488) border-box;
    border-radius: 12px;
}
.adv-insight-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.adv-insight-icon { font-size: 20px; }
.adv-insight-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #7c4dff;
}
.adv-insight-badges {
    display: flex;
    gap: 6px;
    margin-left: auto;
}
.adv-insight-badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
}
.adv-insight-badge--confidence { background: #e8f5e9; color: #2e7d32; }
.adv-insight-badge--novelty { background: #f0fdfa; color: #0d9488; }
.adv-insight-text {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 10px;
}
.adv-insight-citations {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.adv-insight-cite {
    font-size: 12px;
    color: #555;
    padding: 4px 8px;
    background: #fafafa;
    border-radius: 4px;
    border-left: 2px solid #7c4dff;
}
.adv-insight-cite a { color: #0d9488; text-decoration: none; }
.adv-insight-cite a:hover { text-decoration: underline; }

/* Expanded article detail */
.adv-card-detail {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fafafa;
    font-size: 13px;
    color: #444;
    line-height: 1.6;
}
.adv-card-abstract-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #4b5563;
    margin-bottom: 4px;
}
.adv-card-url {
    display: inline-block;
    margin-top: 8px;
    color: #0d9488;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}
.adv-card-url:hover { text-decoration: underline; }

/* Empty state */
.adv-empty {
    text-align: center;
    padding: 60px 20px;
    color: #4b5563;
}
.adv-empty-icon { font-size: 48px; margin-bottom: 12px; }
.adv-empty h3 { margin-bottom: 8px; color: #555; }
.adv-empty p { max-width: 400px; margin: 0 auto; line-height: 1.5; }

/* Loading */
.adv-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
.adv-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #0d9488;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: adv-spin 0.8s linear infinite;
}

/* Load more */
.adv-load-more {
    text-align: center;
    padding: 16px;
}
.adv-load-more-btn {
    padding: 10px 24px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #555;
    font-size: 13px;
    cursor: pointer;
}
.adv-load-more-btn:hover { background: #e5e7eb; border-color: #6b7280; }

/* Preferences modal */
.adv-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.adv-modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    overflow: hidden;
}
.adv-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
}
.adv-modal-header h3 { margin: 0; font-size: 16px; }
.adv-modal-close {
    background: none; border: none; font-size: 20px; cursor: pointer; color: #4b5563;
}
.adv-modal-body { padding: 16px 20px; }
.adv-modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 20px; border-top: 1px solid #eee;
}
.adv-pref-section { margin-bottom: 16px; }
.adv-pref-section h4 {
    font-size: 13px; font-weight: 600; color: #555; margin: 0 0 8px;
}
.adv-pref-options {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.adv-pref-option {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border: 1px solid #ddd; border-radius: 8px;
    cursor: pointer; font-size: 12px; transition: all 0.15s;
}
.adv-pref-option:hover { border-color: #4b5563; }
.adv-pref-option.selected { background: #e8f5e9; border-color: #4caf50; color: #2e7d32; }
.adv-pref-option input[type="checkbox"] { accent-color: #4caf50; }

/* Session selector modal for Discuss */
.adv-session-list {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.adv-session-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.15s;
}
.adv-session-option:hover { background: #e5e7eb; }
.adv-session-option--new {
    color: #0d9488;
    font-weight: 600;
    border-style: dashed;
}

/* Responsive */
@media (max-width: 768px) {
    .adv-feed-grid { grid-template-columns: 1fr; }
    .adv-card--insight { grid-column: span 1; }
    .adv-header { flex-direction: column; align-items: flex-start; }
    .adv-tabs { gap: 2px; }
}
