/**
 * Personalized Feeds Styles
 * CSS for user preferences and personalization features
 */

/* Preference indicators */
.preference-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 12px;
    z-index: 10;
    opacity: 0.8;
}

.source-preference-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 12px;
    z-index: 10;
    opacity: 0.8;
}

/* Preferred content styling */
.preferred-category {
    position: relative;
    border-left: 3px solid #ffc107 !important;
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.1) 0%, transparent 20%);
}

.preferred-source {
    position: relative;
    border-left: 3px solid #17a2b8 !important;
    background: linear-gradient(90deg, rgba(23, 162, 184, 0.1) 0%, transparent 20%);
}

/* Preferences modal */
.preferences-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preferences-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.preferences-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.preferences-header h3 {
    margin: 0;
    color: #495057;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #495057;
}

.preferences-body {
    padding: 20px;
}

.preference-section {
    margin-bottom: 30px;
}

.preference-section h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 16px;
}

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

.preference-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    transition: all 0.2s;
}

.preference-item:hover {
    background: #e9ecef;
}

.preference-item.active {
    background: #e3f2fd;
    border-color: #2196f3;
}

.preference-toggle {
    margin-right: 8px;
}

.preference-label {
    flex: 1;
    font-size: 14px;
    color: #495057;
}

.preference-weight {
    font-size: 12px;
    color: #6c757d;
    margin-left: 8px;
}

/* Theme preferences */
#theme-preferences {
    display: flex;
    gap: 20px;
}

#theme-preferences label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
}

#theme-preferences label:hover {
    background: #f8f9fa;
}

#theme-preferences input[type="radio"] {
    margin-right: 8px;
}

.preferences-footer {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auto-learn-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.auto-learn-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    z-index: 1060;
    animation: slideInRight 0.3s ease;
}

.notification-success {
    background: #28a745;
}

.notification-error {
    background: #dc3545;
}

.notification-info {
    background: #17a2b8;
}

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

/* Dark theme support */
[data-theme="dark"] .preferences-modal-content {
    background: #2c3e50;
    color: #ecf0f1;
}

[data-theme="dark"] .preferences-header {
    border-bottom-color: #34495e;
}

[data-theme="dark"] .preferences-header h3 {
    color: #ecf0f1;
}

[data-theme="dark"] .close-modal {
    color: #ecf0f1;
}

[data-theme="dark"] .close-modal:hover {
    color: #ffffff;
}

[data-theme="dark"] .preferences-footer {
    border-top-color: #34495e;
}

[data-theme="dark"] .preference-section h4 {
    color: #ecf0f1;
}

[data-theme="dark"] .preference-section h6 {
    color: #cbd5e0;
}

[data-theme="dark"] .preference-item {
    background: #34495e;
    border-color: #4a5f7a;
    color: #ecf0f1;
}

[data-theme="dark"] .preference-item:hover {
    background: #4a5f7a;
}

[data-theme="dark"] .preference-item.active {
    background: #3498db;
    border-color: #2980b9;
}

[data-theme="dark"] .preference-label {
    color: #ecf0f1;
}

[data-theme="dark"] .preference-weight {
    color: #cbd5e0;
}

[data-theme="dark"] #theme-preferences label {
    background: #34495e;
    border-color: #4a5f7a;
    color: #ecf0f1;
}

[data-theme="dark"] #theme-preferences label:hover {
    background: #4a5f7a;
}

/* Responsive design */
@media (max-width: 768px) {
    .preferences-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .preferences-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .preference-grid {
        grid-template-columns: 1fr;
    }
    
    #theme-preferences {
        flex-direction: column;
        gap: 10px;
    }
}

/* Personalized feed indicators in article cards */
.article-card.preferred-category::before {
    content: "⭐";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 14px;
    z-index: 5;
}

.article-card.preferred-source::before {
    content: "🌟";
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 14px;
    z-index: 5;
}

/* Preferences button in navigation */
.preferences-btn {
    position: relative;
}

.preferences-btn::before {
    content: "";
    margin-right: 0;
}

/* Preference control buttons */
.preference-controls {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.article-card:hover .preference-controls {
    opacity: 1;
}

.preference-btn {
    padding: 2px 6px !important;
    font-size: 11px;
    border-width: 1px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preference-btn i {
    font-size: 10px;
}

.preference-btn:hover {
    transform: scale(1.1);
}

.preference-btn.active-positive {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.preference-btn.active-negative,
.preference-btn.active-hidden {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
    opacity: 1 !important;
}

/* Hidden articles */
.article-card.hidden-by-preference {
    display: none !important;
}

/* Preference indicators */
.article-card.preferred-category .badge {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.article-card.blocked-category {
    opacity: 0.5;
    filter: grayscale(100%);
}

.article-card.blocked-source {
    opacity: 0.3;
    filter: grayscale(100%);
}

/* Filter controls */
#filter-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    max-height: 120px;
}

.filter-group select[multiple] {
    height: auto;
    min-height: 80px;
}

.filter-group .btn {
    margin-right: 8px;
    margin-bottom: 5px;
}

/* Dark theme filter controls */
[data-theme="dark"] #filter-controls {
    background: #34495e;
    border-color: #4a5f7a;
}

[data-theme="dark"] .filter-group label {
    color: #ecf0f1;
}

[data-theme="dark"] .filter-group select {
    background: #2c3e50;
    border-color: #4a5f7a;
    color: #ecf0f1;
}

[data-theme="dark"] .filter-group select option {
    background: #2c3e50;
    color: #ecf0f1;
}

/* Loading states */
.preference-loading {
    opacity: 0.6;
    pointer-events: none;
}

.preference-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Filter indicators */
.filter-active {
    position: relative;
}

.filter-active::after {
    content: "🔍";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hidden preferences section */
#hidden-preferences h6 {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 8px;
}

.hidden-item {
    font-size: 13px;
    border: 1px solid #dee2e6;
}

.hidden-item .btn {
    font-size: 11px;
    padding: 3px 8px;
}

.hidden-item span {
    color: #495057;
}

[data-theme="dark"] .hidden-item {
    background: #34495e !important;
    border-color: #4a5f7a !important;
    color: #ecf0f1 !important;
}

[data-theme="dark"] .hidden-item span {
    color: #ecf0f1 !important;
}

[data-theme="dark"] #hidden-preferences h6 {
    color: #cbd5e0;
}

[data-theme="dark"] .text-muted {
    color: #a0aec0 !important;
}

[data-theme="dark"] .preferences-modal-content .text-muted {
    color: #a0aec0 !important;
}