/* Достижения (ach) — стили classicbk 1:1.
 * Источник: /var/www/cbkusr/data/www/classicbk.ru/static/css/main.css,
 * блок .ach-* (строки 723–1210). Те же правила уже есть в нашем
 * static/css/main.css (копия classicbk из Фазы 3); модуль подключает
 * ach.css для самодостаточности — порядок каскада вид не меняет.
 */

.ach-panel {
    /*background: #d5d5d5;
    border-top: 1px solid #fff;
    border-right: 1px solid #666;
    border-bottom: 1px solid #666;
    border-left: 1px solid #fff;
    padding: 8px;
    font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
    font-size: 10pt;
    color: #111;
    line-height: normal;*/
    text-align: center;
}

/* Заголовок */
.ach-head {
    background: rgba(180, 180, 180, 0.3);
    border: 1px solid #999;
    padding: 6px 10px;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 13pt;
    color: #333;
    text-transform: uppercase;
}

/* Легенда уровней */
.ach-legend {
    background: #e0e0e0;
    border: 1px solid #b0b0b0;
    padding: 4px 8px;
    margin-bottom: 8px;
    font-size: 8pt;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: center;
}

.ach-legend b {
    color: #333;
}

.ach-legend-item {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.ach-legend-badge {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid;
    display: inline-block;
    flex-shrink: 0;
}

/* Список достижений */
.ach-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    padding-right: 4px;
    padding: 14px;
    /* ЦЕНТРИРОВАНИЕ */
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    text-align: left;
}

/* Скроллбар в стиле игры */
.ach-list::-webkit-scrollbar {
    background-color: #dedede;
    width: 16px;
}

.ach-list::-webkit-scrollbar-track {
    background-color: #dedede;
}

.ach-list::-webkit-scrollbar-thumb {
    background-color: #babac0;
    border-radius: 16px;
    border: 5px solid #dedede;
    min-height: 30px;
}

.ach-list::-webkit-scrollbar-thumb:hover {
    background-color: #a0a0a5;
    border: 4px solid #dedede;
}

.ach-list::-webkit-scrollbar-button {
    display: none;
}

/* Карточка достижения */
.ach-item {
    display: flex;
    align-items: center;
    gap: 8px;
    /*
    background: #e0e0e0;
    border-top: 1px solid #fff;
    border-right: 1px solid #999;
    border-bottom: 1px solid #999;
    border-left: 1px solid #fff;
    */
    padding: 5px 7px;
    cursor: default;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 0px;
}

/*.ach-item:hover {
    background: #e8e8e8;
}*/

/*
.ach-item:nth-child(even) {
    background: #d5d5d5;
}

.ach-item:hover {
    background: #e8e8e8;
}

.ach-item:nth-child(even):hover {
    background: #dddddd;
}
*/

/* Рамки по уровням */
/*.ach-item[data-lvl="0"] { border-left: 4px solid #999999; }
.ach-item[data-lvl="1"] { border-left: 4px solid #8b7355; }
.ach-item[data-lvl="2"] { border-left: 4px solid #a0a0a0; }
.ach-item[data-lvl="3"] { border-left: 4px solid #b8a038; }
.ach-item[data-lvl="4"] { border-left: 4px solid #7a8a9a; }
.ach-item[data-lvl="5"] { border-left: 4px solid #5a7aaa; }
.ach-item[data-lvl="6"] { border-left: 4px solid #9a4a4a; }
.ach-item[data-lvl="7"] { border-left: 4px solid #7ab8c8; }*/

/* Анимация для алмазного уровня */
.ach-item[data-lvl="7"] {
    animation: ach-diamond-shine 3s infinite alternate;
}

@keyframes ach-diamond-shine {
    0% { background: linear-gradient(90deg, rgba(122,184,200,0.1) 0%, #e0e0e0 8%); }
    100% { background: linear-gradient(90deg, rgba(160,210,225,0.25) 0%, #eaeaea 8%); }
}

.ach-item[data-lvl="7"]:nth-child(even) {
    animation: ach-diamond-shine-even 3s infinite alternate;
}

@keyframes ach-diamond-shine-even {
    0% { background: linear-gradient(90deg, rgba(122,184,200,0.1) 0%, #d5d5d5 8%); }
    100% { background: linear-gradient(90deg, rgba(160,210,225,0.25) 0%, #dfdfdf 8%); }
}

/* Подсветка когда можно получить награду */
.ach-item.ach-ready {
    border-color: #b8a038;
    background-color: rgba(184,160,56,0.21);
    box-shadow: 0 0 8px rgba(184, 160, 56, 0.4);
    animation: ach-ready-glow 1.5s infinite alternate;
    /*border-radius: 75px;*/
}

@keyframes ach-ready-glow {
    0% { box-shadow: 0 0 6px rgba(184, 160, 56, 0.3); }
    100% { box-shadow: 0 0 14px rgba(184, 160, 56, 0.6); }
}

/* Иконка достижения */
.ach_icon_inf {
    position: relative;
    display: inline-block;
    height: 48px;
    width: 48px;
    background-position: center center;
	filter: grayscale(0.21);
}
.ach_icon_inf_in {
    width: 48px;
    height: 48px;
    position: absolute;
    top:0px;
    left:0px;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 100%;
    filter: invert(90%);
}
.ach_icon_inf2 {
    /*filter: saturate(0.75);*/
    transition: all 0.3s linear;
}
.ach_icon_inf2:hover {
    /*filter: saturate(1);*/
    transform: scale(1.77);
	filter: grayscale(0);
	opacity: 1;
}
.ach_icon_inf2:hover .ach_icon_inf_in {
    filter: invert(0%);
}

.ach-icon {
    width: 128px;
    height: 128px;
    /*background: #c8c8c8;
    border-top: 1px solid #fff;
    border-right: 1px solid #666;
    border-bottom: 1px solid #666;
    border-left: 1px solid #fff;*/
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ach-icon img {
    width: 76px;
    height: 76px;
    object-fit: contain;
    filter: grayscale(1) opacity(0.35);
    transition: all 0.3s ease;
}

/* Иконки по уровням */
.ach-item[data-lvl="1"] .ach-icon img { filter: grayscale(0.6) opacity(0.7); }
.ach-item[data-lvl="2"] .ach-icon img { filter: grayscale(0.4) opacity(0.8); }
.ach-item[data-lvl="3"] .ach-icon img { filter: grayscale(0.2) opacity(0.9); }
.ach-item[data-lvl="4"] .ach-icon img,
.ach-item[data-lvl="5"] .ach-icon img,
.ach-item[data-lvl="6"] .ach-icon img { filter: grayscale(0) opacity(1); }
.ach-item[data-lvl="7"] .ach-icon img {
    filter: grayscale(0) opacity(1) drop-shadow(0 0 3px rgba(122,184,200,0.6));
    animation: ach-icon-sparkle 1.5s infinite;
}

@keyframes ach-icon-sparkle {
    0%, 100% { filter: grayscale(0) opacity(1) drop-shadow(0 0 2px rgba(122,184,200,0.5)); }
    50% { filter: grayscale(0) opacity(1) drop-shadow(0 0 6px rgba(160,210,225,0.8)); }
}

/* Информационный блок */
.ach-info {
    flex: 1;
    min-width: 0;
}

.ach-name {
    font-weight: bold;
    /*font-size: 9pt;*/
    color: #333;
    margin-bottom: 2px;
}

.ach-lvl-badge {
    display: inline-block;
    /*font-size: 7pt;*/
    padding: 1px 5px;
    /*border-radius: 2px;*/
    font-weight: bold;
    /*background: #c8c8c8;
    border: 1px solid;*/
    margin-left: 4px;
    white-space: nowrap;
}

.ach-progress {
    /*font-size: 8pt;*/
    color: #666;
    margin-bottom: 5px;
}

.ach-progress strong {
    color: #003388;
}

.ach-reward {
    font-size: 8pt;
    color: #555;
    /*background: rgba(180, 180, 180, 0.3);
    border: 1px solid #999;*/
    padding: 1px 5px;
    /*border-radius: 2px;*/
    display: inline-block;
    margin-bottom: 2px;
}

.ach-reward.ach-claimable {
    background: rgba(184, 160, 56, 0.25);
    border-color: #b8a038;
    color: #6a5a20;
    animation: ach-claim-pulse 1s infinite alternate;
}

@keyframes ach-claim-pulse {
    0% { background: rgba(184, 160, 56, 0.2); }
    100% { background: rgba(184, 160, 56, 0.4); }
}

/* Прогресс-бар */
.ach-bar {
    width: 100%;
    height: 12px;
    background: #b0b0b0;
    border-top: 1px solid #999;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    border-left: 1px solid #999;
    overflow: hidden;
}

.ach-bar-fill {
    height: 100%;
    background: linear-gradient(180deg, #1B8E17, #21ad1d);
    border-right: 1px solid #158a11;
    transition: width 0.4s ease;
}

.ach-item.ach-ready .ach-bar-fill {
    background: linear-gradient(180deg, #c8a840, #a08020);
}

.ach-item[data-lvl="7"] .ach-bar-fill {
    background: linear-gradient(180deg, #7ab8c8, #5a98a8);
}

/* Индикатор уровня справа */
.ach-lvl-right {
    width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.ach-lvl-icon {
    font-size: 15pt;
}

.ach-lvl-txt {
    font-size: 7pt;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
}

/* Кнопка получения награды */
.ach-claim-btn {
    position: absolute;
    right: 50px;
    top: 40px;
    font-size: 7pt;
    padding: 8px 16px;
    border-radius: 3px;
    border: 1px double #b8a038;
    background: linear-gradient(180deg, #ffe08a, #c8a020);
    color: #4a3800;
    cursor: pointer;
    font-weight: bold;
    font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
    z-index: 5;
    animation: ach-claim-bounce 0.8s infinite alternate;
}

.ach-claim-btn:hover {
    background: linear-gradient(180deg, #ffeaa0, #dab030);
}

@keyframes ach-claim-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-3px); }
}

/* Вспышка при получении уровня */
.ach-confetti {
    position: absolute;
    top: 2px;
    right: 42px;
    font-size: 13pt;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.ach-item.ach-lvl-up .ach-confetti {
    opacity: 1;
    animation: ach-float-up 1.2s ease-out forwards;
}

@keyframes ach-float-up {
    0% { transform: translateY(0) scale(0.5); opacity: 1; }
    100% { transform: translateY(-28px) scale(1.6); opacity: 0; }
}

.ach-item.ach-lvl-up {
    animation: ach-pulse 0.8s ease-out;
}

@keyframes ach-pulse {
    0% { background-color: #e8e8e8; }
    100% { background-color: #e0e0e0; }
}

/* Сообщение об ошибке */
.ach-error {
    display: none;
    padding: 5px;
    /*background: #fff0f0;
    border: 1px solid #cc8888;*/
    color: red;
    font-size: 9pt;
}

/* Кнопки */
.ach-btns {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #b0b0b0;
    flex-wrap: wrap;
    align-items: center;
}

.ach-hint {
    font-size: 8pt;
    color: #777;
    margin-right: auto;
    font-style: italic;
}

.ach-btn {
    color: #333;
    border: 1px double #888;
    background: linear-gradient(180deg, #d2d2d2, #a0a0a0);
    box-shadow: 0 0 3px 3px rgba(100, 100, 100, 0.3);
    border-radius: 3px;
    padding: 5px 10px;
    margin: 2px;
    cursor: pointer;
    font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
    font-size: 11pt;
}

.ach-btn:hover {
    color: #111;
    border-color: #666;
    background: linear-gradient(180deg, #e1e1e1, #afafaf);
}

/* Адаптивность */
@media (max-width: 600px) {
    .ach-item {
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px;
    }
    .ach-icon {
        width: 34px;
        height: 34px;
    }
    .ach-icon img {
        width: 28px;
        height: 28px;
    }
    .ach-lvl-right {
        width: 28px;
    }
    .ach-claim-btn {
        right: 4px;
        bottom: 4px;
    }
}


/* Мобильная правка нашей платформы: классический .ach-list (width:100% +
   padding:14px, content-box) на 430px даёт горизонтальный скролл 443px.
   На classicbk он тоже есть (шелл 980px), у нас мобильный должен быть без
   горизонтального скролла — включаем border-box только на узком экране. */
@media (max-width: 600px) {
    .ach-list {
        box-sizing: border-box;
    }
}

/* На classicbk глобально действует img { max-width: 100% } (cassic-design.css);
   в нашей оболочке этот файл не подключён. Ограничиваем только иконку уровня:
   атрибут width="48" даёт 36px (ширина .ach-lvl-right), как в оригинале, без
   искажения пропорций (height: auto). */
.ach-lvl-icon img {
    max-width: 100%;
    height: auto;
}
