/* Скрываем скроллбар для всех браузеров */
html {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
    scroll-behavior: smooth; /* Плавный скролл */
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

body {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
    overflow-x: hidden; /* Предотвращаем горизонтальный скролл */
    overflow-y: auto; /* Разрешаем вертикальный скролл */
}

body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Скрываем скроллбары для всех элементов на странице */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* ===== Стили страницы ИИ-Редактор ===== */
.editor-container {
    /* Наследует основные стили tasks-container */
}

.functions-title {
    font-weight: 600;
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

/* Кнопки фильтра */
.filter-toggle {
    display: flex;
    gap: 8px;
}
.filter-btn {
    background: #e9ecef;
    color: #333;
    border-radius: 20px;
    font-size: 0.9rem;
    padding: 6px 18px;
    border: none;
    transition: background 0.2s;
}
.filter-btn.active {
    background: #4b34e4;
    color: #fff;
}
.filter-btn:hover {
    background: #d6d8db;
}

/* Карточки функций */
.functions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.function-card {
    position: relative;
    height: 160px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}
.function-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 26px rgba(0,0,0,0.12);
}
.card-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.75);
}
/* Синий оттенок + изображение для карточки блога */
.img-blog .card-bg {
    background: linear-gradient(180deg, rgba(0,123,255,0.7) 0%, rgba(0,86,179,0.9) 100%), url('/static/img/AI-editor_card/chat_blog.png') center 45%/100% no-repeat;
}

/* Размытость (soft vignette) по углам */
.blur-edges::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.15), transparent 60%),
        radial-gradient(circle at top right, rgba(255,255,255,0.15), transparent 60%),
        radial-gradient(circle at bottom left, rgba(255,255,255,0.15), transparent 60%),
        radial-gradient(circle at bottom right, rgba(255,255,255,0.15), transparent 60%);
    pointer-events: none;
}
/* Розовый оттенок + изображение для карточки «Исправить текст» */
.img-fix .card-bg {
    background: linear-gradient(180deg, rgba(255,99,132,0.65) 0%, rgba(255,140,180,0.85) 100%), url('/static/img/AI-editor_card/chat_ed.png') center 45%/110% no-repeat;
}

/* Добавляем ту же размытую виньетку */
.img-fix.blur-edges::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.15), transparent 60%),
        radial-gradient(circle at top right, rgba(255,255,255,0.15), transparent 60%),
        radial-gradient(circle at bottom left, rgba(255,255,255,0.15), transparent 60%),
        radial-gradient(circle at bottom right, rgba(255,255,255,0.15), transparent 60%);
    pointer-events: none;
}
.card-content {
    position: absolute;
    bottom: 16px;
    left: 18px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}
.card-sub {
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.9;
}
/* Кнопка избранного */
.fav-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(4px);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
    outline: none;
}
.fav-btn:hover {
    background: rgba(255,255,255,0.45);
}
.fav-btn i {
    font-size: 1rem;
}

/* Floating icons override (make them light-red) */
.floating-icon {
    filter: hue-rotate(-20deg) brightness(1.1) saturate(1.3);
} 

/* --- Option buttons --- */
.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}


/* Modal fix for mobile */
.modal-content { border-radius: 16px; } 

/* --- Tabs --- */
.editor-tabs { 
    border-bottom: none; /* Remove the border */
    justify-content: flex-start; /* Align to the left */
    gap: 8px;
    margin-bottom: 1rem !important;
}
.tab-btn {
    flex: 0 1 auto; /* Allow buttons to size to content */
    border: none;
    background: #f1f3f5;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 20px; /* Make buttons more rounded (pill-shape) */
    transition: background 0.2s, color 0.2s;
    color: #495057;
}
.tab-btn.active {
    background: #007bff;
    color: #fff;
    box-shadow: none; /* Remove previous underline style */
}
/* History list */
#historyList { 
    margin:0; 
    padding:0; 
    list-style:none; 
    display: flex;
    flex-direction: column;
    gap: 12px; /* Tighter gap */
}

/* --- History Item (replaces Card) --- */
.history-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.history-item-text {
    white-space: pre-wrap;
    color: #343a40;
}
.history-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #f1f3f5;
}
.history-item-date {
    font-size: 0.8rem;
    color: #6c757d;
}
.history-item .copy-btn {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 4px;
}
.history-item .telegram-btn {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 4px;
}

/* History list (old styles, can be removed) */
#historyList li { display: none; }
#historyList .hist-date { display: none; } 

/* --- Modal Redesign (Write Text) --- */
/* Smaller, more modern modal */
#writeTextModal .modal-dialog {
    max-width: 400px; /* Make it smaller */
}
#writeTextModal .modal-content {
    border-radius: 20px; /* More rounded corners */
    border: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    max-height: 90vh; /* Ограничиваем высоту, чтобы не нужно было скроллить всю страницу */
    display: flex;
    flex-direction: column;
}
#writeTextModal .modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 0.75rem 1.25rem;
}
#writeTextModal .modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}
#writeTextModal .modal-body {
    padding: 0.75rem 1.25rem 1rem; /* Reduced vertical padding */
    overflow-y: auto; /* Внутренняя прокрутка, если контент превышает высоту */
}
#writeTextModal .modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 0.5rem 1.25rem;
}

/* Smaller footer buttons */
#writeTextModal .modal-footer .btn {
    padding: 5px 18px;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* Make form groups more compact */
#writeTextModal .form-group {
    margin-bottom: 0.6rem;
}

/* Custom Toggle Switch for 'Generate Image' */
.custom-switch-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    padding: 8px 14px; /* Reduced padding */
    border-radius: 12px;
    margin-bottom: 0.75rem; /* Reduced margin */
}
.custom-switch-label {
    margin-bottom: 0;
    font-weight: 500;
}
.custom-switch {
  position: relative;
  display: inline-block;
  width: 48px;  /* smaller */
  height: 26px; /* smaller */
}
.custom-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px; /* smaller */
  width: 20px;  /* smaller */
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: #007bff; /* Use theme color */
}
input:checked + .slider:before {
  transform: translateX(22px); /* smaller translation */
}
.slider.round {
  border-radius: 26px;
}
.slider.round:before {
  border-radius: 50%;
}

/* Option Buttons with icons */
.option-btn {
    display: inline-flex; /* Use inline-flex */
    align-items: center;
    gap: 6px; /* Space between icon and text */
    padding: 5px 12px; /* Reduced padding */
    font-weight: 500;
    font-size: 0.85rem;
    border: none;
    background: #e9ecef;
    border-radius: 12px;
    transition: background 0.2s, color 0.2s;
    color: #495057;
}
.option-btn.active {
    background: #007bff;
    color: #fff;
}
.option-btn:hover {
    background: #007bff;
    color: #fff;
}
.option-btn span {
    font-size: 1em;
    line-height: 1;
}

/* Label styling */
#writeTextModal .form-group > label {
    font-weight: 600;
    margin-bottom: 0.4rem; /* Reduced margin */
    font-size: 0.9rem;
}

/* Textarea styling */
#topicInput {
    border-radius: 12px;
    padding: 10px 14px;
}
#topicInput:focus {
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
    border-color: #80bdff;
} 

/* Rounded buttons from style block */
.btn-rounded {
    border-radius: 50px !important;
    padding-left: 20px;
    padding-right: 20px;
}

/* Tab button hover effects */
.tab-btn {
    transition: all 0.2s ease-in-out;
}
.tab-btn:hover {
    transform: scale(1.05);
    opacity: 0.85;
}
.tab-btn:not(.active):hover {
    background-color: rgba(0, 123, 255, 0.1);
    border-color: transparent;
}

/* Loading Modal Styles */
.loading-modal-content {
    background-color: #ffffff;
    border-radius: 16px;
    padding: 40px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.loading-spinner {
    color: #007bff;
    width: 50px;
    height: 50px;
    border-width: .3em;
    margin-top: 25px;
}
.loading-modal-content h5 {
    font-weight: 600;
    font-size: 1.3rem;
    color: #333;
}
.loading-dots .dot {
    display: inline-block;
    animation: dot-fade 1.4s infinite ease-in-out both;
}
.loading-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dots .dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes dot-fade {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

/* Footer Buttons in Modal */
.write-text-footer {
    display: flex;
    flex-direction: row;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 6px; /* Smaller gap between buttons */
    width: 100%;
}
.write-text-footer .btn {
    flex: 0 0 auto; /* Buttons take only needed width */
    padding: 6px 16px; /* Smaller size */
    font-size: 0.85rem; /* Slightly smaller text */
    white-space: nowrap; /* Prevent wrapping */
    width: auto !important; /* Override any 100% width */
    margin: 0 !important; /* Remove vertical margins */
} 

/* --- Modal Redesign (Fix Text) --- */
#fixTextModal .modal-dialog {
    max-width: 400px; /* Match Write Text modal width */
}
#fixTextModal .modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    max-height: 90vh; /* Prevent page scroll */
    display: flex;
    flex-direction: column;
}
#fixTextModal .modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding: 0.75rem 1.25rem;
}
#fixTextModal .modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}
#fixTextModal .modal-body {
    padding: 0.75rem 1.25rem 1rem;
    overflow-y: auto; /* Scroll inside modal if content exceeds */
}
#fixTextModal .modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 0.5rem 1.25rem;
}
#fixTextModal .modal-footer .btn {
    padding: 5px 18px;
    font-size: 0.85rem;
    border-radius: 10px;
} 

#writeTextModal .modal-dialog,
#fixTextModal .modal-dialog {
    margin-left: auto !important;
    margin-right: auto !important;
} 

.modal-footer.write-text-footer {
    background-color: transparent;
    border-top: none;
    padding: 1rem 1.5rem;
    justify-content: center;
} 

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

.note-item-content {
    display: flex;
    align-items: center;
}

.note-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    flex-shrink: 0;
}

.note-item-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Important for flexbox truncation */
} 

/* Стили для шапки - должны соответствовать tasks.css */
.tasks-header {
    background-color: #007bff;
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    position: relative;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.tasks-header .header-left,
.tasks-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.tasks-header .header-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    z-index: 2;
    width: 60%;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Стиль для строгого центрирования заголовка */
.tasks-header .header-title {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    margin: auto !important;
    text-align: center !important;
    width: fit-content !important;
    max-width: 80% !important;
    z-index: 10 !important;
    padding: 0 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    transform: translateX(0) !important;
}

/* Контейнер для плавающих иконок */
.floating-icons-container,
#header-floating-icons-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Иконки не будут мешать кликам по кнопкам */
    z-index: 1; /* Под контентом хедера */
    overflow: hidden;
}

/* Стили для самих иконок */
.floating-icon {
    position: absolute;
    display: block;
    opacity: 0.3; /* Начальная прозрачность */
    width: 28px;  /* Размер для SVG */
    height: 28px; /* Размер для SVG */
    filter: brightness(0) invert(1); /* Делает иконки белыми */
    z-index: 1;
    transition: opacity 0.5s ease; /* Добавляем плавность при изменении прозрачности */
}

@media (max-width: 480px) {
    .tasks-header {
        padding: 15px 10px;
    }
    
    .tasks-header .header-title {
        font-size: 1.3rem;
    }
    
    .tasks-header .header-button {
        width: 32px;
        height: 32px;
    }
    
    .tasks-header .header-left,
    .tasks-header .header-right {
        gap: 8px;
    }
} 