/* General Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f4f7fa;
    color: #333;
}

#app {
    height: 100vh;
}

.loading {
    padding: 20px;
}

.error {
    padding: 20px;
    color: red;
}

/* Login Form */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    background-color: #f0f2f5;
}

.login-form {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 300px;
    text-align: center;
}

.login-form h1 {
    margin-bottom: 24px;
    color: #333;
}

.login-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.login-form button {
    width: 100%;
    padding: 10px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.login-form button:hover {
    background-color: #0056b3;
}

.error-message {
    color: #d9534f;
    margin-top: 10px;
    font-size: 14px;
}

/* Admin Panel */
.admin-panel {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 20px;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    background-color: #34495e;
}

.menu {
    list-style-type: none;
    padding: 0;
    margin: 20px 0;
    flex-grow: 1;
}

.menu a {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background-color 0.3s;
}

.menu a:hover {
    background-color: #34495e;
}

.main-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #ecf0f1;
}

/* Dashboard */
.dashboard h1 {
    margin-bottom: 20px;
}

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

.stat-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-container {
    margin-top: 30px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sources Table */
.sources-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sources-table th, .sources-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

.sources-table th {
    background-color: #f8f9fa;
}

.sources-table tbody tr:hover {
    background-color: #f1f1f1;
}

/* Articles */
.articles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding-top: 20px;
}

.article-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.article-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.article-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.article-meta .source {
    font-weight: bold;
    cursor: pointer;
}

.article-meta .source:hover {
    text-decoration: underline;
}

.article-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.article-content h3 a {
    color: #333;
    text-decoration: none;
}

.article-content h3 a:hover {
    color: #007bff;
}

.tags {
    margin-top: auto;
    padding-top: 10px;
}

.tag {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
    cursor: pointer;
}

.tag:hover {
    background-color: #d4dae0;
}

.tag .remove-btn {
    margin-left: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* Filters */
.filter-container {
    display: flex;
    justify-content: flex-start; /* Align items to the start */
    gap: 15px; /* Add space between filter groups */
    margin-bottom: 15px;
    position: relative;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.filter-group {
    position: relative;
    display: flex;
    flex-direction: column; /* Stack input and suggestions vertically */
}

#tag-input, #categoryFilter {
    width: 300px; /* Adjust as needed */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

#categoryFilter {
    appearance: none; /* Remove default dropdown arrow */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%20viewBox%3D%220%200%20292.4%20292.4%22%3E%3Cpath%20fill%3D%22%23007bff%22%20d%3D%22M287%20119.3L153.9%20252.3c-2.4%202.4-5.8%204.1-9.7%204.1-3.9%200-7.3-1.6-9.7-4.1L5.4%20119.3C0%20114%200%20106%205.4%20100.7c5.4-5.4%2014.2-5.4%2019.6%200l120.7%20120.7L267.9%20100.7c5.4-5.4%2014.2-5.4%2019.6%200%205.4%205.4%205.4%2014.2%200%2019.6z%22%2F%3E%3C%2Fsvg%3E'); /* Custom arrow */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px; /* Make space for the arrow */
    cursor: pointer;
}

#tag-suggestions {
    position: absolute;
    top: 100%;
    background-color: white;
    border: 1px solid #ccc;
    border-top: none;
    width: 300px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 1000;
}

#tag-suggestions div {
    padding: 8px;
    cursor: pointer;
}

#tag-suggestions div:hover {
    background-color: #f1f1f1;
}

#selected-filters { /* Changed from #selected-tags to #selected-filters */
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#selected-filters .tag { /* Changed from #selected-tags to #selected-filters */
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    color: #495057;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
}

#selected-filters .tag span { /* Changed from #selected-tags to #selected-filters */
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
}

/* Switch for toggles */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

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

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

/* Forms */
.form-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.form-container input, .form-container select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Categories */
.categories-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.categories-table th, .categories-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.actions-header {
    width: 200px; /* Adjust as needed */
    text-align: right;
}

.actions-cell {
    text-align: right;
}

/* Settings */
.settings-section {
    max-width: 800px;
}

.setting-group {
    background: #fff;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-group label {
    font-weight: bold;
}

.setting-group input {
    width: 200px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Toast Messages */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-message {
    background-color: #333;
    color: #fff;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast-message.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-message.success { background-color: #28a745; }
.toast-message.error { background-color: #dc3545; }
.toast-message.info { background-color: #17a2b8; }

.bottom-menu {
    margin-top: auto;
    border-top: 1px solid #4b627d;
}

.status-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-ok {
    background-color: #28a745; /* Green */
}

.status-error {
    background-color: #dc3545; /* Red */
}

.status-unknown {
    background-color: #6c757d; /* Gray */
}

.chart-controls {
    margin-bottom: 20px;
}

.chart-controls button {
    margin-left: 10px;
    padding: 5px 10px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    cursor: pointer;
}

.chart-controls button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

#chart-wrapper {
    position: relative;
    /* Высота будет установлена через JavaScript */
}

/* Sidebar RSS Run Times */
.rss-run-times {
    padding: 15px;
    font-size: 14px;
    border-top: 1px solid #4b627d;
}

.rss-run-times div {
    margin-bottom: 5px;
}

/* RSS Fetcher Status Indicator */
.logo-active {
    border-left: 5px solid #28a745; /* Green for active */
}

.logo-inactive {
    border-left: 5px solid #dc3545; /* Red for inactive */
}

/* Pagination */
#pagination-controls {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.pagination {
    display: flex;
    gap: 5px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
    border-radius: 4px;
}

.pagination button:hover {
    background-color: #f1f1f1;
}

.pagination button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination button:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.tag-cloud-container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.tag-cloud-item {
    cursor: pointer;
    transition: color 0.3s ease;
}

.tag-cloud-item:hover {
    color: #007bff;
}
