* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Стилі для HTML контенту новин */
.news-content {
    line-height: 1.6;
    color: var(--text-color);
}

.news-content h1,
.news-content h2,
.news-content h3,
.news-content h4 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    color: var(--text-color);
}

.news-content h1 { font-size: 1.5em; }
.news-content h2 { font-size: 1.3em; }
.news-content h3 { font-size: 1.1em; }
.news-content h4 { font-size: 1em; }

.news-content p {
    margin: 0.5em 0;
}

.news-content ul,
.news-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.news-content li {
    margin: 0.25em 0;
}

.news-content strong {
    font-weight: 600;
}

.news-content em {
    font-style: italic;
}

.news-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.news-content a:hover {
    color: var(--primary-dark);
}

.news-content hr {
    margin: 1em 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.news-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.5em 0;
}

.news-content blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 3px solid var(--primary-color);
    background: var(--bg-color);
    font-style: italic;
}

.news-content code {
    background: var(--bg-color);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.news-content pre {
    background: var(--bg-color);
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1em 0;
}

.news-content pre code {
    background: none;
    padding: 0;
}

:root {
    --primary-color: #6366f1;
    --primary-rgb: 99, 102, 241;
    --primary-dark: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Екрани */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Логін */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 48px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo h1 {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Форми */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select,
.select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.select:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

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

/* Повідомлення */
.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 16px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--success-color);
    font-size: 14px;
    margin-top: 16px;
}

/* Навігація */
/* Топ бар */
.top-bar {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-content {
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left h1 {
    font-size: 24px;
    color: var(--text-color);
    margin: 0;
    font-weight: 600;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.top-bar-stats {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Старі стилі для navbar (для сумісності) */
.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand h2 {
    font-size: 24px;
    color: var(--primary-color);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    background-color: var(--primary-color);
    color: white;
}

/* Головний макет */
.main-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}

.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 0;
    overflow-y: auto;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 20px;
    color: var(--primary-color);
    margin: 0;
}

.sidebar-nav {
    padding: 8px 0;
}

.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: var(--bg-color);
    border-left-color: var(--primary-color);
}

.menu-item.active {
    background: rgba(var(--primary-rgb), 0.1);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}

.menu-item .icon {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.menu-item .menu-text {
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
}

.menu-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.menu-item.active {
    background-color: var(--bg-color);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.menu-item .icon {
    font-size: 20px;
}

/* Контент */
.content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-color);
}

#content-area {
    min-height: 100%;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

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

.view-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

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

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 48px;
}

.stat-info h3 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Секції */
.section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.section h2 {
    margin-bottom: 16px;
    font-size: 20px;
}

/* Сітки */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Картки */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-meta {
    color: var(--text-secondary);
    font-size: 14px;
}

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

/* Рекомендації */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recommendation-card {
    padding: 16px;
    border-left: 4px solid var(--primary-color);
    background: var(--bg-color);
    border-radius: 8px;
}

.recommendation-card.priority-high {
    border-left-color: var(--danger-color);
}

.recommendation-card.priority-medium {
    border-left-color: var(--warning-color);
}

.recommendation-card.priority-low {
    border-left-color: var(--success-color);
}

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

.recommendation-title {
    font-weight: 600;
}

.recommendation-priority {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* AI Генератор */
.ai-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.result-box {
    margin-top: 24px;
    padding: 24px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 2px solid var(--border-color);
    display: none;
}

.result-box.show {
    display: block;
}

.result-box img {
    max-width: 100%;
    border-radius: 8px;
}

/* Медіа сітка */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--border-color);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    padding: 12px;
    color: white;
    font-size: 12px;
}

/* Аналітика */
.analytics-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.analytics-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.analytics-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.analytics-section h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.analytics-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.analytics-filters input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.analytics-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.analytics-stat {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.analytics-stat:last-child {
    border-bottom: none;
}

/* Статистичні картки для аналітики */
.analytics-section .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.analytics-section .stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.analytics-section .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.analytics-section .stat-card.stat-primary {
    border-left: 4px solid var(--primary-color);
}

.analytics-section .stat-card.stat-success {
    border-left: 4px solid var(--success-color);
}

.analytics-section .stat-card.stat-danger {
    border-left: 4px solid var(--danger-color);
}

.analytics-section .stat-card.stat-warning {
    border-left: 4px solid var(--warning-color);
}

.analytics-section .stat-card.stat-info {
    border-left: 4px solid #3b82f6;
}

.analytics-section .stat-card.stat-revenue {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
}

.analytics-section .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.analytics-section .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

.analytics-section .stat-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.analytics-table thead {
    background: var(--bg-color);
}

.analytics-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.analytics-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.analytics-table tbody tr:hover {
    background: var(--bg-color);
}

.table-responsive {
    overflow-x: auto;
    margin-top: 16px;
}

/* Соціальні мережі */
.social-accounts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.social-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.social-icon {
    font-size: 32px;
}

.social-info {
    flex: 1;
}

.social-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.social-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.social-status.active {
    color: var(--success-color);
}

/* Модальне вікно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
}

.close:hover {
    color: var(--text-color);
}

/* Порожній стан */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 20px 0;
}

.empty-state h3 {
    color: var(--text-primary);
    margin: 20px 0 10px;
}

.empty-state p {
    color: var(--text-secondary);
    margin: 10px 0;
}

/* Адміністративні елементи */
.admin-only {
    display: none;
}

body.admin .admin-only {
    display: block;
}

/* Завантаження */
.loading {
    text-align: center;
    padding: 48px;
}

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

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

/* Адаптивність */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .navbar {
        padding: 16px;
    }

    .navbar-user {
        font-size: 14px;
    }
}

/* ==================== Telegram Канал ==================== */

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

/* Календар */
.calendar-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.calendar-wrapper {
    width: 100%;
}

.calendar-header {
    text-align: center;
    margin-bottom: 20px;
}

.calendar-header h3 {
    font-size: 20px;
    color: var(--text-color);
    margin: 0;
}

.calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekday {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 8px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    min-height: 60px;
}

.calendar-day:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.calendar-day.today {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
}

.calendar-day.past {
    opacity: 0.6;
    cursor: pointer;
}

.calendar-day.prev-month {
    opacity: 0.4;
    background: #f1f5f9;
}

.calendar-day.prev-month:hover {
    opacity: 0.7;
}

.calendar-day.next-month {
    opacity: 0.4;
    background: #f8fafc;
}

.calendar-day.next-month:hover {
    opacity: 0.7;
}

.calendar-day.has-posts {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.calendar-day.empty {
    border: none;
    background: transparent;
    cursor: default;
}

.calendar-day.empty:hover {
    transform: none;
    box-shadow: none;
}

.calendar-day-number {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
}

.calendar-day-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    margin-top: auto;
    font-size: 10px;
}

.calendar-day-target {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 9px;
}

.calendar-day-actual {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
}

.calendar-day-warning {
    text-align: center;
    color: var(--danger-color);
    font-weight: 600;
    font-size: 9px;
    margin-top: 2px;
}

.calendar-day.needs-posts {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.post-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.post-badge.scheduled {
    background: var(--success-color);
    color: white;
}

.post-badge.pending {
    background: var(--warning-color);
    color: white;
}

.post-badge.published {
    background: var(--primary-color);
    color: white;
}

.post-badge.empty {
    background: var(--border-color);
    color: var(--text-secondary);
}

.calendar-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.day-posts-list {
    max-height: 500px;
    overflow-y: auto;
}

.day-post-item {
    transition: all 0.2s;
}

.day-post-item:hover {
    background: var(--bg-color) !important;
    border-color: var(--primary-color) !important;
}

.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

/* Інформація про канал */
.channel-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.channel-info-card h3 {
    margin-bottom: 16px;
    font-size: 24px;
}

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

.detail-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
}

.detail-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    opacity: 0.8;
}

/* Результати аналізу */
.analysis-results {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.analysis-results h3 {
    margin-bottom: 20px;
}

.analysis-section {
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
}

.analysis-section h4 {
    margin-bottom: 12px;
    color: var(--primary-color);
}

.topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-tag {
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 14px;
}

.recommendations-list {
    list-style: none;
}

.recommendations-list li {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
}

/* Пости на затвердження */
.pending-posts-container {
    display: grid;
    gap: 20px;
}

.pending-post-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.pending-post-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.scheduled-post-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 2px solid #f59e0b;
    border-left: 6px solid #f59e0b;
    transition: all 0.3s ease;
}

.scheduled-post-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.scheduled-post-card.error-post {
    border: 2px solid #ef4444;
    border-left: 6px solid #ef4444;
}

.post-badge.scheduled {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

.post-badge.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.time-remaining {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.scheduled-media {
    margin-top: 16px;
    text-align: center;
}

.scheduled-media img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

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

.post-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.post-date {
    color: var(--text-secondary);
    font-size: 14px;
}

.post-content {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    white-space: pre-wrap;
    font-size: 15px;
    line-height: 1.6;
}

.post-meta {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.meta-item {
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    font-size: 14px;
}

.meta-item strong {
    color: var(--primary-color);
    margin-right: 8px;
}

.meta-item.reasoning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid var(--warning-color);
}

.post-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.edit-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Статистика */
.stats-dashboard {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.stats-dashboard h3, .stats-dashboard h4 {
    margin-bottom: 20px;
}

.top-posts-section {
    margin-top: 32px;
}

.top-posts-list {
    display: grid;
    gap: 12px;
}

.top-post-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.top-post-item:hover {
    background: white;
    box-shadow: var(--shadow);
}

.post-rank {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 40px;
}

.post-preview {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
}

.post-stats {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 400px;
}

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

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

/* Loading spinner в кнопках */
.btn .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-width: 2px;
    vertical-align: middle;
}

/* Варіанти публікації */
.publish-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.publish-option:hover {
    border-color: var(--primary-color);
    background: white;
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.publish-option.recommended {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: var(--warning-color);
}

.publish-option.recommended:hover {
    background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%);
}

.option-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.option-content {
    flex: 1;
}

.option-content h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: var(--text-color);
}

.option-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.option-content .option-note {
    margin-top: 8px;
    font-style: italic;
    color: var(--warning-color);
}

.recommended-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--warning-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Модальне вікно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Блокуємо скрол на модальному вікні */
}

.modal.active,
.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    margin: auto;
}

.modal-content.broadcast-form {
    max-width: 95vw;
    width: 95vw;
    max-height: calc(100vh - 60px);
    height: calc(100vh - 60px);
    min-height: 500px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
    box-sizing: border-box;
}

.modal-content.broadcast-form form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Блокуємо скрол body коли модальне вікно відкрите */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Вкладки для форми розсилки */
.broadcast-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #f8f9fa;
    padding: 0 20px;
    gap: 0;
    flex-shrink: 0;
    z-index: 10;
}

.broadcast-tab {
    padding: 16px 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.broadcast-tab:hover {
    color: #333;
    background: rgba(0,0,0,0.02);
}

.broadcast-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.broadcast-tab.completed::before {
    content: '✓ ';
    color: #28a745;
    margin-right: 4px;
}

.broadcast-tab-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
    background: white;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.broadcast-tab-pane {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 80px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px 40px 20px 40px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    box-sizing: border-box;
    background: white;
    width: 100%;
}

.broadcast-tab-pane::-webkit-scrollbar {
    width: 8px;
}

.broadcast-tab-pane::-webkit-scrollbar-track {
    background: #f7fafc;
}

.broadcast-tab-pane::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.broadcast-tab-pane::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.broadcast-tab-pane.active {
    display: block !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 1;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 0;
}

.broadcast-form-footer {
    padding: 15px 40px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 100;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 70px;
    box-sizing: border-box;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Повідомлення та статуси */
.info-message {
    text-align: center;
    padding: 32px 24px;
    background: var(--bg-color);
    border-radius: 8px;
    color: var(--text-secondary);
}

.error-message {
    text-align: center;
    padding: 32px 24px;
    background: #fee2e2;
    border: 2px solid var(--danger-color);
    border-radius: 8px;
    color: var(--danger-color);
}

.loading {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

/* Медіа варіанти */
.media-variants {
    margin: 20px 0;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

.media-variants h4 {
    margin: 0 0 16px 0;
    color: var(--text-color);
    font-size: 16px;
}

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

.media-variant {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.media-variant:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.media-variant.recommended {
    border-color: var(--success-color);
    border-width: 3px;
}

.media-variant.selected {
    border-color: var(--primary-color);
    border-width: 4px;
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.3);
}

.media-variant.selected .media-label {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.media-variant.selected .media-label::before {
    content: '✓ ';
    font-weight: bold;
}

.media-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.media-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: var(--bg-color);
    color: var(--text-secondary);
}

.media-label {
    padding: 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-color);
    color: var(--text-color);
}

.media-variant.recommended .media-label {
    background: var(--success-color);
    color: white;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
}

/* Адаптивність для Telegram */
@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
    }

    .header-actions .btn {
        width: 100%;
    }

    .post-actions {
        flex-direction: column;
    }

    .post-actions .btn {
        width: 100%;
    }

    .channel-details {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 24px;
    }

    .modal-content.broadcast-form {
        max-height: calc(100vh - 20px);
        height: calc(100vh - 20px);
        margin: 10px auto;
    }

    .broadcast-form-footer {
        padding: 12px 15px;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .broadcast-form-footer .btn {
        font-size: 13px;
        padding: 8px 16px;
    }

    .broadcast-tab-pane {
        padding: 15px;
    }

    #content-editor-layout {
        grid-template-columns: 1fr !important;
    }

    #content-variants-sidebar {
        position: relative !important;
        top: 0 !important;
        margin-bottom: 20px;
    }

    .publish-option {
        flex-direction: column;
        text-align: center;
    }

    .recommended-badge {
        position: static;
        margin-top: 12px;
    }
}

/* ===== Розумний AI Генератор ===== */
.smart-post-container {
    max-width: 1200px;
    margin: 0 auto;
}

.form-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.form-section h3 {
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.platform-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.platform-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.platform-checkboxes label:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.05);
}

.platform-checkboxes input[type="checkbox"]:checked + label,
.platform-checkboxes label:has(input[type="checkbox"]:checked) {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
    font-weight: 600;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    width: 100%;
    margin-top: 16px;
}

.smart-post-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.platform-post-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 2px solid var(--border-color);
}

.platform-post-card.loading {
    opacity: 0.6;
}

.platform-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.platform-name {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.platform-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.platform-badge.telegram { background: #0088cc; color: white; }
.platform-badge.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); color: white; }
.platform-badge.facebook { background: #1877f2; color: white; }
.platform-badge.linkedin { background: #0077b5; color: white; }
.platform-badge.twitter { background: #1da1f2; color: white; }

.post-content {
    margin-bottom: 16px;
}

.post-text {
    white-space: pre-wrap;
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.post-image {
    width: 100%;
    border-radius: 8px;
    margin-top: 12px;
}

.post-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.post-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* ===== Медіа бібліотека ===== */
.media-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.media-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.media-preview {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-icon {
    font-size: 48px;
}

.media-info {
    padding: 12px;
    flex: 1;
}

.media-name {
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-color);
    color: var(--text-secondary);
}

.badge-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-project {
    background: var(--primary-color);
    color: white;
}

.media-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.media-actions {
    padding: 12px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

/* Адаптивність */
@media (max-width: 768px) {
    .smart-post-results {
        grid-template-columns: 1fr;
    }
    
    .platform-checkboxes {
        flex-direction: column;
    }
    
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}


/* ===== YouTube Integration ===== */
.youtube-connect-screen,
.facebook-connect-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.connect-card {
  background: var(--card-bg);
  padding: 48px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  text-align: center;
}

.connect-card h2 {
  margin-bottom: 24px;
  font-size: 32px;
}

.feature-list {
  list-style: none;
  text-align: left;
  margin: 24px 0;
}

.feature-list li {
  padding: 12px 0;
  font-size: 16px;
}

/* ===== Facebook Integration ===== */
.facebook-dashboard {
  padding: 24px;
}

.facebook-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.info-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.info-icon {
  font-size: 32px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  border-radius: 12px;
  color: white;
}

.info-content h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.info-value {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.facebook-about {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 24px 0;
}

.facebook-about h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

.facebook-actions {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 24px 0;
}

.facebook-actions h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.youtube-dashboard {
  padding: 24px;
}

.youtube-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.channel-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.channel-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.channel-details h3 {
  margin-bottom: 8px;
}

.channel-stats {
  color: var(--text-secondary);
  font-size: 14px;
}

.youtube-actions {
  display: flex;
  gap: 12px;
}

.youtube-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
}

.youtube-tabs .tab-btn {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.youtube-tabs .tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

.youtube-tab-content .tab-pane {
  display: none;
}

.youtube-tab-content .tab-pane.active {
  display: block;
}

.videos-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  background: var(--card-bg);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.youtube-videos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.youtube-video-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.youtube-video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.youtube-video-card.posted {
  opacity: 0.7;
}

.video-thumbnail {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  overflow: hidden;
}

.video-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.video-info {
  padding: 12px;
}

.video-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.video-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.video-meta .badge {
  font-size: 10px;
  padding: 3px 6px;
  white-space: nowrap;
}

.video-date {
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.video-stats {
  color: var(--text-secondary);
  font-size: 11px;
  margin-top: 6px;
  line-height: 1.3;
}

.video-stats-row {
  display: flex;
  gap: 12px;
  margin: 8px 0;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.video-stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  justify-content: center;
}

.video-stat-item .stat-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}

.video-stat-item .stat-value {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.video-description-short {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0;
  padding: 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
}

.video-description-full {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.description-content {
  margin-bottom: 8px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 0;
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-link:hover {
  color: var(--primary-color-dark);
}

.show-more {
  color: var(--primary-color);
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
}

.video-actions {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.video-actions .btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-actions .btn-sm {
  padding: 5px 8px;
  font-size: 11px;
}

@media (max-width: 768px) {
  .youtube-videos-list {
    grid-template-columns: 1fr;
  }
  
  .video-actions {
    flex-direction: column;
  }
  
  .video-actions .btn {
    width: 100%;
  }
}

.badge-success {
  background: var(--success-color);
  color: white;
}

.badge-secondary {
  background: var(--secondary-color);
  color: white;
}

/* Analysis & Recommendations */
.analysis-section {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.analysis-section h3 {
  margin-bottom: 16px;
  color: var(--primary-color);
}

.video-idea-card {
  background: var(--bg-color);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary-color);
}

.video-idea-card h4 {
  margin-bottom: 12px;
}

.key-points {
  margin: 12px 0;
}

.key-points ul {
  margin-left: 20px;
}

.recommendations-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
}

.recommendation-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.recommendation-card h3 {
  margin-bottom: 12px;
  color: var(--text-color);
}

.recommendation-meta {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

/* Scripts */
.script-container {
  max-width: 900px;
  margin: 0 auto;
}

.script-content {
  background: var(--bg-color);
  padding: 24px;
  border-radius: 8px;
  margin: 24px 0;
  max-height: 600px;
  overflow-y: auto;
}

.script-content pre {
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.script-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.script-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.script-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.script-date {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Modal improvements */
.modal-content.large {
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Broadcast form modal - більший розмір */
.modal-content.broadcast-form {
  max-width: 1200px;
  width: 95%;
  padding: 40px;
}

.modal-content.broadcast-form .form-group {
  margin-bottom: 24px;
}

.modal-content.broadcast-form .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.modal-content.broadcast-form textarea {
  min-height: 120px;
  resize: vertical;
}

.modal-content.broadcast-form label {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
  color: var(--text-color);
}

/* Contact details modal */
.modal-content.contact-details {
  max-width: 900px;
  width: 95%;
  padding: 40px;
  max-height: 90vh;
  overflow-y: auto;
}

.contact-details-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 20px;
  margin: -40px -40px 24px -40px;
  border-radius: 16px 16px 0 0;
}

.contact-details-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.2;
}

.contact-details-header p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-section {
  background: var(--bg-color);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
}

.detail-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text-color);
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.detail-section p {
  margin: 8px 0;
  line-height: 1.6;
  color: var(--text-color);
}

.detail-section strong {
  color: var(--text-color);
  font-weight: 600;
  min-width: 120px;
  display: inline-block;
}

.detail-section .tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  margin: 4px 4px 4px 0;
  background: var(--primary-color);
  color: white;
}

.detail-section .tag.tag-product {
  background: #4caf50;
}

/* Telegram Bots Integration Styles */
.telegram-bots-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bots-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.bot-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.bot-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

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

.bot-header h3 {
  margin: 0;
  font-size: 18px;
}

.bot-info {
  margin-bottom: 16px;
}

.info-item {
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.info-item strong {
  color: var(--text-color);
  margin-right: 8px;
}

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

.users-list {
  margin-top: 16px;
}

.users-stats {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--card-bg);
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
}

.user-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.user-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.user-header h4 {
  margin: 0;
  font-size: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.broadcasts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.broadcast-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.broadcast-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.broadcast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.broadcast-header h3 {
  margin: 0;
  font-size: 18px;
}

.broadcast-content {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.broadcast-filters {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-color);
  border-radius: 8px;
  font-size: 14px;
}

.broadcast-filters div {
  margin-bottom: 4px;
}

.broadcast-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

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

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

.filter-controls .select,
.filter-controls .input {
  min-width: 150px;
}

.filter-controls .input {
  flex: 1;
  min-width: 200px;
}

/* Модальне вікно розшифровки */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.transcript-modal {
  position: relative;
  z-index: 1000;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.transcript-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--card-bg);
  border-radius: 12px 12px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.transcript-modal .modal-close {
  background: transparent;
  border: none;
  font-size: 32px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  font-weight: 300;
}

.transcript-modal .modal-close:hover {
  background: var(--bg-color);
  color: var(--text-color);
  transform: scale(1.1);
}

/* Сучасний дизайн для всіх модальних вікон */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 20px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-color);
}

.modal-close {
  position: absolute;
  right: 0;
  top: 0;
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  font-weight: 300;
  z-index: 10;
}

.modal-close:hover {
  background: var(--bg-color);
  color: var(--text-color);
  transform: rotate(90deg) scale(1.1);
}

.modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

/* Покращений дизайн модального контенту */
.modal-content {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
}

.modal-body {
  padding: 0;
}

.transcript-modal .modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.transcript-content {
  flex: 1;
  max-height: 60vh;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  margin: 16px 0;
  border: 1px solid var(--border-color);
}

.transcript-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.8;
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  margin: 0;
  padding: 0;
}

.transcript-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* Покращення скролу */
.transcript-content::-webkit-scrollbar {
  width: 8px;
}

.transcript-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.transcript-content::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.transcript-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Responsive */
@media (max-width: 768px) {
  .youtube-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .youtube-videos-list {
    grid-template-columns: 1fr;
  }
  
  .recommendations-container {
    grid-template-columns: 1fr;
  }
  
  .users-grid,
  .broadcasts-list,
  .bots-list {
    grid-template-columns: 1fr;
  }
  
  .filter-controls {
    flex-direction: column;
  }
  
  .filter-controls .select,
  .filter-controls .input {
    width: 100%;
  }
  
  .transcript-modal {
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .transcript-content {
    max-height: 50vh;
  }
}

/* Приховати дубльовані блоки тексту-заготовки в Telegram постах */
/* Прибираємо тільки дубльовані prompt-text-template, якщо вони є */
.prompt-text-template {
    display: none !important;
}

/* Стилі для шаблонів промптів */
.prompt-templates-container {
    margin-top: 20px;
}

.prompt-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.prompt-template-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.prompt-template-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.prompt-template-card.custom {
    border-left: 4px solid var(--success-color);
}

.prompt-template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.prompt-template-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-color);
}

.prompt-template-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prompt-template-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-template-body label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
}

.prompt-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.5;
    background: var(--input-bg);
    color: var(--text-color);
    resize: vertical;
    transition: all 0.3s ease;
}

.prompt-textarea:read-only {
    background: var(--bg-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.prompt-textarea.editable {
    background: var(--input-bg);
    cursor: text;
    opacity: 1;
    border-color: var(--primary-color);
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.prompt-template-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-secondary {
    background: var(--secondary-color);
    color: white;
}

@media (max-width: 768px) {
    .prompt-templates-grid {
        grid-template-columns: 1fr;
    }
}