/**
 * ACF Table Module Styles
 * Стили для ACF таблиц
 * 
 * @package GamblingTheme
 * @version 1.1.0 (Удалён устаревший .gt-table-title)
 * 
 * ИЗМЕНЕНИЯ:
 * - Удалён устаревший класс .gt-table-title
 * - Унифицирован класс .gt-table-caption для всех блоков
 * - Добавлены стили промокода (красный + подчёркивание)
 * - Добавлено уведомление "Промокод скопирован" (над промокодом)
 * - Оптимизированы transitions (убран transition: all)
 * - Исправлены проблемы доступности (a11y)
 * - Добавлены недостающие CSS-переменные
 */

/* ============================================
   CSS ПЕРЕМЕННЫЕ (для простой кастомизации)
   ============================================ */

:root {
    /* Цвета брендинга */
    --gt-table-primary: #667eea;
    --gt-table-secondary: #764ba2;
    --gt-table-success: #4caf50;
    --gt-table-danger: #f44336;
    --gt-table-warning: #ff9800;
    --gt-table-info: #1565c0;
    
    /* Нейтральные цвета */
    --gt-table-light: #292930;      /*--gt-table-light: #f8f9fa;*/
    --gt-table-border: #e9ecef;
    --gt-table-text: #ffffff;    /*--gt-table-text: #495057;*/
    --gt-table-muted: #6c757d;
    
    /* Стили */
    --gt-table-radius: 8px;
    --gt-table-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --gt-table-hover-bg: #e3f2fd;
    
    /* НОВОЕ: Промокод */
    --gt-promo-color: #dc3545;
    --gt-promo-hover: #c82333;
}

/* ============================================
   ОБЁРТКА ТАБЛИЦЫ
   ============================================ */

.gt-table-wrapper {
    margin: 20px 0px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
/*    border-radius: var(--gt-table-radius);*/
    box-shadow: var(--gt-table-shadow);
    background: #fff;
}

/* ============================================
   БАЗОВЫЕ СТИЛИ ТАБЛИЦЫ
   ============================================ */

.gt-table {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    background: #fff;
    table-layout: auto;
}

.gt-table th {
    /* Fallback для старых браузеров */
    background: var(--gt-table-primary);
    background: linear-gradient(135deg, var(--gt-table-primary) 0%, var(--gt-table-secondary) 100%);
    color: #fff;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border: none;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.gt-table td {
    padding: 12px;
    border-bottom: none;  
/*    border-bottom: 5px solid var(--gt-table-border);*/
    vertical-align: middle;
    line-height: 1.5;
    word-wrap: break-word;
}

.gt-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   ВАРИАНТЫ СТИЛЕЙ
   ============================================ */

.gt-table-striped tbody tr:nth-child(even) {
    background-color: var(--gt-table-light);
}

.gt-table-hover tbody tr {
    /* ОПТИМИЗИРОВАНО: только background-color вместо all */
    transition: background-color 0.2s ease;
}

.gt-table-hover tbody tr:hover {
    background-color: var(--gt-table-hover-bg);
}

.gt-table-compact th,
.gt-table-compact td {
    padding: 8px 10px;
    font-size: 13px;
}

.gt-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   ТИПЫ ПОЛЕЙ
   ============================================ */

.gt-table .type-number {
    text-align: right;
    font-weight: 600;
    color: #2e7d8a;
    font-variant-numeric: tabular-nums;
}

.gt-table .type-url a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.gt-table .type-url a:hover {
    text-decoration: underline;
}

.gt-table .type-url a:focus-visible {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

.gt-table .type-email a {
    color: #388e3c;
    text-decoration: none;
}

.gt-table .type-email a:hover {
    text-decoration: underline;
}

.gt-table .gt-table-yes {
    color: var(--gt-table-success);
    font-weight: 600;
}

.gt-table .gt-table-no {
    color: var(--gt-table-danger);
    font-weight: 600;
}

.gt-table .gt-table-empty-cell {
    color: var(--gt-table-muted);
    font-style: italic;
    opacity: 0.7;
}

.gt-table .gt-table-array {
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--gt-table-info);
    display: inline-block;
}

.gt-table .gt-table-no-image {
    color: #9e9e9e;
    font-style: italic;
    font-size: 12px;
}

/* ============================================
   ЭЛЕМЕНТЫ УПРАВЛЕНИЯ
   ============================================ */

.gt-table-search {
    padding: 15px;
    background: var(--gt-table-light);
    border-bottom: 1px solid #dee2e6;
}

.gt-table-search input {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    border: 2px solid var(--gt-table-border);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    /* ОПТИМИЗИРОВАНО: только нужные свойства вместо all */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.gt-table-search input:focus-visible {
    border-color: var(--gt-table-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.gt-table-export {
    padding: 10px 15px;
    background: var(--gt-table-light);
    border-bottom: 1px solid #dee2e6;
    text-align: right;
}

.gt-table-export button {
    /* Fallback */
    background: #28a745;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    /* ОПТИМИЗИРОВАНО: только transform и box-shadow вместо all */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gt-table-export button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.gt-table-export button:active {
    transform: translateY(0);
}

.gt-table-export button:focus-visible {
    outline: 2px solid #28a745;
    outline-offset: 2px;
}

.gt-table-info {
    padding: 10px 15px;
    background: var(--gt-table-light);
    border-top: 1px solid #dee2e6;
    text-align: center;
    color: var(--gt-table-muted);
    font-size: 13px;
}

/* ============================================
   ОШИБКИ И ПРЕДУПРЕЖДЕНИЯ
   ============================================ */

.gt-table-error {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-left: 4px solid var(--gt-table-warning);
    color: #856404;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    font-weight: 500;
}

.gt-table-empty {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: var(--gt-table-info);
    padding: 20px;
    text-align: center;
    border-radius: 6px;
    margin: 20px 0;
    font-style: italic;
}

/* ============================================
   ВЕРТИКАЛЬНАЯ ТАБЛИЦА
   ============================================ */

.gt-table-vertical {
    table-layout: fixed;
}

.gt-table-vertical .gt-table-label {
    font-weight: 600;
    color: #fff;    /*color: #333;*/
    padding: 12px 15px;
/*    border-right: 2px solid #dee2e6;*/
    vertical-align: middle;
    width: 40%;
    background: transparent;  /* Убираем фиксированный фон */
}

.gt-table-vertical .gt-table-value {
    padding: 12px 15px;
    color: var(--gt-table-text);
    vertical-align: middle;
    word-break: break-word;
    background: transparent;  /* Убираем фиксированный фон */
}

/* НОВОЕ: Зебра-полосы для вертикальной таблицы */
.gt-table-vertical tbody tr {
    border-bottom: 1px solid var(--gt-table-border);
}

/* Нечётные строки (1, 3, 5, ...) - ТЕМНЫЕ */
.gt-table-vertical tbody tr:nth-child(odd) {
    background-color: var(--gt-table-light);  /* #f8f9fa - светло-серый */
    border-color: var(--gt-table-light);
}

/* Чётные строки (2, 4, 6, ...) - СВЕТЛЫЕ */
.gt-table-vertical tbody tr:nth-child(even) {
    background-color: #1c1c25;    /*background-color: #ffffff;  /* Белый */
    border-color: #1c1c25;
}

.gt-table-vertical tbody tr:last-child {
    border-bottom: none;
}

/* НОВОЕ: Hover эффект для вертикальной таблицы */
/*.gt-table-vertical tbody tr:hover {
    background-color: var(--gt-table-hover-bg);  /* #e3f2fd - голубоватый */
    transition: background-color 0.2s ease;
/*}*/

/* ============================================
   ПРОМОКОД (КРАСНЫЙ + ПОДЧЁРКИВАНИЕ)
   ============================================ */

/* Обёртка промокода */
.promo-code-wrapper {
    position: relative;
    display: inline-block;
}

/* Кликабельный промокод */
.promo-code-clickable {
    color: var(--gt-promo-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s ease;
}

.promo-code-clickable:hover {
    color: var(--gt-promo-hover);
    text-decoration: underline;
}

.promo-code-clickable:focus-visible {
    outline: 2px solid var(--gt-promo-color);
    outline-offset: 2px;
}

/* Уведомление о копировании */
.promo-copied-notification {
    opacity: 0;
    position: absolute;
/*    top: -50px;*/
/*    left: 10px;*/
    background: #28a745;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    pointer-events: none;
}

.promo-copied-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-3px);
}

/* Анимация появления/исчезновения */
@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    10%, 90% { opacity: 1; }
}

/* Стрелочка снизу уведомления */
.promo-copied-notification::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--gt-table-success);
}

/* ============================================
   ВНЕШНИЕ ССЫЛКИ (просто красный подчёркнутый текст)
   ============================================ */

.gt-table-external-link {
    color: var(--gt-promo-color);
    text-decoration: underline;
    font-weight: 600;
    /* ОПТИМИЗИРОВАНО: только color вместо all */
    transition: color 0.2s ease;
}

.gt-table-external-link:hover {
    color: var(--gt-promo-hover);
    text-decoration: underline;
}

/* ИСПРАВЛЕНО: убран outline: none, только focus-visible */
.gt-table-external-link:focus-visible {
    outline: 2px solid var(--gt-promo-color);
    outline-offset: 2px;
}

/* ============================================
   ИЗОБРАЖЕНИЯ
   ============================================ */

.gt-table-image {
    max-width: 50px;
    height: auto;
    border-radius: 4px;
    display: block;
    object-fit: cover;
}

/* ============================================
   UNIFIED TABLE CAPTION STYLE
   Унифицированный стиль названий таблиц
   ============================================ */

.gt-table-caption {
    /* Базовые параметры */
    font-size: inherit;           /* Размер как у основного текста */
    color: inherit;                /* Цвет как у основного текста */
    font-weight: normal;           /* Обычный вес (не жирный) */
    font-style: italic;            /* Наклонный (курсив) */
    
    /* Выравнивание */
    text-align: right;             /* Прижат к правому краю */
    
    /* Отступы */
    margin: 15px 0 10px 0;         /* Отступ сверху и снизу */
    padding: 0;
    
    /* Дополнительно */
    line-height: 1.5;
}

/* ============================================
   ДОСТУПНОСТЬ (A11Y)
   ============================================ */

/* Скрытие визуально, но доступно для скринридеров */
.gt-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 768px) {
    .gt-table-responsive {
        font-size: 12px;
    }
    
    .gt-table th,
    .gt-table td {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .gt-table th {
        font-size: 11px;
    }
    
    .gt-table-search input {
        max-width: 100%;
    }
    
    /* Вертикальная таблица на мобильных */
    .gt-table-vertical .gt-table-label,
    .gt-table-vertical .gt-table-value {
        display: block;
        width: 100%;
        padding: 10px;
    }
    
    .gt-table-vertical .gt-table-label {
        border-right: none;
/*        border-bottom: 1px solid #dee2e6;*/
        font-size: 16px;
        text-align: left;              /* Название - слева */
    }
    
    .gt-table-vertical .gt-table-value {
        font-size: 16px;
        font-weight: 500;
        text-align: right;             /* НОВОЕ: Значение - справа */
    }
    
    /* Адаптивность названия таблицы */
    .gt-table-caption {
        text-align: left;          /* На мобильных - слева */
        font-size: 0.95em;         /* Чуть меньше на мобильных */
    }
}

@media (max-width: 480px) {
    .gt-table-wrapper {
        margin: 10px 0px;        /*margin: 10px -15px;*/
        border-radius: 0;
    }
    
    .gt-table {
        font-size: 11px;
    }
    
    .gt-table th,
    .gt-table td {
        padding: 6px 4px;
    }
    
    .gt-table-search,
    .gt-table-export,
    .gt-table-info {
        padding: 10px;
    }
    
    /* Уведомление промокода на мобильных - остаётся над промокодом */
    .promo-copied-notification {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */

@media print {
    .gt-table-wrapper {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .gt-table-search,
    .gt-table-export {
        display: none;
    }
    
    .gt-table th {
        background: #f8f9fa;
        color: #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .gt-table-hover tbody tr:hover {
        background-color: transparent;
    }
    
    /* Печать ссылок */
    .gt-table-external-link,
    .promo-code-clickable {
        color: #000;
        text-decoration: underline;
    }
    
    /* Скрытие уведомлений при печати */
    .promo-copied-notification {
        display: none;
    }
}

/* ============================================
   ДОСТУПНОСТЬ - МЕДИАЗАПРОСЫ
   ============================================ */

/* Фокус для клавиатурной навигации */
.gt-table a:focus-visible,
.gt-table button:focus-visible {
    outline: 2px solid var(--gt-table-primary);
    outline-offset: 2px;
}

/* Высокая контрастность для людей с нарушениями зрения */
@media (prefers-contrast: high) {
    .gt-table th {
        background: #000;
        color: #fff;
    }
    
    .gt-table td {
        border-color: #000;
    }
    
    .gt-table-external-link,
    .promo-code-clickable {
        color: #d00;
        text-decoration: underline;
    }
}

/* Уменьшенное движение для людей с вестибулярными нарушениями */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
    
    .gt-table-hover tbody tr,
    .gt-table-export button,
    .gt-table-search input,
    .gt-table-external-link,
    .promo-code-clickable,
    .promo-copied-notification {
        transition: none;
    }
}

/* НОВОЕ: Уменьшенная прозрачность */
@media (prefers-reduced-transparency) {
    .gt-table-wrapper {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }
    
    .gt-table-search input:focus-visible {
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5);
    }
    
    .promo-copied-notification {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
}
