/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

h1 {
    color: #2c3e50;
    font-size: 2rem;
}

.refresh-btn {
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.refresh-btn:hover {
    background-color: #2980b9;
}

/* Navigation */
nav {
    margin-bottom: 30px;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.nav-link {
    display: inline-block;
    padding: 10px 20px;
    margin-right: 10px;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: #2980b9;
}

/* Loading and Error States */
.loading,
.error {
    text-align: center;
    padding: 40px;
    margin: 20px 0;
}

.error {
    background-color: #fee;
    color: #c00;
    border-radius: 8px;
}

.hidden {
    display: none;
}

/* Simple List */
.simple-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.list-item {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.list-item h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.list-item p {
    margin-bottom: 8px;
    color: #555;
}

.list-item a {
    color: #3498db;
    text-decoration: none;
}

.list-item a:hover {
    text-decoration: underline;
}

/* Article-specific styling */
.article-header {
    margin-bottom: 12px;
}

.article-header h3 {
    margin-bottom: 6px;
}

.article-meta {
    font-size: 0.9em;
    color: #6c757d;
}

.meta-separator {
    margin: 0 8px;
}

.article-essentials {
    margin-bottom: 12px;
}

.category-rankings-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.category-rank-compact {
    font-size: 0.9em;
    font-weight: 500;
    padding: 3px 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.category-rank-compact span {
    font-weight: bold;
}

.forex-impact-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.impact-label {
    font-weight: 500;
    color: #495057;
}

.instrument-compact {
    padding: 2px 8px;
    background-color: #e9ecef;
    border-radius: 12px;
}

.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.article-link {
    color: #3498db;
    text-decoration: none;
    font-size: 0.95em;
}

.article-link:hover {
    text-decoration: underline;
}

.toggle-details {
    background: none;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.toggle-details:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.toggle-icon {
    font-size: 0.8em;
    transition: transform 0.2s;
}

.toggle-details.expanded .toggle-icon {
    transform: rotate(180deg);
}

.article-details {
    margin-top: 15px;
    padding-top: 15px;
}

.details-divider {
    border-top: 1px solid #dee2e6;
    margin-bottom: 15px;
}

.detail-section {
    margin-bottom: 15px;
}

.detail-section strong {
    display: block;
    margin-bottom: 8px;
    color: #495057;
}

.detail-section p {
    margin: 0;
    color: #6c757d;
    line-height: 1.5;
}

.instruments-list-detailed {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instrument-detailed {
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.instrument-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.db-fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.db-fields-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #e9ecef;
}

.db-fields-table td:first-child {
    font-weight: 500;
    color: #495057;
    width: 140px;
}

.db-fields-table td:last-child {
    color: #6c757d;
}

.article-summary {
    margin: 10px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-left: 3px solid #3498db;
    font-style: italic;
}

.sentiment-section {
    margin: 8px 0;
}

.sentiment-score {
    font-size: 1.1em;
}

.category-rankings-section {
    margin: 12px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.category-rankings {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0;
}

.category-rank {
    display: inline-block;
    padding: 4px 8px;
    background-color: white;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #e9ecef;
}

.primary-category {
    margin-top: 8px;
}

.category-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: capitalize;
}

.category-badge.technical {
    background-color: #e3f2fd;
    color: #1976d2;
}

.category-badge.sentimental {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.category-badge.fundamentals {
    background-color: #e8f5e8;
    color: #388e3c;
}

/* Filter Controls */
.filters-section {
    margin: 20px 0;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1rem;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 120px;
}

.filter-btn {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.filter-btn:hover {
    background-color: #2980b9;
}

.filter-btn.secondary {
    background-color: #95a5a6;
}

.filter-btn.secondary:hover {
    background-color: #7f8c8d;
}

.categories-section {
    margin: 10px 0;
}

.category-tag {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.forex-instruments {
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.instruments-list {
    margin-top: 8px;
}

.instrument-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e9ecef;
}

.instrument-item:last-child {
    border-bottom: none;
}

.instrument-name {
    font-weight: bold;
    color: #2c3e50;
    margin-right: 12px;
    min-width: 80px;
}

.instrument-sentiment {
    margin-right: 12px;
    font-size: 0.95em;
}

.instrument-reasoning {
    color: #6c757d;
    font-size: 0.9em;
    flex: 1;
    margin-left: auto;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.85rem;
}

/* Success Message */
.success {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    background-color: #d4edda;
    color: #155724;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
}

/* News Sources Specific */
.news-sources-header {
    margin-bottom: 20px;
}

.news-source-item {
    position: relative;
}

.news-source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.source-actions {
    display: flex;
    gap: 8px;
}

.news-source-info {
    color: #555;
}

.source-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 10px 0;
    font-size: 0.9em;
}

.source-meta > span {
    display: inline-block;
}

.status-active {
    color: #28a745;
    font-weight: 500;
}

.status-inactive {
    color: #dc3545;
    font-weight: 500;
}

.fetch-due {
    color: #ff6b6b;
    font-weight: 500;
}

.fetch-not-due {
    color: #51cf66;
    font-weight: 500;
}

.selector-config-details {
    margin-top: 12px;
}

.selector-config-details summary {
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    padding: 4px 0;
}

.selector-config-details pre {
    margin-top: 8px;
    padding: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.85em;
    overflow-x: auto;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

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

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

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

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

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

.form-group {
    padding: 15px 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95rem;
}

.form-group textarea {
    resize: vertical;
    font-family: monospace;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #6c757d;
    font-size: 0.85rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #dee2e6;
}

/* Economic Event Styles */
.economic-event-section {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 15px;
}

.economic-event-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.economic-event-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #ffeaa7;
}

.economic-event-table td:first-child {
    font-weight: 500;
    color: #856404;
    width: 120px;
}

.impact-high {
    color: #dc3545;
    font-weight: bold;
}

.impact-medium {
    color: #ffc107;
    font-weight: bold;
}

.impact-low {
    color: #28a745;
    font-weight: bold;
}

.economic-data-details {
    margin-top: 12px;
}

.economic-data-details summary {
    cursor: pointer;
    font-weight: 500;
    color: #856404;
}

.economic-data-details pre {
    margin-top: 8px;
    padding: 12px;
    background-color: #fefcf3;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    font-size: 0.85em;
    overflow-x: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .nav-link {
        display: block;
        margin-bottom: 10px;
        margin-right: 0;
        text-align: center;
    }
    
    .article-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .toggle-details {
        justify-content: center;
    }
    
    .category-rankings-compact {
        font-size: 0.85em;
    }
    
    .forex-impact-compact {
        font-size: 0.85em;
    }
    
    .instrument-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .instrument-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .instrument-name {
        margin-bottom: 4px;
        min-width: auto;
    }
    
    .instrument-sentiment {
        margin-bottom: 4px;
    }
    
    .instrument-reasoning {
        margin-left: 0;
    }
    
    .category-rankings {
        flex-direction: column;
        gap: 8px;
    }
    
    .category-rank {
        width: 100%;
        text-align: center;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group input {
        min-width: auto;
        width: 100%;
    }
    
    .filter-btn {
        width: 100%;
        margin-top: 10px;
    }
}