/*
 * Версия 3.0 (Полная)
 * Функциональных изменений в CSS нет, но версия обновлена
 * для синхронизации с v3.0 PHP.
 */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0; 
}

.container {
    width: 100%; 
    max-width: 800px;
    margin: auto;
    background: #fff;
    padding: 0; 
    border: none; 
    border-radius: 0; 
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding: 10px 15px; 
    margin-bottom: 0; 
    gap: 10px;
}

.header h2 {
    margin: 0;
    font-size: 1.1em; 
    flex-shrink: 1; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    padding: 10px 15px; 
    flex-shrink: 0; 
}
.logout-btn:hover {
    background-color: #f5c6cb;
}

/* --- Стили v1.9 (Поиск) --- */
.search-form {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    padding: 0 5px;
}
.search-input {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 20px; 
    font-size: 1em;
}

/* --- Стили v2.0 (Update 1: Вкладки) --- */
.task-tabs {
    display: flex;
    justify-content: stretch;
    margin: 20px 10px 0 10px; 
    border: 1px solid #000; 
    border-radius: 5px;
    overflow: hidden;
}
.task-tabs a {
    flex-basis: 50%; 
    flex-grow: 1;
    text-align: center;
    padding: 12px 10px;
    text-decoration: none;
    color: #000;
    font-weight: bold;
    background-color: #f0f0f0; 
    border-bottom: none; 
}
.task-tabs a:first-child {
    border-right: 1px solid #000; 
}
.task-tabs a.active {
    background-color: #fff; 
    color: #000;
    border-bottom: none; 
}
.task-tabs a:not(.active):hover {
    background-color: #e9e9e9;
}

/* --- Стили v1.9 (Update 5: Центрирование кнопок) --- */
.button-container {
    text-align: center;
    padding: 10px 0;
}
/* Стили для кнопок на ПК */
.button-container .btn,
.button-container button {
    display: inline-block;
    width: auto; 
    margin: 5px;
    padding: 10px 20px;
}
/* Стили для "Добавить задачу" (остается по центру) */
.button-container .add-task-btn {
    width: 90%;
    max-width: 300px;
}


/* Контент (для отступов) */
.content {
    padding: 0 10px;
}

/* --- БАЗОВЫЕ СТИЛИ КНОПОК (v1.1) --- */
button, input[type="submit"], .btn {
    text-decoration: none;
    color: #000;
    display: inline-block;
    background-color: #e0e0e0;
    border: 1px solid #999;
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
}
button:hover, input[type="submit"]:hover, .btn:hover {
    background-color: #d0d0d0;
}

/* --- Стили v2.9 (Кнопка "Удалить") --- */
.btn-delete {
    background-color: #dc3545; /* Красный */
    border-color: #b02a37;
    color: #fff;
}
.btn-delete:hover {
    background-color: #c82333; /* Чуть темнее */
    color: #fff;
}


/* Стили для полей ввода */
input[type="text"], input[type="password"], textarea, select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    margin: 5px 0;
    box-sizing: border-box; 
}
/* Стиль для поля загрузки файлов */
input[type="file"] {
    width: 100%;
    padding: 10px;
    background: #f9f9f9;
    border: 1px dashed #ccc;
}
input[type="text"], input[type="password"] {
     width: 250px;
}
select {
    width: 268px;
}
textarea {
    width: 90%;
    min-width: 90%;
    max-width: 90%;
    min-height: 100px;
}

/* Стили для таблицы (Экран 2) */
.user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.user-table thead { display: table-header-group; }
.user-table tr { display: table-row; }
.user-table th, .user-table td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: left;
    display: table-cell; 
}
.user-table th { background-color: #f0f0f0; }

.form-group {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #eee;
}
.form-group label {
    display: inline-block;
    width: 100px;
}
.error {
    color: red;
    font-weight: bold;
    text-align: center;
    padding: 10px;
}

/* --- Стили Списка Задач (v2.0) --- */
.task-list {
    list-style: none;
    padding: 0;
    margin: 15px 10px 0 10px; 
}
.task-item {
    border: 1px solid #aaa; 
    margin: 0 0 10px 0; 
    background: #fff;
    border-radius: 4px; 
    overflow: hidden; 
    padding: 0;
    cursor: pointer; 
    transition: background-color 0.2s ease; 
}
.task-item:last-child {
    margin-bottom: 0;
}
.task-item:hover {
    background-color: #f9f9f9; 
}
.task-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
    min-height: 80px; 
}
.task-status {
    width: 30px; 
    align-self: stretch; 
    margin-right: 15px;
}
.status-new { background-color: #dc3545; }
.status-revision { background-color: #ffc107; }
.status-completed { background-color: #28a745; }

.task-text {
    flex-grow: 1; 
    padding: 15px 10px 15px 0; 
    font-size: 1.0em; 
}
.task-text small {
    font-size: 0.9em;
}
.task-action { display: none; } 

/* --- Стили Просмотра Задачи (v1.3) --- */
.task-view-box {
    border: 1px solid #000; 
    padding: 10px;
    background-color: #fff;
    min-height: 150px;
    margin-bottom: 20px;
}
.task-view-label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
}
.task-view-text {
    white-space: pre-wrap; 
    font-family: Arial, sans-serif;
}
.task-view-actions { 
    margin-top: 20px;
    gap: 15px; 
}

/* --- Стили v2.8 (Блок с файлами) --- */
.task-files-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
    justify-content: center; 
}
.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%; 
    max-width: 300px; 
}
.file-item img {
    width: 100%; 
    height: auto; 
    max-height: 300px; 
    object-fit: contain; 
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer; 
}
.file-item a.file-download-link {
    font-size: 14px;
    color: #337ab7;
    text-decoration: none;
    margin-top: 8px;
    text-align: center;
    word-break: break-all; 
}
.file-item a.file-download-link:hover {
    text-decoration: underline;
}


/* ===============================================
--- АДАПТАЦИЯ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ (v2.9) ---
===============================================
*/
@media (max-width: 768px) {
    body {
        font-size: 16px; 
        -webkit-text-size-adjust: 100%; 
    }
    
    .header {
        flex-wrap: nowrap; 
        justify-content: space-between;
        padding: 10px;
        gap: 10px; 
    }
    .header h2 {
        width: auto; 
        text-align: left; 
        margin-bottom: 0; 
        font-size: 1.2em;
        flex-grow: 0; 
        flex-shrink: 0; 
    }
    .search-form {
        flex-grow: 1; 
        flex-shrink: 1; 
        order: 0; 
        width: auto; 
        padding: 0; 
        margin-top: 0;
    }    
    .search-input {
        max-width: none;
        width: 100%;
        font-size: 1em;
        padding: 8px 12px; 
    }
    .logout-btn {
        order: 0; 
        flex-shrink: 0; 
        padding: 10px 12px; 
    }

    .content {
        padding: 0 10px; 
    }
    
    .form-group { padding: 0; }
    .form-group label { display: block; width: auto; margin-bottom: 5px; }
    
    input[type="text"], input[type="password"], textarea, select {
        width: 100%; 
        font-size: 1.1em; 
        padding: 12px;
    }
    
    .button-container .btn,
    .button-container button {
        display: block; 
        width: 100%; 
        text-align: center; 
        margin: 0; 
        margin-bottom: 8px; 
        padding: 15px 10px; 
        font-size: 1.1em;
        box-sizing: border-box; 
    }
    .button-container .btn:last-child,
    .button-container button:last-child {
        margin-bottom: 0;
    }
    
    .button-container .add-task-btn {
        width: 100%; 
        max-width: none;
    }

    /* Стили вкладок на мобильном */
    .task-tabs { 
        margin: 15px 0 0 0; 
    }
    .task-tabs a { 
        padding: 10px 5px; 
        font-size: 0.9em; 
        word-break: break-word; 
    }

    /* Стили списка задач на мобильном */
    .task-list {
        margin: 15px 0 0 0; 
    }
    .task-item { 
        margin: 0 0 10px 0; 
        border: 1px solid #aaa; 
        border-radius: 4px; 
    }
    .task-link { min-height: 70px; }
    .task-status { width: 15px; margin-right: 10px; }
    .task-text { padding-right: 10px; }


    /* --- Таблица в Админке (Экран 2) --- */
    .user-table thead { display: none; }
    .user-table tr {
        display: block; 
        border: 1px solid #ccc;
        border-radius: 5px;
        margin-bottom: 15px;
    }
    .user-table td {
        display: block; 
        text-align: right; 
        padding-left: 40%; 
        position: relative;
        border: none;
        border-bottom: 1px solid #eee;
    }
    .user-table td:last-child { border-bottom: none; }
    .user-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        text-align: left;
        font-weight: bold;
        white-space: nowrap; 
    }
    .user-table td[data-label="Удалить"]:before { content: ""; }
    .user-table td[data-label="Удалить"] {
        padding-left: 10px;
        text-align: left;
    }

    /* --- СТИЛИ v2.9 (Фикс ширины фото) --- */
    .task-files-container {
        margin-left: -10px;  
        margin-right: -10px; 
        width: calc(100% + 20px); 
        padding: 10px 0; 
        border-radius: 0; 
        border-left: none; 
        border-right: none;
    }
    
    .file-item {
        width: 100%; 
        max-width: none; 
        padding: 0 10px; 
        box-sizing: border-box; 
    }
    
    .file-item img {
        width: 100%;
        max-width: 100%; 
        height: auto;
        max-height: 250px; 
    }
    /* --- КОНЕЦ ИЗМЕНЕНИЙ v2.9 --- */
}