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

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 20px 0;
    color: #333;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    overflow-x: hidden; /* Предотвращаем горизонтальный скролл */
    overflow-y: auto; /* Разрешаем вертикальный скролл */
    /* Скрываем скроллбар для всех браузеров */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

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

/* Контейнер для центрирования содержимого */
.calendar-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 40px); /* Учитываем padding body */
}

.tasks-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 800px; /* Ширина для календаря */
    margin: 0 20px;
    overflow: visible; /* Разрешаем переполнение для скролла */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Убираем минимальную высоту */
}

/* Стили для шапки - должны соответствовать 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;
    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;
}

.tasks-header .back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    transition: all 0.2s;
    margin-right: 0;
    text-decoration: none;
    z-index: 10;
    color: #fff;
    padding: 0;
}
.tasks-header .back-button:hover, .tasks-header .back-button:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    text-decoration: none;
}
.tasks-header .back-button .fa-home {
    color: #fff;
    font-size: 1.1rem;
}
.tasks-header .back-button:hover .fa-home {
    color: #fff;
}

.tasks-header .add-task-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    transition: all 0.2s;
    margin-left: auto;
    text-decoration: none;
    z-index: 10;
    color: #fff;
    padding: 0;
}
.tasks-header .add-task-btn:hover,
.tasks-header .add-task-btn:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}
.tasks-header .add-task-btn .fa-plus {
    color: #fff;
    font-size: 1.1rem;
}

.tasks-body {
    padding: 20px;
}

/* Контейнер для плавающих иконок */
#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; /* Добавляем плавность при изменении прозрачности */
}


/* Шапка календаря */
.calendar-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
}

#month-year-container {
    position: relative;
    margin: 0 80px; /* Увеличиваем расстояние до стрелок */
    padding-bottom: 1.2rem; /* Делаем место для года снизу */
    text-align: center;
}

#current-month {
    font-size: 2rem; /* Немного увеличим шрифт */
    font-weight: 700;
    color: #222;
}

#current-year {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 600;
    color: #999;
}

.month-nav-btn {
    background: #007bff; /* Синий фон */
    border: none;
    font-size: 0.9rem; /* Немного уменьшим иконку */
    color: #ffffff; /* Белая стрелка */
    cursor: pointer;
    border-radius: 50%;
    width: 32px; /* Уменьшаем размер */
    height: 32px; /* Уменьшаем размер */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: all 0.2s ease-in-out;
    outline: none;
    position: relative;
}
.month-nav-btn:hover, .month-nav-btn:focus {
    background: #0056b3; /* Более темный синий при наведении */
    color: #ffffff; /* Стрелка остается белой */
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
    transform: translateY(-2px);
}
.month-nav-btn:active {
    background: #0056b3;
    transform: translateY(0);
}
.month-nav-btn[disabled] {
    color: #bbb;
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    background: #f8f9fa;
}

/* Сетка календаря */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.day-name {
    text-align: center;
    font-weight: 600;
    color: #aaa;
    margin-bottom: 10px;
}

.day-cell {
    position: relative;
    padding: 10px;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.25s, color 0.25s;
    font-weight: 500;
}

.day-cell:hover {
    background-color: #f0f0f0;
}

.day-cell.other-month {
    color: #ccc;
    cursor: default;
}

.day-cell.today {
    color: #22c55e; /* Green */
    font-weight: 700;
    border: 2px solid #22c55e; /* Green */
    padding: 8px;
}

.day-cell.selected {
    background-color: #007bff; /* Blue */
    color: #fff;
    font-weight: 700;
    border: 2px solid #007bff; /* Blue */
    padding: 8px;
}

/* When the current day is selected - make it green */
.day-cell.selected.today,
.day-cell.today.selected {
    background-color: #22c55e; /* Green background */
    color: #fff; /* White text */
    border: 2px solid #22c55e; /* Green border */
}

.day-cell .task-dots-container {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
}

.day-cell .task-dot {
    position: relative; /* Changed from absolute */
    bottom: auto;
    left: auto;
    transform: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    /* Цвет по умолчанию убираем, будем задавать классами */
}

/* Цвета для точек */
.task-dot.pending { background-color: #3b82f6; } /* Blue */
.task-dot.started { background-color: #f97316; } /* Orange */
.task-dot.completed { background-color: #22c55e; } /* Green */
.task-dot.failed { background-color: #ef4444; } /* Red */


/* Список задач */
.tasks-for-day {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

#tasks-date-header {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
}

#tasks-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#tasks-list li {
    display: flex;
    align-items: stretch; /* Важно для растягивания бордера */
    padding: 0;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    background: #fdf2f2; /* Легкий фон для задачи */
}

#tasks-list li:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.07);
}


#tasks-list .task-details {
    padding: 15px;
    display: flex;
    align-items: center;
    /* Occupy the remaining width next to the colored bar without causing overflow */
    flex: 1;
    min-width: 0; /* allow the content to shrink inside flex container */
    padding-right: 110px; /* reserve space so status text doesn't overlap */
    position: relative; /* Для позиционирования статуса */
}

#tasks-list .task-info {
    display: flex;
    flex-direction: column;
    margin-left: 20px;
    flex: 1;
    min-width: 0; /* allow flexbox shrink and ellipsis */
}

#tasks-list .task-time {
    font-weight: 600;
    color: #333;
    display: flex;
    flex-direction: column;
}

#tasks-list .task-title {
    font-weight: 500;
}

#tasks-list .task-description {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px; /* Ограничим ширину, чтобы не ломать верстку */
}

#tasks-list .task-status {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap; /* keep status on one line */
}

#tasks-list .task-color-bar {
    width: 5px;
    background-color: #ef4444; /* Default red */
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    transition: background-color 0.3s;
}

/* Status Colors */
#tasks-list li.pending .task-color-bar {
    background-color: #3b82f6; /* Blue */
}
#tasks-list li.pending {
    background-color: #eff6ff; /* Light Blue BG */
}
#tasks-list li.pending .task-status {
    color: #3b82f6;
}

#tasks-list li.started .task-color-bar {
    background-color: #f97316; /* Orange */
}
#tasks-list li.started {
    background-color: #fff7ed; /* Light Orange BG */
}
#tasks-list li.started .task-status {
    color: #f97316;
}

#tasks-list li.completed .task-color-bar {
    background-color: #22c55e; /* Green */
}
#tasks-list li.completed {
    background-color: #f0fdf4; /* Light Green BG */
}
#tasks-list li.completed .task-status {
    color: #22c55e;
}
#tasks-list li.completed .task-title,
#tasks-list li.completed .task-time {
    color: #999;
}

#tasks-list li.failed .task-color-bar {
    background-color: #ef4444; /* Red */
}
#tasks-list li.failed {
    background-color: #fef2f2; /* Light Red BG */
}
#tasks-list li.failed .task-status {
    color: #ef4444;
}
#tasks-list li.failed .task-title,
#tasks-list li.failed .task-time {
    color: #999;
}


#no-tasks-message {
    text-align: center;
    color: #888;
    font-style: normal; /* Remove italic style */
    margin-top: 20px;
    padding: 15px;
    background-color: #fafafa;
    border-radius: 8px;
}

.tasks-list li .task-description {
    font-size: 0.9rem;
    color: #666;
}

.tasks-header-with-add {
    display: flex;
    justify-content: flex-start; /* Align items to the left */
    align-items: center;
    gap: 12px; /* Add space between date and button */
    margin-bottom: 15px; /* Add some space below */
}

.no-tasks-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #888;
    font-style: italic;
    margin-top: 20px;
    padding: 15px;
    background-color: #fafafa;
    border-radius: 8px;
    gap: 15px;
}

.add-task-plus-btn {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem; /* Increased icon size */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    margin-top: -23px;
}

.add-task-plus-btn:hover {
    background-color: #0056b3;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

/* Стили для модального окна деталей задачи */
#taskDetailModal .modal-content {
    border-radius: 16px; /* Более скругленные углы */
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    background-color: #f8f9fa; /* Светлый фон */
}

#taskDetailModal .modal-header {
    border-bottom: none; /* Убираем границу */
    padding: 20px 20px 10px 20px;
}

#taskDetailModal .modal-header .modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #6c757d; /* Серый цвет для "Детали задачи" */
}

#taskDetailModal .modal-header .close {
    font-size: 1.5rem;
    color: #adb5bd;
    text-shadow: none;
    transition: color 0.2s;
}
#taskDetailModal .modal-header .close:hover {
    color: #343a40;
}

#taskDetailModal .modal-body {
    padding: 0 20px 20px 20px;
}

#taskDetailModal #modalTaskTitle {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 5px;
}

#taskDetailModal #modalTaskDescription {
    font-size: 1rem;
    color: #6c757d;
    margin-bottom: 20px;
}

#taskDetailModal ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#taskDetailModal .modal-body li {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

#taskDetailModal .modal-body li:last-child {
    border-bottom: none;
}

#taskDetailModal .modal-body .icon-label {
    width: 24px;
    text-align: center;
    margin-right: 20px;
    color: #adb5bd;
    font-size: 1.1rem;
}

#taskDetailModal .modal-body .task-detail-text {
    font-weight: 500;
    color: #343a40;
}

/* Красный восклицательный знак */
#taskDetailModal li.important .icon-label {
    color: #dc3545;
}

#taskDetailModal .task-image-preview,
#taskDetailModal .task-audio-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

#taskDetailModal .task-image-preview img,
#taskDetailModal .task-audio-preview audio {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 10px;
}

/* Современный стиль модального окна */
.modal-content {
    border-radius: 18px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: none;
    overflow: hidden;
    background: #fff;
}
.modal-header {
    border-top-left-radius: 18px !important;
    border-top-right-radius: 18px !important;
    background: #f8fafd;
    border-bottom: none;
    padding-top: 22px;
    padding-bottom: 18px;
}
.modal-footer {
    border-bottom-left-radius: 18px !important;
    border-bottom-right-radius: 18px !important;
    background: #f8fafd;
    border-top: none;
    padding-bottom: 22px;
    padding-top: 18px;
}

/* Современные inline-поля редактирования */
.modal-inline-edit {
    background: #f8fafd;
    border: 1.5px solid #e3eaf3;
    border-radius: 10px;
    font-size: 1.08em;
    font-weight: 500;
    color: #222;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 7px 12px;
    margin: 0;
    outline: none;
    transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
}
.modal-inline-edit:focus {
    border-color: #007bff;
    background: #f3f8ff;
    box-shadow: 0 4px 16px rgba(0,123,255,0.08);
}

.editing input.modal-inline-edit,
.editing textarea.modal-inline-edit,
.editing select.modal-inline-edit {
    background: #f3f8ff;
}

.modal-inline-edit textarea {
    resize: vertical;
    min-height: 32px;
    max-height: 120px;
    border-radius: 10px;
}

/* Кнопка сохранить — современная */
#saveTaskEditBtn.btn {
    border-radius: 12px;
    font-size: 1.13em;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,123,255,0.08);
    padding: 13px 0;
    letter-spacing: 0.01em;
    transition: background 0.18s, box-shadow 0.18s;
}
#saveTaskEditBtn.btn-primary {
    background: linear-gradient(90deg, #2196f3 0%, #007bff 100%);
    border: none;
    transition: background 0.18s, box-shadow 0.18s, transform 0.18s;
}
#saveTaskEditBtn.btn-primary:hover {
    background: linear-gradient(90deg, #007bff 0%, #2196f3 100%);
    box-shadow: 0 8px 32px rgba(33,150,243,0.18);
    transform: scale(1.035);
    filter: brightness(1.08) saturate(1.15);
}

/* Мелкие улучшения для иконок и текста */
.icon-label {
    color: #007bff;
    font-size: 1.13em;
    margin-right: 7px;
}
.editable-field {
    border-radius: 8px;
    transition: background 0.18s;
}
.editable-field.editing {
    background: #f3f8ff;
}

/* Всплывающее уведомление для календаря */
.calendar-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #007bff;
    color: #fff;
    padding: 14px 32px;
    border-radius: 10px;
    font-size: 1.08em;
    font-weight: 500;
    box-shadow: 0 4px 18px rgba(0,0,0,0.13);
    opacity: 0;
    z-index: 2000;
    pointer-events: none;
    transition: opacity 0.4s, transform 0.4s;
}
.calendar-toast-success {
    background: #28a745;
}
.calendar-toast-error {
    background: #dc3545;
}
.calendar-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
} 

.calendar-day.today {
    background-color: #e0e0e0;
    font-weight: bold;
}

/* Скрываем все скроллбары на странице календаря */
.calendar-page ::-webkit-scrollbar {
    display: none;
}

.calendar-page {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

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

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

@media (max-width: 600px) {
    body {
        padding: 10px 0; /* Уменьшаем отступы на мобильных */
    }
    
    .calendar-page {
        min-height: calc(100vh - 20px); /* Учитываем новые отступы */
    }
    
    .tasks-container {
        margin: 0 10px;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        min-height: 0; /* Убираем фиксированную высоту */
    }
    .tasks-body {
        padding: 15px;
    }
    .calendar-container {
        max-width: 100%;
        padding: 8px;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        min-width: 0;
    }
} 

/* ===== Calendar Task Form Modal Modern Styles ===== */
#calendarTaskFormModal .modal-content {
    border-radius: 18px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: none;
    overflow: hidden;
}
#calendarTaskFormModal .modal-header {
    border-top-left-radius: 18px !important;
    border-top-right-radius: 18px !important;
    background: #f8fafd;
    border-bottom: none;
    padding-top: 22px;
    padding-bottom: 18px;
}
#calendarTaskFormModal .modal-header .modal-title {
    font-size: 1.4rem;
    font-weight: 600;
}
#calendarTaskFormModal .modal-header .close {
    font-size: 1.5rem;
    color: #adb5bd;
    text-shadow: none;
    transition: color 0.2s;
}
#calendarTaskFormModal .modal-header .close:hover {
    color: #343a40;
}
#calendarTaskFormModal .modal-body {
    padding: 25px 25px 10px 25px;
}
#calendarTaskFormModal .modal-footer {
    border-bottom-left-radius: 18px !important;
    border-bottom-right-radius: 18px !important;
    background: #f8fafd;
    border-top: none;
    padding: 18px 25px 22px 25px;
}
#calendarTaskFormModal .modal-footer .btn {
    padding: 12px 30px;
    font-size: 1.05rem;
    border-radius: 25px;
    min-width: 140px;
    font-weight: 600;
    transition: all 0.2s ease;
}
#calendarTaskFormModal .modal-footer .btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}
#calendarTaskFormModal .modal-footer .btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.4);
}
#calendarTaskFormModal .modal-footer .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    box-shadow: 0 4px 10px rgba(108, 117, 125, 0.3);
}
#calendarTaskFormModal .modal-footer .btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 117, 125, 0.4);
}

/* ===== Inputs refinement ===== */
#calendarTaskFormModal .form-control {
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 500;
    border: 1.5px solid #e3eaf3;
    transition: box-shadow 0.2s, border-color 0.2s;
}
#calendarTaskFormModal .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* ===== Important toggle ===== */
#calendarTaskIsImportantInput {
    display: none; /* hide default checkbox */
}
#calendarTaskIsImportantInput + .form-check-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #555;
}
#calendarTaskIsImportantInput + .form-check-label .important-toggle-icon {
    color: #adb5bd; /* default grey */
    margin-right: 8px;
    font-size: 1.3rem;
    transition: color 0.2s ease, transform 0.2s ease;
}
#calendarTaskIsImportantInput + .form-check-label:hover .important-toggle-icon {
    transform: scale(1.05);
}
#calendarTaskIsImportantInput:checked + .form-check-label .important-toggle-icon {
    color: #dc3545; /* red when active */
    transform: scale(1.1);
} 

@media (max-width: 480px) {
    body {
        padding: 5px 0; /* Минимальные отступы на очень маленьких экранах */
    }
    
    .calendar-page {
        min-height: calc(100vh - 10px);
    }
    
    .tasks-container {
        margin: 0 5px;
        border-radius: 8px;
    }
    
    .tasks-header {
        padding: 15px 10px;
    }
    
    .tasks-header .header-title {
        font-size: 1.3rem;
    }
    
    .tasks-header .header-button {
        width: 28px;
        height: 28px;
    }
    
    .tasks-header .header-left,
    .tasks-header .header-right {
        gap: 8px;
    }
    
    .tasks-body {
        padding: 10px;
    }
} 