/**
 * Стили для системы уведомлений ARTEL CRM
 */

/* ===== КНОПКА УВЕДОМЛЕНИЙ В ПРАВОМ НИЖНЕМ УГЛУ ===== */

.notification-bell-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #dee2e6);
    padding: 10px;
    color: var(--text-secondary, #6c757d);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.notification-bell-btn:hover {
    background: var(--bg-hover, #f1f3f5);
    color: var(--primary-color, #5c7cfa);
    border-color: var(--primary-color, #5c7cfa);
    transform: scale(1.05);
}

.notification-bell-btn i {
    font-size: 18px;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
    border: 2px solid #0f172a;
}

.notification-badge.hidden {
    display: none;
}

/* ===== ПАНЕЛЬ УВЕДОМЛЕНИЙ ===== */

.notification-panel {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 360px;
    max-height: 450px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: panel-slide-up 0.2s ease;
}

.notification-panel.hidden {
    display: none;
}

@keyframes panel-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #dee2e6);
    background: var(--bg-secondary, #f1f3f5);
}

.notification-panel-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #343a40);
}

.notification-panel-header h4 i {
    margin-right: 8px;
    color: var(--primary-color, #5c7cfa);
}

.notification-panel-header .btn-link {
    background: none;
    border: none;
    color: var(--primary-color, #5c7cfa);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.notification-panel-header .btn-link:hover {
    background: rgba(92, 124, 250, 0.1);
}

.notification-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

/* ===== ЭЛЕМЕНТ УВЕДОМЛЕНИЯ ===== */

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light, #e9ecef);
    cursor: pointer;
    transition: all 0.2s;
}

.notification-item:hover {
    background: var(--bg-hover, #f1f3f5);
}

.notification-item.unread {
    background: rgba(92, 124, 250, 0.06);
    border-left: 3px solid var(--primary-color, #5c7cfa);
}

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

.notification-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-secondary, #f1f3f5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-muted, #adb5bd);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary, #343a40);
    margin-bottom: 2px;
}

.notification-message {
    font-size: 12px;
    color: var(--text-secondary, #6c757d);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-time {
    font-size: 10px;
    color: var(--text-muted, #adb5bd);
    margin-top: 4px;
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */

.notification-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted, #adb5bd);
}

.notification-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
    color: var(--success-color, #51cf66);
}

.notification-empty p {
    margin: 0;
    font-size: 13px;
}

/* ===== НАСТРОЙКИ УВЕДОМЛЕНИЙ В ПРОФИЛЕ ===== */

/* Сворачиваемая секция */
.collapsible-section {
    overflow: hidden;
}

.section-header-collapsible {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.section-header-collapsible:hover {
    opacity: 0.8;
}

.section-header-collapsible h3 {
    margin: 0;
}

.section-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.notification-status-badge.enabled {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.notification-status-badge.disabled {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.collapse-icon {
    color: #64748b;
    transition: transform 0.3s ease;
    font-size: 14px;
}

.collapse-icon.rotated {
    transform: rotate(180deg);
}

.notification-settings {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}

.notification-settings.collapsed {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
    overflow: hidden;
}

/* Настройки рабочего дня */
.workday-settings {
    padding: 16px;
    transition: all 0.3s ease;
}

.workday-settings.collapsed {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
    overflow: hidden;
}

.work-hours-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.form-select-sm {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    min-width: 100px;
}

.form-select-sm:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 10px;
    transition: background 0.2s;
}

.setting-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.setting-row.main-toggle {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
}

.setting-row.main-toggle .setting-label {
    color: #1e40af;
    font-weight: 700;
}

.setting-row.sub-setting {
    padding-left: 32px;
}

.setting-info {
    flex: 1;
}

.setting-label {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 2px;
}

.setting-label i {
    margin-right: 8px;
    color: #3b82f6;
}

.setting-description {
    font-size: 12px;
    color: #64748b;
    font-weight: 400;
}

.setting-group {
    margin: 8px 0;
}

.setting-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(99, 102, 241, 0.08));
    border-radius: 10px;
    margin-bottom: 8px;
    border-left: 3px solid #3b82f6;
}

.setting-group-header i {
    font-size: 20px;
}

.setting-group-header .group-title {
    flex: 1;
    color: #0f172a;
    font-weight: 700;
}

.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 16px;
}

/* ===== TOGGLE SWITCH ===== */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    transition: 0.3s;
    border-radius: 13px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ===== TELEGRAM СЕКЦИЯ ===== */

.telegram-connect-section {
    padding: 0 16px 16px;
}

.telegram-connected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 10px;
    padding: 14px 16px;
}

.telegram-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #10b981;
}

.telegram-info i {
    font-size: 18px;
}

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

.telegram-setup {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 16px;
}

.telegram-instructions {
    margin-bottom: 16px;
    font-size: 13px;
    color: #94a3b8;
}

.telegram-instructions p {
    margin: 0 0 10px;
    color: #e5e7eb;
}

.telegram-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.telegram-instructions li {
    margin-bottom: 6px;
}

.telegram-instructions a {
    color: #3b82f6;
    text-decoration: none;
}

.telegram-instructions a:hover {
    text-decoration: underline;
}

.telegram-instructions code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.telegram-connect-form {
    display: flex;
    gap: 10px;
}

.telegram-connect-form input {
    flex: 1;
}

/* ===== STATUS BADGES ===== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.status-success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.status-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.status-badge.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* ===== КНОПКИ ===== */

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

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* ===== АКТИВНЫЕ СЕССИИ ===== */

.sessions-section {
    padding: 16px;
    transition: all 0.3s ease;
    max-height: 1200px;
    opacity: 1;
}

.sessions-section.collapsed {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
    overflow: hidden;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    gap: 14px;
    transition: all 0.2s;
}

.session-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.session-item.session-current {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(5, 150, 105, 0.04));
    border-color: rgba(16, 185, 129, 0.3);
}

.session-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.session-current .session-icon {
    background: linear-gradient(135deg, #10b981, #059669);
}

.session-details {
    flex: 1;
    min-width: 0;
}

.session-device-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.session-badge-current {
    display: inline-block;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.session-meta {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.session-meta i {
    margin-right: 4px;
    width: 12px;
    text-align: center;
}

.session-actions {
    flex-shrink: 0;
}

.btn-danger-outline {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.btn-danger-outline:hover {
    background: #ef4444;
    color: white;
}

.sessions-actions-global {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.sessions-actions-global .btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sessions-actions-global .btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.sessions-action-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #94a3b8;
}

.sessions-empty {
    text-align: center;
    padding: 24px;
    color: #94a3b8;
    font-size: 14px;
}

/* ===== IN-APP TOAST УВЕДОМЛЕНИЯ ===== */

#notif-toast-container {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    pointer-events: none;
}

.notif-toast {
    display: flex;
    align-items: stretch;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.35s ease, transform 0.35s ease;
    min-width: 300px;
    border: 1px solid rgba(0,0,0,0.06);
}

.notif-toast-show {
    opacity: 1;
    transform: translateX(0);
}

.notif-toast-hide {
    opacity: 0;
    transform: translateX(100%);
}

.notif-toast:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.1);
}

.notif-toast-accent {
    width: 4px;
    flex-shrink: 0;
}

.notif-toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    flex-shrink: 0;
    font-size: 18px;
}

.notif-toast-body {
    flex: 1;
    padding: 12px 4px 12px 0;
    min-width: 0;
}

.notif-toast-title {
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-toast-msg {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 0 12px;
    align-self: stretch;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.notif-toast-close:hover {
    color: #ef4444;
}

/* ===== TOGGLE BUTTON IN PANEL HEADER ===== */

.notif-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: none;
}

.notif-toggle-btn.notif-on {
    color: #10b981;
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.notif-toggle-btn.notif-on:hover {
    background: rgba(16, 185, 129, 0.18);
}

.notif-toggle-btn.notif-off {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.notif-toggle-btn.notif-off:hover {
    background: rgba(239, 68, 68, 0.18);
}

/* ===== АДАПТИВ ===== */

@media (max-width: 768px) {
    #notif-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notif-toast {
        min-width: 0;
    }
    
    .notification-panel {
        left: 10px;
        right: 10px;
        width: auto;
        bottom: 70px;
    }
    
    .telegram-connect-form {
        flex-direction: column;
    }
    
    .telegram-connected {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .session-item {
        flex-wrap: wrap;
    }
    
    .session-meta {
        flex-direction: column;
        gap: 4px;
    }
}

