/* Рассылки - следуем стилю admin.css */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.info-text a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.info-text a:hover {
    color: var(--primary-color);
}

/* Статистика - в стиле stats-grid */
.mailings-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.mailings-stats .stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow);
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.mailings-stats .stat-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-color);
}

.mailings-stats .stat-card:nth-child(1) {
    animation-delay: 0.05s;
}

.mailings-stats .stat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.mailings-stats .stat-card:nth-child(3) {
    animation-delay: 0.15s;
}

.mailings-stats .stat-card:nth-child(4) {
    animation-delay: 0.2s;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.success {
    background: #000000;
}

.stat-icon.warning {
    background: #666666;
}

.stat-icon.info {
    background: #333333;
}

.stat-icon svg,
.stat-icon i[data-feather] {
    color: var(--bg-primary);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.02em;
    display: inline-block;
    transition: transform 0.3s ease;
}

.stat-card:hover .stat-value {
    transform: scale(1.05);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Таблица рассылок - в стиле data-table */
.mailings-table-container {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.mailings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.mailings-table thead th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 10;
}

.mailings-table tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.mailings-table tbody tr:last-child td {
    border-bottom: none;
}

.mailings-table tbody tr {
    animation: fadeInUp 0.5s ease-out backwards;
}

.mailings-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.mailings-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.mailings-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.mailings-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.mailings-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.mailings-table tbody tr:nth-child(6) { animation-delay: 0.3s; }
.mailings-table tbody tr:nth-child(7) { animation-delay: 0.35s; }
.mailings-table tbody tr:nth-child(8) { animation-delay: 0.4s; }
.mailings-table tbody tr:nth-child(9) { animation-delay: 0.45s; }
.mailings-table tbody tr:nth-child(10) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mailings-table tbody tr:hover {
    background: var(--highlight-color);
}

/* Статус бейджи - в минималистичном стиле с различимыми цветами */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-in_progress {
    background: #000000;
    color: #ffffff;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-cancelled {
    background: #f3f4f6;
    color: #6b7280;
}

/* Кнопки действий - в стиле btn-detail */
.action-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
    margin-right: 0.25rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    color: var(--text-primary);
}

.action-btn:hover {
    background: var(--highlight-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-view {
    background: none;
}

.btn-cancel {
    background: none;
    color: var(--text-danger);
}

.btn-cancel:hover {
    background: #fef2f2;
    border-color: var(--text-danger);
}

.btn-cancel:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-cancel:disabled:hover {
    background: none;
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Модальное окно деталей - в стиле admin modal */
.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.details-modal-content {
    background-color: var(--bg-primary);
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.modal .modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.modal .modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 1.5rem;
    line-height: 1;
}

.modal .modal-close:hover {
    background: var(--highlight-color);
    color: var(--primary-color);
}

.modal .modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Секции деталей */
.details-section {
    margin-bottom: 1.5rem;
}

.details-section:last-child {
    margin-bottom: 0;
}

.details-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

/* Статистические карточки */
.detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.detail-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
}

.detail-stat-card.full-width {
    grid-column: 1 / -1;
}

.detail-stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.detail-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.detail-stat-value.success {
    color: #10b981;
}

.detail-stat-value.error {
    color: #ef4444;
}

/* Telegram превью в деталях */
.telegram-preview-details {
    background: linear-gradient(180deg, #0088cc 0%, #006699 100%);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.telegram-preview-details .telegram-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.telegram-preview-details .telegram-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #0088cc;
    flex-shrink: 0;
}

.telegram-preview-details .telegram-bubble {
    background: #fff;
    border-radius: 12px;
    padding: 0;
    max-width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.telegram-preview-details .telegram-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent #fff transparent transparent;
}

.telegram-preview-details .telegram-content {
    padding: 10px 14px;
}

.telegram-preview-details .telegram-sender {
    font-weight: 600;
    font-size: 14px;
    color: #0088cc;
    margin-bottom: 4px;
}

.telegram-preview-details .telegram-text {
    font-size: 15px;
    line-height: 1.4;
    color: #000;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.telegram-preview-details .telegram-text b,
.telegram-preview-details .telegram-text strong {
    font-weight: 700;
}

.telegram-preview-details .telegram-text i,
.telegram-preview-details .telegram-text em {
    font-style: italic;
}

.telegram-preview-details .telegram-text code {
    background: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 14px;
}

.telegram-preview-details .telegram-time {
    font-size: 12px;
    color: #999;
    text-align: right;
    margin-top: 4px;
}

.telegram-preview-details .telegram-media {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
    border-radius: 12px 12px 0 0;
}

.telegram-preview-details .telegram-document {
    padding: 10px 14px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 12px 12px 0 0;
}

.telegram-preview-details .telegram-document-icon {
    width: 40px;
    height: 40px;
    background: #0088cc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.telegram-preview-details .telegram-document-name {
    font-weight: 600;
    font-size: 14px;
    color: #000;
}

/* Таймлайн информация */
.timeline-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.timeline-item:first-child {
    padding-top: 0;
}

.timeline-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.timeline-value {
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Spinner - в стиле admin spinner */
.loading-row {
    padding: 3rem;
}

.loading-row td {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    position: relative;
    margin: 0 auto 10px;
}

.spinner::before,
.spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    inset: 0;
}

.spinner::before {
    border-top-color: var(--primary-color);
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.spinner::after {
    border-top-color: var(--accent-color);
    animation: spin 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    animation-delay: 0.2s;
}

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

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state i[data-feather] {
    width: 64px;
    height: 64px;
    opacity: 0.2;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.empty-state a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.empty-state a:hover {
    color: var(--primary-color);
}

/* Анимации - slideInRight для уведомлений */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Индикатор Live */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.9);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .mailings-stats {
        grid-template-columns: 1fr;
    }
    
    .mailings-table {
        font-size: 0.75rem;
    }
    
    .mailings-table thead th,
    .mailings-table tbody td {
        padding: 0.5rem;
    }
    
    .action-btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }
}
