/* wizard-detail-bg.css - Адаптивное окно мага с фоновым изображением */
/* Паттерн взят из library_ui.js - image + clickable zones */

/* ========================================
   КОНТЕЙНЕР ПОЛНОЭКРАННЫЙ
   ======================================== */

#wizard-detail-screen.with-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ========================================
   ФОНОВОЕ ИЗОБРАЖЕНИЕ (автоматически масштабируется)
   ======================================== */

#wizard-detail-screen .wizard-bg-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

/* ========================================
   КОНТЕЙНЕР С UI ЭЛЕМЕНТАМИ (поверх изображения)
   ======================================== */

#wizard-detail-screen .wizard-bg-overlay-container {
    position: absolute;
    /* top, left, width, height устанавливаются через JS */
    /* Не используем transform - он смещает координаты! */
}

/* ========================================
   КНОПКА ЗАКРЫТИЯ (фиксированная в правом верхнем углу)
   ======================================== */

.wizard-bg-close-button-fixed {
    position: fixed;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #7289da;
    color: #7289da;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10001;
    white-space: nowrap;
    padding: 10px 20px;
    font-size: 16px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.wizard-bg-close-button-fixed:hover {
    background: #7289da;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(114, 137, 218, 0.5);
}

/* Кнопка закрытия внутри overlay (адаптируется с координатами) */
.wizard-bg-close-button {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #7289da;
    color: #7289da;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.wizard-bg-close-button:hover {
    background: #7289da;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(114, 137, 218, 0.4);
}

/* ========================================
   ИМЯ МАГА
   ======================================== */

.wizard-bg-name {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.wizard-bg-name-edit {
    background: transparent;
    border: none;
    color: #7289da;
    cursor: pointer;
    transition: all 0.3s;
}

.wizard-bg-name-edit:hover {
    color: #fff;
    transform: scale(1.2);
}

/* ========================================
   УРОВЕНЬ
   ======================================== */

.wizard-bg-level {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(114, 137, 218, 0.9);
    border-radius: 8px;
    color: white;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
    text-align: center;
}

/* ========================================
   ПОЛОСА ОПЫТА
   ======================================== */

.wizard-bg-exp-bar {
    position: absolute;
}

.wizard-bg-exp-progress {
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 42, 0.8);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(114, 137, 218, 0.5);
}

.wizard-bg-exp-fill {
    height: 100%;
    background: linear-gradient(90deg, #7289da, #5b6eae);
    transition: width 0.3s ease;
}

.wizard-bg-exp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 1;
    width: 100%;
    text-align: center;
}

/* ========================================
   КНОПКИ (Сопротивления, Инвентарь)
   ======================================== */

.wizard-bg-button {
    position: absolute;
    background: rgba(61, 61, 92, 0.9);
    border: 2px solid #7289da;
    color: white;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wizard-bg-button:hover {
    background: rgba(114, 137, 218, 0.9);
    transform: translateY(-2px);
}

/* ========================================
   ЯЧЕЙКИ СТАТОВ И ЗАКЛИНАНИЙ
   ======================================== */

.wizard-bg-cell {
    position: absolute;
    background: rgba(61, 61, 92, 0.85);
    border: 2px solid rgba(114, 137, 218, 0.5);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.wizard-bg-cell:hover {
    border-color: #7289da;
    background: rgba(61, 61, 92, 0.95);
}

/* Ячейка заклинания */
.wizard-bg-cell.spell {
    cursor: pointer;
}

.wizard-bg-cell.spell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(114, 137, 218, 0.4);
}

.wizard-bg-cell.spell.empty {
    border-style: dashed;
    background: rgba(61, 61, 92, 0.5);
}

.wizard-bg-cell.spell.locked {
    background: rgba(42, 42, 58, 0.7);
    cursor: not-allowed;
    border-color: #555;
}

/* Заголовок ячейки */
.wizard-bg-cell-label {
    color: #aaa;
    text-transform: uppercase;
    margin-bottom: 4px;
    font-weight: bold;
}

/* Значение ячейки */
.wizard-bg-cell-value {
    font-weight: bold;
    color: white;
    margin-bottom: 2px;
}

/* Бонусы */
.wizard-bg-cell-bonus {
    color: #7289da;
    margin-top: 2px;
    text-align: center;
}

/* Название заклинания */
.wizard-bg-spell-name {
    font-weight: bold;
    color: white;
    text-align: center;
    margin-bottom: 3px;
}

/* Информация о заклинании */
.wizard-bg-spell-info {
    color: #aaa;
    text-align: center;
}

/* Пустое заклинание */
.wizard-bg-cell.spell.empty .wizard-bg-spell-name {
    color: #7289da;
}

/* Заблокировано */
.wizard-bg-cell.spell.locked .wizard-bg-cell-value {
    font-size: 32px;
    color: #555;
}

/* ========================================
   ЦВЕТА ПО ХАРАКТЕРИСТИКАМ
   ======================================== */

.wizard-bg-cell.health .wizard-bg-cell-value {
    color: #4ade80;
}

.wizard-bg-cell.armor .wizard-bg-cell-value {
    color: #95ffc4;
}

.wizard-bg-cell.damage .wizard-bg-cell-value {
    color: #fbbf24;
}

/* ========================================
   АНИМАЦИИ
   ======================================== */

@keyframes wizardBgFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#wizard-detail-screen.with-background {
    animation: wizardBgFadeIn 0.3s ease-out;
}

/* ========================================
   ОТКЛЮЧЕНИЕ ВЫДЕЛЕНИЯ
   ======================================== */

.wizard-bg-overlay-container * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* ========================================
   DEV MODE - Подсветка зон
   ======================================== */

.wizard-bg-cell.dev-highlight:hover {
    background: rgba(114, 137, 218, 0.5) !important;
}
