/* ==========================================================================
   admin.css - Единый файл стилей для админ-панели
   Основан на Bootstrap 4, с кастомными доработками
   ========================================================================== */

/* --------------------------------------
   1. ОБЩИЕ СТИЛИ И ТИПОГРАФИКА
   -------------------------------------- */
body {
    background-color: #f8f9fc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
    line-height: 1.5;
    margin: 0;
    padding-bottom: 30px;
}

/* Контейнер для контента админки */
.admin-wrapper {
    width: 100%;
    padding-top: 15px;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Заголовки страниц */
h1 {
    font-size: 1.8rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #34495e;
}

/* --------------------------------------
   2. НАВИГАЦИЯ
   -------------------------------------- */
.desktop-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 20px;
}

.nav-button {
    flex: 0 0 auto;
    margin: 2px;
}

.mobile-menu-container {
    margin-bottom: 20px;
}

.dropdown-menu {
    min-width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.1);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: #333;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

/* Десктопная навигация */
@media (min-width: 992px) {
    .mobile-menu-container {
        display: none !important;
    }
    .desktop-menu {
        display: flex !important;
    }
    .faq-actions {
        flex-direction: row;
    }
    .faq-actions .btn {
        flex: 0 0 auto;
        width: auto;
    }

}

/* Мобильная навигация */
@media (max-width: 991px) {
    .desktop-menu {
        display: none !important;
    }
    .mobile-menu-container {
        display: block !important;
    }
    .faq-actions {
        flex-direction: column;
    }
    .faq-actions .btn {
        width: 100%;
    }

    .mobile-menu-container {
        margin-top: 10px;
    }
    
    .mobile-menu-container .dropdown-toggle {
        margin-top: 5px;
        margin-bottom: 5px;
    }

}

/* --------------------------------------
   3. ТАБЛИЦЫ (десктопная версия)
   -------------------------------------- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    background-color: #fff;
    border-collapse: collapse;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
}

.table th {
    background-color: #f2f4f8;
    color: #2c3e50;
    font-weight: 600;
    padding: 12px 8px;
    border: 1px solid #dee2e6;
    white-space: nowrap;
    text-align: left;
}

.table td {
    padding: 10px 8px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #e9ecef;
}

.table tbody tr:hover td {
    background-color: #e9ecef;
}

/* Стили для ячейки с описанием */
.table td .description {
    font-size: 0.85rem;
    line-height: 1.5;
}

.table td .description strong {
    color: #495057;
    font-weight: 600;
}

/* Запрещаем перенос слов в колонке Статус */
.table td:nth-child(3), /* Статус */
.table th:nth-child(3),
.table td:nth-child(6), /* Тип */
.table th:nth-child(6) {
    white-space: nowrap;
}

/* Запрещаем перенос слов в колонке Статус для point_users (2-я колонка) */
.page-point-users .table td:nth-child(2), /* Статус */
.page-point-users .table th:nth-child(2),
.page-point-users .table td:nth-child(5), /* Тип */
.page-point-users .table th:nth-child(5) {
    white-space: nowrap;
}

/* --------------------------------------
   4. ФИЛЬТРЫ И ФОРМЫ ПОИСКА
   -------------------------------------- */
.filters-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.search-form {
    margin-bottom: 15px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background-color: #f8f9fc;
    padding: 10px 12px;
    border-radius: 5px;
    border: 1px solid #e9ecef;
}

.filter-group label {
    margin-bottom: 0;
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
    white-space: nowrap;
}

.filter-group .form-control {
    width: auto;
    min-width: 150px;
    display: inline-block;
}

.filter-group select.form-control {
    min-width: 170px;
}

.filter-group .btn {
    white-space: nowrap;
}

/* --------------------------------------
   5. ПАГИНАЦИЯ
   -------------------------------------- */
.pagination-container {
    margin: 25px 0 15px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 4px;
    flex-wrap: wrap;
    gap: 5px;
}

.page-item {
    display: inline-block;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #007bff;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s;
}

.page-link:hover {
    color: #0056b3;
    text-decoration: none;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    cursor: auto;
    background-color: #fff;
    border-color: #dee2e6;
}

.pagination-info {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 10px;
    text-align: center;
}

/* --------------------------------------
   6. КНОПКА "НАВЕРХ" (scroll-to-top)
   -------------------------------------- */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #007bff;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

/* --------------------------------------
   7. УТИЛИТЫ (helpers)
   -------------------------------------- */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

/* --------------------------------------
   8. МОБИЛЬНЫЕ СТИЛИ (до 991px)
   -------------------------------------- */
@media (max-width: 991px) {
    
    /* Фильтры на мобильных */
    .filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-group {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .filter-group .form-control,
    .filter-group select.form-control {
        width: 100%;
        min-width: 100%;
    }
    
    .filter-group .btn {
        width: 100%;
        margin-top: 5px;
    }
    
    /* Отступ между кнопками в формах */
    .row .col-md-6:first-child {
        margin-bottom: 15px !important;
    }
    
    /* Трансформация таблицы в карточки */
    .table, 
    .table thead, 
    .table tbody, 
    .table th, 
    .table td, 
    .table tr { 
        display: block; 
    }

    .table {
        background-color: transparent;
        border: none;
    }    

    .table thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table tbody tr {
        border: 1px solid #dee2e6;
        border-radius: 6px;
        margin-bottom: 15px;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .table td { 
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding: 10px 10px 10px 40%;
        text-align: left;
        white-space: normal;
        min-height: 30px;
    }
    
    .table td:last-child {
        border-bottom: none;
    }
    
    .table td:before { 
        position: absolute;
        left: 10px;
        width: 35%;
        padding-right: 10px;
        font-weight: 600;
        color: #495057;
        content: attr(data-label);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .table td .description {
        max-width: 100%;
	white-space: normal;
        margin: 0;
        padding: 0;
        border: none;
        background: transparent;
    }
    
    .table td .description strong {
        display: inline-block;
        min-width: 80px;
        color: #6c757d;
        font-weight: normal;
    }
    
    .table td .description hr,
    .table td .description h6 {
        display: none;
    }
}

/* --------------------------------------
   9. СПЕЦИФИЧЕСКИЕ ПРАВИЛА ДЛЯ СТРАНИЦ (тоже мобильные)
   -------------------------------------- */
@media (max-width: 991px) {
    
    /* Скрытие колонок для point_list */
    .page-point-list .table th:nth-child(5),
    .page-point-list .table td:nth-child(5),
    .page-point-list .table th:nth-child(7),
    .page-point-list .table td:nth-child(7) {
        display: none;
    }

    /* Скрытие колонок для point_users */
    .page-point-users .table th:nth-child(4),
    .page-point-users .table td:nth-child(4) {
        display: none;
    }
    
    /* Кнопки в таблицах на мобильных */
    .actions-cell .btn-text {
        display: none;
    }
    
    .actions-cell .btn {
        padding: 0.25rem 0.5rem;
    }
      
    .mobile-btn {
        display: inline-flex !important;
    }
}

/* --------------------------------------
   10. СПЕЦИАЛЬНО ДЛЯ icons_admin.php
   -------------------------------------- */
@media (max-width: 991px) {
    .table td[data-label="ID"]:before {
        content: "ID:";
    }
    .table td[data-label="Иконка"]:before {
        content: "Иконка:";
    }
    .table td[data-label="Тень"]:before {
        content: "Тень:";
    }
    .table td[data-label="Русское название"]:before {
        content: "Русское:";
    }
    .table td[data-label="Английское название"]:before {
        content: "Английское:";
    }
    .table td[data-label="Действия"]:before {
        content: "Действия:";
    }
}

/* --------------------------------------
   11. КНОПКИ В ТАБЛИЦАХ (общее)
   -------------------------------------- */
.actions-cell {
    white-space: nowrap;
    text-align: center;
}

.actions-cell .btn {
    margin: 0 2px;
}

/* По умолчанию показываем кнопки с текстом */
.mobile-btn {
    display: none !important;
}


/* --------------------------------------
   FAQ страница - кнопки скачать/загрузить
   -------------------------------------- */
.faq-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.faq-actions .btn {
    flex: 1;
}