/**
 * Стили для страницы каналов
 */

/* === Основная структура страницы каналов === */
.channels-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.channels-page-header {
    text-align: center;
    margin-bottom: 1rem;
}

.channels-page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.channels-page-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* === Секция добавления канала === */
.add-channel-container {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-color);
}

.add-channel-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.add-channel-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.add-channel-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: flex-end;
}

.add-channel-input-group {
    display: flex;
    flex-direction: column;
}

.add-channel-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.add-channel-input-wrapper {
    display: flex;
    position: relative;
}

.add-channel-input-prefix {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.add-channel-input {
    background-color: var(--input-bg);
    border: 1px solid rgba(156, 163, 175, 0.2) var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 0.75rem 0.75rem 0.75rem 2rem;
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.add-channel-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.25);
}

.add-channel-button-wrapper {
    display: flex;
    align-items: center;
}

.add-channel-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.add-channel-button:hover {
    background-color: var(--primary-hover);
}

.add-channel-status {
    margin-top: 1rem;
    font-size: 0.875rem;
}

.channels-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.channels-search {
    position: relative;
}

.channels-search-input {
    background-color: #2a2a2a;
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.2) #3a3a3a;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    width: 16rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.channels-search-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 1px #4a90e2;
}

.channels-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
}

/* === Контейнер списка каналов === */
.channels-list-container {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.channels-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.channels-list-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.reload-channels-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--secondary-bg);
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(156, 163, 175, 0.2) var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.reload-channels-button:hover {
    background-color: var(--hover-bg);
}

/* === Индикаторы загрузки и пустого состояния === */
.channels-loading {
    padding: 3rem 0;
    text-align: center;
}

.channels-loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.channels-loading-text {
    color: var(--text-secondary);
}

.channels-error,
.no-channels {
    padding: 3rem 0;
    text-align: center;
}

.channels-error-message,
.no-channels-message {
    max-width: 30rem;
    margin: 0 auto;
}

.channels-error-icon,
.no-channels-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.channels-error-title,
.no-channels-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.channels-error-description,
.no-channels-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.channels-error-button {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.channels-error-button:hover {
    background-color: var(--primary-hover);
}

/* === Список каналов (гриды) === */
.channels-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .channels-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .channels-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Карточка канала */
.channel-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid rgba(156, 163, 175, 0.2) var(--border-color);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid var(--primary-color);
}

.channel-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.channel-header {
    padding: 1.25rem;
    border-bottom: 1px solid #3a3a3a;
}

.channel-avatar {
    width: 4rem;
    height: 4rem;
    background-color: #2a2a2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    overflow: hidden;
}

.channel-avatar i {
    font-size: 1.5rem;
    color: #4a90e2;
}

.channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.channel-username {
    font-size: 0.875rem;
    color: #4a90e2;
    text-decoration: none;
}

.channel-username:hover {
    text-decoration: underline;
}

.channel-body {
    padding: 1.25rem;
}

.channel-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.channel-stat {
    background-color: #2a2a2a;
    border-radius: 0.375rem;
    padding: 0.75rem;
    text-align: center;
}

.channel-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.channel-stat-label {
    font-size: 0.75rem;
    color: #9ca3af;
}

.channel-actions {
    display: flex;
    gap: 0.5rem;
}

.channel-action-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2a2a2a;
    color: #d1d5db;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.channel-action-button:hover {
    background-color: #3a3a3a;
}

.channel-action-button i {
    margin-right: 0.375rem;
}

.channel-action-button.create-order {
    background-color: #4a90e2;
    color: white;
}

.channel-action-button.create-order:hover {
    background-color: #3b82f6;
}

.channel-action-button.delete-channel {
    background-color: transparent;
    color: #ef4444;
    border: 1px solid rgba(156, 163, 175, 0.2) #ef4444;
}

.channel-action-button.delete-channel:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Пустое состояние - нет каналов */
.channels-empty {
    background-color: #252525;
    border-radius: 0.5rem;
    padding: 3rem 1.5rem;
    text-align: center;
    border: 1px solid rgba(156, 163, 175, 0.2) #3a3a3a;
}

.channels-empty-icon {
    font-size: 3rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.channels-empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.channels-empty-description {
    color: #9ca3af;
    margin-bottom: 1.5rem;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

/* === Модальное окно добавления канала === */
.add-channel-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background-color: #252525;
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-width: 32rem;
    width: 100%;
    margin: 0 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: color 0.2s;
}

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

.modal-body {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    background-color: #2a2a2a;
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.2) #3a3a3a;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 1px #4a90e2;
}

.form-help {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-button-cancel {
    background-color: transparent;
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.2) #3a3a3a;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-button-cancel:hover {
    background-color: #3a3a3a;
}

.modal-button-add {
    background-color: #4a90e2;
    color: white;
    border: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.modal-button-add:hover {
    background-color: #3b82f6;
}

.modal-button-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Модальное окно подтверждения удаления === */
.delete-channel-modal .modal-body {
    text-align: center;
}

.delete-warning-icon {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.delete-warning-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.delete-warning-text {
    color: #9ca3af;
    margin-bottom: 1.5rem;
}

.delete-confirm-input {
    text-align: center;
}

.modal-button-delete {
    background-color: #ef4444;
    color: white;
}

.modal-button-delete:hover {
    background-color: #dc2626;
}

/* === Модальное окно просмотра статистики канала === */
.stats-modal .modal-body {
    padding: 0;
}

.channel-stats-header {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid #3a3a3a;
}

.channel-stats-avatar {
    width: 3rem;
    height: 3rem;
    background-color: #2a2a2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    overflow: hidden;
    flex-shrink: 0;
}

.channel-stats-avatar i {
    font-size: 1.25rem;
    color: #4a90e2;
}

.channel-stats-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-stats-info {
    flex: 1;
}

.channel-stats-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.channel-stats-username {
    font-size: 0.875rem;
    color: #4a90e2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background-color: #3a3a3a;
}

.stats-item {
    background-color: #252525;
    padding: 1.25rem;
    text-align: center;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stats-label {
    font-size: 0.875rem;
    color: #9ca3af;
}

.stats-chart-container {
    padding: 1.25rem;
    border-top: 1px solid #3a3a3a;
}

.stats-chart-title {
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.stats-chart {
    height: 12rem;
    position: relative;
}

.stats-table {
    width: 100%;
    margin-top: 1.25rem;
    border-top: 1px solid #3a3a3a;
}

.stats-table-header {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    text-align: left;
    border-bottom: 1px solid #3a3a3a;
}

.stats-table-cell {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #3a3a3a;
}

.stats-table-row:last-child .stats-table-cell {
    border-bottom: none;
}

/* === Стили для уведомлений === */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 24rem;
}

.notification {
    background-color: #252525;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    transition: transform 0.3s, opacity 0.3s;
    transform: translateX(100%);
    opacity: 0;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-icon {
    flex-shrink: 0;
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.notification.success .notification-icon {
    color: #10b981;
}

.notification.error .notification-icon {
    color: #ef4444;
}

.notification.warning .notification-icon {
    color: #f59e0b;
}

.notification.info .notification-icon {
    color: #3b82f6;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.875rem;
    color: #9ca3af;
}

.notification-close {
    flex-shrink: 0;
    margin-left: 0.75rem;
    color: #9ca3af;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.notification-close:hover {
    color: #f9fafb;
}