/* Стили для модуля новогодних шапок */

/* Основная сетка шапок 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
*/
.hats-grid {
    display: grid;
    flex-wrap: wrap;
    gap: 30px 10px;
    align-items: center;
    justify-items: center;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.hat-item {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.hat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #28a745, #ffc107);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hat-item:hover {
    border-color: #007bff;
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 123, 255, 0.15);
}

.hat-item:hover::before {
    opacity: 1;
}

.hat-item.active {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.2);
}

.hat-item.active::before {
    opacity: 1;
    background: #28a745;
}

.hat-item.available {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fffbf0 0%, #fff3cd 100%);
    border-style: dashed;
}

.hat-item.available:hover {
    border-color: #ffc107;
    border-style: solid;
}

.hat-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 12px;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.hat-item:hover img {
    transform: scale(1.1);
}

.hat-item.active img {
    filter: drop-shadow(0 6px 12px rgba(40, 167, 69, 0.3));
}

.hat-name {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: #2d3748;
    line-height: 1.3;
}

.hat-status {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 500;
}

.hat-item.active .hat-status {
    color: #28a745;
    font-weight: 600;
}

.set-active-btn {
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
}

.set-active-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: scale(1.05);
}

.hat-item.active .set-active-btn {
    display: none;
}

.current-hat {
    padding: 20px;
}

.current-hat-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    } 

    50% {
        transform: translateY(-10px);
    }
}

.user-active-hat {
    display: inline-block;
    margin-bottom: 15px;
}

.user-hat-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.user-hat-image:hover {
    transform: scale(1.1);
}

@media (max-width: 1200px) {
    .hats-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .hats-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }

    .hat-item {
        padding: 15px 10px;
    }

    .hat-item img {
        width: 60px;
        height: 60px;
    }

    .current-hat-image {
        width: 100px;
        height: 100px;
    }

    .user-hat-image {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .hats-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }

    .hat-item {
        padding: 12px 8px;
    }

    .hat-item img {
        width: 50px;
        height: 50px;
    }

    .hat-name {
        font-size: 12px;
    }
}

.hats-loading {
    text-align: center;
    padding: 40px 20px;
}

.hats-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

.hat-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.hat-item::after {
    content: '🎄';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hat-item:hover::after {
    opacity: 1;
}

.hat-item.active::after {
    content: '⭐';
    opacity: 1;
}

/*  
.hats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; 
    justify-content: flex-start;
    /* Выравнивание по левому краю 
}*/


.hat-card {
    position: relative;
    width: 150px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.hat-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.hat-card-active {
    border-color: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

.hat-card-image {
    max-width: 100%;
    height: auto;
    max-height: 100px;
    display: block;
    margin: 0 auto 10px;
}

.hat-card-name {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.status-active {
    background-color: #28a745;
}

.status-select {
    background-color: #007bff;
}

.current-hat-image {
    max-width: 150px;
    height: auto;
}

.hat-overlay-image {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: auto;
    z-index: 10;
}


.block_hat .hat-overlay-image {
    position: absolute;
    top: -32px;
    left: 90%;
    transform: rotate(29deg);
    width: 80px;
    height: auto;
    z-index: 10;


}

.hat-item {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    padding: 10px;
    border-top: 1px solid #2a2931;
    cursor: pointer;
    transition: background-color 0.2s;
}

.hat-item:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.hat-item-left {
    display: flex;
    align-items: center;
    margin-right: 10px;
    gap: 10px;
}

.hat-item img {
    width: 24px;
    height: 24px;
    object-fit: cover;
}

.hat-item.active {
    background-color: #38c17233;
    font-weight: bold;
}

.current-hat-preview img {
    max-width: 128px;
    height: auto;
}

.hat-card {
    transition: all 0.25s ease;
}

.hat-card-active {
    transform: scale(1.05) !important;
    box-shadow: 0 0 15px rgba(56, 193, 114, 0.4);
}

.hat-card {
    position: relative;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    background: #2a2931;
    transition: all 0.25s ease;
}

.hat-card:hover {
    border-color: #38c172;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.hat-card-active {
    border-color: #38c172 !important;
    background: #38c17222;
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(56, 193, 114, 0.3);
}

.hat-card-image {
    width: 100%;
    height: 80px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.hat-card-name {
    font-size: 14px;
    font-weight: bold;
    color: rgb(230, 230, 230);
    margin-bottom: 5px;
}

.hat-card-name {
    padding: 6px 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hat-card-status {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    backdrop-filter: blur(1mm);

}

.status-active {
    background: #38c172;
    color: white;
}

.status-select {
    background: rgba(255, 255, 255, 0.2);
    color: #ccc;
}

.user-avatar-container {
    position: relative;
    display: inline-block;
}

.hat-overlay-image {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: auto;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.current-hat-image {
    transition: opacity 0.3s ease;
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 15px;
}

.hats-grid {
    position: relative;
    transition: opacity 0.3s ease;
}

.hats-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hat-overlay-image {
    transition: opacity 0.3s ease;
}

.current-hat-image {
    transition: opacity 0.3s ease;
}



.first-wearer {
    color: #e74c3c;
    font-weight: bold;
    font-size: 13px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.hat-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.hat-card:hover {
    transform: translateY(-3px);
}

.hat-card-active {
    border: 2px solid #28a745 !important;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.4);
}


/* Базовые стили для шапок */
.hat-overlay-image {
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

/* Анимация плавания */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(29deg); }
    50% { transform: translateY(-5px) rotate(29deg); }
}

/* Обычные шапки - минимальная анимация */
.hat-rarity-common .hat-overlay-image {
    animation: float 4s ease-in-out infinite;
}

/* Редкие шапки - синее свечение */
.hat-rarity-rare .hat-overlay-image {
    animation: float 3s ease-in-out infinite, glow-blue 2s ease-in-out infinite alternate;
}

@keyframes glow-blue {
    from { filter: drop-shadow(0 0 3px #0070dd); }
    to { filter: drop-shadow(0 0 8px #0070dd) drop-shadow(0 0 12px #0070dd); }
}

/* Эпические шапки - пульсирующее фиолетовое свечение */
.hat-rarity-epic .hat-overlay-image {
    animation: float 2.5s ease-in-out infinite, glow-purple 1.5s ease-in-out infinite alternate;
}

@keyframes glow-purple {
    from { 
        filter: drop-shadow(0 0 5px #a335ee) drop-shadow(0 0 10px #a335ee);
        transform: scale(1);
    }
    to { 
        filter: drop-shadow(0 0 15px #a335ee) drop-shadow(0 0 25px #a335ee);
        transform: scale(1.05);
    }
}

/* Легендарные шапки - вращение + оранжевое свечение */
.hat-rarity-legendary .hat-overlay-image {
    animation: legendary-spin 8s linear infinite, glow-orange 2s ease-in-out infinite alternate;
}

@keyframes legendary-spin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes glow-orange {
    from { filter: drop-shadow(0 0 8px #ff8000) drop-shadow(0 0 15px #ff8000); }
    to { filter: drop-shadow(0 0 20px #ff8000) drop-shadow(0 0 30px #ff8000); }
}

/* Мифические шапки - сложная анимация */
.hat-rarity-mythical .hat-overlay-image {
    animation: mythical-float 2s ease-in-out infinite, mythical-glow 1s ease-in-out infinite alternate, color-shift 3s linear infinite;
}

@keyframes mythical-float {
    0%, 100% { transform: translateY(0px) rotate(0deg) scale(1); }
    25% { transform: translateY(-8px) rotate(-2deg) scale(1.05); }
    50% { transform: translateY(-12px) rotate(0deg) scale(1.08); }
    75% { transform: translateY(-8px) rotate(2deg) scale(1.05); }
}

@keyframes mythical-glow {
    from { filter: drop-shadow(0 0 10px #e60000) drop-shadow(0 0 20px #e60000); }
    to { filter: drop-shadow(0 0 25px #e60000) drop-shadow(0 0 40px #e60000) drop-shadow(0 0 60px #ff4444); }
}

@keyframes color-shift {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Стили для карточек шапок */
.hat-card.hat-rarity-rare {
    border: 2px solid #0070dd;
    background: linear-gradient(135deg, rgba(0, 112, 221, 0.1), transparent);
}

.hat-card.hat-rarity-epic {
    border: 2px solid #a335ee;
    background: linear-gradient(135deg, rgba(163, 53, 238, 0.15), transparent);
}

.hat-card.hat-rarity-legendary {
    border: 2px solid #ff8000;
    background: linear-gradient(135deg, rgba(255, 128, 0, 0.2), transparent);
    animation: card-glow 3s ease-in-out infinite alternate;
}

.hat-card.hat-rarity-mythical {
    border: 2px solid #e60000;
    background: linear-gradient(135deg, rgba(230, 0, 0, 0.25), transparent);
    animation: card-mythical 2s ease-in-out infinite alternate;
}

@keyframes card-glow {
    from { box-shadow: 0 0 10px rgba(255, 128, 0, 0.5); }
    to { box-shadow: 0 0 20px rgba(255, 128, 0, 0.8), 0 0 30px rgba(255, 128, 0, 0.4); }
}

@keyframes card-mythical {
    from { box-shadow: 0 0 15px rgba(230, 0, 0, 0.6); }
    to { box-shadow: 0 0 25px rgba(230, 0, 0, 0.9), 0 0 40px rgba(255, 68, 68, 0.6); }
}

/* Бейджи редкости */
.rarity-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
    margin-left: 5px;
}

.rarity-common { background: #969696; color: white; }
.rarity-rare { background: #0070dd; color: white; }
.rarity-epic { background: #a335ee; color: white; }
.rarity-legendary { background: #ff8000; color: white; }
.rarity-mythical { background: #e60000; color: white; }

/* Базовые стили для всех шапок */
.hat-overlay-image {
    transition: all 0.3s ease;
    animation: hat-float 3s ease-in-out infinite;
    position: relative;
    z-index: 10;
}

/* Анимация плавания для всех шапок */
@keyframes hat-float {
    0%, 100% {
        transform: translateY(0px) rotate(
30deg);
    }
    25% {
        transform: translateY(-2px) rotate(
29deg);
    }
    50% {
        transform: translateY(-4px) rotate(
29deg);
    }
    75% {
        transform: translateY(-2px) rotate(
29deg);
    }
}
/* ОБЫЧНЫЕ шапки - минимальная анимация */
.hat-rarity-common.hat-overlay-image {
    animation: hat-float2 4s ease-in-out infinite;
    filter: brightness(0.9);
}

/* РЕДКИЕ шапки - синее свечение + пульсация */
.hat-rarity-rare.hat-overlay-image {
    animation: hat-float 3s ease-in-out infinite, rarity-rare-glow 2s ease-in-out infinite alternate;
}

@keyframes rarity-rare-glow {
    0% { 
        filter: drop-shadow(0 0 3px #0070dd) drop-shadow(0 0 5px #0070dd) brightness(1.1);
    }
    100% { 
        filter: drop-shadow(0 0 8px #0070dd) drop-shadow(0 0 12px #0070dd) brightness(1.15);
    }
}

/* ЭПИЧЕСКИЕ шапки - фиолетовое свечение + масштабирование */
.hat-rarity-epic.hat-overlay-image {
    animation: hat-float 2.5s ease-in-out infinite, rarity-epic-glow 1.5s ease-in-out infinite alternate;
}

@keyframes rarity-epic-glow {
    0% { 
        filter: drop-shadow(0 0 5px #a335ee) drop-shadow(0 0 10px #a335ee);
        /*transform: translateY(-4px) scale(1);
    }
    100% { 
        filter: drop-shadow(0 0 15px #a335ee) drop-shadow(0 0 25px #a335ee);
        /*transform: translateY(-4px) scale(1.05);*/
    }
}

/* ЛЕГЕНДАРНЫЕ шапки - оранжевое свечение + вращение */
.hat-rarity-legendary.hat-overlay-image {
    animation: hat-float 2s ease-in-out infinite, rarity-legendary-glow 2s ease-in-out infinite alternate, rarity-legendary-spin 8s linear infinite;
}

@keyframes rarity-legendary-glow {
    0% { 
        filter: drop-shadow(0 0 8px #ff8000) drop-shadow(0 0 15px #ff8000) hue-rotate(0deg);
    }
    50% { 
        filter: drop-shadow(0 0 15px #ff8000) drop-shadow(0 0 25px #ff8000) hue-rotate(10deg);
    }
    100% { 
        filter: drop-shadow(0 0 8px #ff8000) drop-shadow(0 0 15px #ff8000) hue-rotate(0deg);
    }
}
/*
@keyframes rarity-legendary-spin {
    0% { transform: translateY(-4px) rotate(0deg) scale(1); }
    25% { transform: translateY(-4px) rotate(90deg) scale(1.02); }
    50% { transform: translateY(-4px) rotate(180deg) scale(1.05); }
    75% { transform: translateY(-4px) rotate(270deg) scale(1.02); }
    100% { transform: translateY(-4px) rotate(360deg) scale(1); }
}

/* МИФИЧЕСКИЕ шапки - красное свечение + сложная анимация */
.hat-rarity-mythical.hat-overlay-image {
    animation: hat-float 1.5s ease-in-out infinite, rarity-mythical-glow 1s ease-in-out infinite alternate, rarity-mythical-float 4s ease-in-out infinite, rarity-mythical-color 6s linear infinite;
}

@keyframes rarity-mythical-glow {
    0% { 
        filter: drop-shadow(0 0 10px #e60000) drop-shadow(0 0 20px #e60000) drop-shadow(0 0 30px #ff4444);
    }
    100% { 
        filter: drop-shadow(0 0 20px #e60000) drop-shadow(0 0 40px #e60000) drop-shadow(0 0 60px #ff4444);
    }
}
/*
@keyframes rarity-mythical-float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg) scale(1); 
    }
    25% { 
        transform: translateY(-8px) rotate(-2deg) scale(1.05); 
    }
    50% { 
        transform: translateY(-12px) rotate(0deg) scale(1.08); 
    }
    75% { 
        transform: translateY(-8px) rotate(2deg) scale(1.05); 
    }
}*/

@keyframes rarity-mythical-color {
    0% { filter: hue-rotate(0deg) brightness(1.2); }
    25% { filter: hue-rotate(90deg) brightness(1.3); }
    50% { filter: hue-rotate(180deg) brightness(1.4); }
    75% { filter: hue-rotate(270deg) brightness(1.3); }
    100% { filter: hue-rotate(360deg) brightness(1.2); }
}

/* Стили для карточек шапок в списке */
.hat-card.hat-rarity-rare {
    border: 2px solid #0070dd;
    background: linear-gradient(135deg, rgba(0, 112, 221, 0.1), transparent);
}

.hat-card.hat-rarity-epic {
    border: 2px solid #a335ee;
    background: linear-gradient(135deg, rgba(163, 53, 238, 0.15), transparent);
    animation: card-epic-pulse 4s ease-in-out infinite;
}

.hat-card.hat-rarity-legendary {
    border: 2px solid #ff8000;
    background: linear-gradient(135deg, rgba(255, 128, 0, 0.2), transparent);
    animation: card-legendary-glow 3s ease-in-out infinite alternate;
}

.hat-card.hat-rarity-mythical {
    border: 2px solid #e60000;
    background: linear-gradient(135deg, rgba(230, 0, 0, 0.25), transparent);
    animation: card-mythical-glow 2s ease-in-out infinite alternate;
}

/* Анимации для карточек */
@keyframes card-epic-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(163, 53, 238, 0.3); }
    50% { box-shadow: 0 0 20px rgba(163, 53, 238, 0.6); }
}

@keyframes card-legendary-glow {
    0% { box-shadow: 0 0 10px rgba(255, 128, 0, 0.5); }
    100% { box-shadow: 0 0 20px rgba(255, 128, 0, 0.8), 0 0 30px rgba(255, 128, 0, 0.4); }
}

@keyframes card-mythical-glow {
    0% { box-shadow: 0 0 15px rgba(230, 0, 0, 0.6); }
    100% { box-shadow: 0 0 25px rgba(230, 0, 0, 0.9), 0 0 40px rgba(255, 68, 68, 0.6); }
}

/* Бейджи редкости */
.rarity-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.rarity-common { 
    background: linear-gradient(135deg, #969696, #7a7a7a); 
}
.rarity-rare { 
    background: linear-gradient(135deg, #0070dd, #0055aa);
    animation: badge-pulse 2s ease-in-out infinite;
}
.rarity-epic { 
    background: linear-gradient(135deg, #a335ee, #8a2be2);
    animation: badge-pulse 1.5s ease-in-out infinite;
}
.rarity-legendary { 
    background: linear-gradient(135deg, #ff8000, #e67300);
    animation: badge-pulse 1s ease-in-out infinite;
}
.rarity-mythical { 
    background: linear-gradient(135deg, #e60000, #cc0000);
    animation: badge-pulse 0.8s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Плавное появление анимаций */
.hat-overlay-image {
    animation-delay: 0.5s;
}