/* =====================================================
   SHOP SYSTEM STYLES
   Estilos para el sistema de tienda
   ===================================================== */

/* =====================================================
   1. BOTÓN DE TIENDA EN HEADER
   ===================================================== */
.shop-header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.2) 0%, rgba(200, 170, 110, 0.1) 100%);
    border: 2px solid rgba(200, 170, 110, 0.4);
    color: #C8AA6E;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 8px;
}

.shop-header-btn:hover {
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.3) 0%, rgba(200, 170, 110, 0.2) 100%);
    border-color: #C8AA6E;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(200, 170, 110, 0.3);
}

.shop-header-btn i {
    font-size: 18px;
}

/* =====================================================
   2. MODAL DE TIENDA
   ===================================================== */
.shop-modal-content {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(15, 30, 45, 0.98) 0%, rgba(5, 15, 25, 0.98) 100%);
    border: 2px solid #C8AA6E;
    border-radius: 16px;
    padding: 0;
}

.shop-modal-content::-webkit-scrollbar {
    width: 6px;
}

.shop-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.shop-modal-content::-webkit-scrollbar-thumb {
    background: rgba(200, 170, 110, 0.4);
    border-radius: 3px;
}

/* Header de la tienda */
.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid rgba(200, 170, 110, 0.3);
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.08) 0%, rgba(200, 170, 110, 0.02) 100%);
}

.shop-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shop-title h2 {
    margin: 0;
    font-size: 24px;
    color: #F0E6D2;
}

.shop-title i {
    font-size: 28px;
    color: #C8AA6E;
}

.shop-user-coins {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
}

.shop-coins-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shop-coins-value {
    font-size: 18px;
    font-weight: 700;
    color: #FFD700;
}

.shop-coins-value i {
    font-size: 16px;
    margin-left: 4px;
}

.shop-timer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.shop-timer-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shop-timer-value {
    font-size: 18px;
    font-weight: 700;
    color: #FFD700;
}

/* Tabs de navegación */
.shop-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(200, 170, 110, 0.2);
}

.shop-tab {
    padding: 10px 20px;
    background: rgba(200, 170, 110, 0.1);
    border: 1px solid rgba(200, 170, 110, 0.2);
    border-radius: 8px;
    color: #A09B8C;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shop-tab.active,
.shop-tab:hover {
    background: rgba(200, 170, 110, 0.2);
    border-color: #C8AA6E;
    color: #F0E6D2;
}

/* Contenido de la tienda */
.shop-content {
    padding: 20px 24px;
}

/* Secciones */
.shop-section {
    margin-bottom: 24px;
}

.shop-section:last-child {
    margin-bottom: 0;
}

.shop-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #C8AA6E;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(200, 170, 110, 0.2);
}

.shop-section-title i {
    font-size: 20px;
}

/* Grid de items */
.shop-items-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* =====================================================
   3. CARD DE ITEM DE TIENDA
   ===================================================== */
.shop-item-card {
    background: rgba(15, 30, 45, 0.6);
    border: 2px solid rgba(200, 170, 110, 0.2);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.shop-item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Rarezas */
.shop-item-card.common {
    border-color: rgba(157, 157, 157, 0.4);
}

.shop-item-card.uncommon {
    border-color: rgba(30, 255, 0, 0.4);
}

.shop-item-card.rare {
    border-color: rgba(0, 112, 221, 0.4);
}

.shop-item-card.epic {
    border-color: rgba(163, 53, 238, 0.4);
}

.shop-item-card.legendary {
    border-color: rgba(255, 128, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 128, 0, 0.2);
}

.shop-item-card.champion {
    border-color: rgba(230, 204, 128, 0.5);
    box-shadow: 0 0 20px rgba(230, 204, 128, 0.3);
    background: linear-gradient(135deg, rgba(230, 204, 128, 0.1) 0%, rgba(15, 30, 45, 0.6) 100%);
}

/* Imagen del item */
.shop-item-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid;
    overflow: hidden;
    position: relative;
}

.shop-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.owned-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #4ade80;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.5);
}

/* Info del item */
.shop-item-info {
    text-align: center;
}

.shop-item-name {
    display: block;
    font-size: 12px;
    color: #F0E6D2;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.shop-item-rarity {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* Precio y botón de compra */
.shop-item-price {
    width: 100%;
}

.buy-btn {
    width: 100%;
    padding: 8px 12px;
    background: linear-gradient(135deg, #C8AA6E 0%, #8B7355 100%);
    border: none;
    border-radius: 6px;
    color: #0F1E2D;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 170, 110, 0.4);
}

.buy-btn i {
    font-size: 14px;
    color: #FFD700;
}

.owned-text {
    display: block;
    text-align: center;
    font-size: 12px;
    color: #4ade80;
    font-weight: 600;
    padding: 8px;
}

/* =====================================================
   4. MODAL DE INVENTARIO
   ===================================================== */
.inventory-modal-content {
    max-width: 800px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(15, 30, 45, 0.98) 0%, rgba(5, 15, 25, 0.98) 100%);
    border: 2px solid #C8AA6E;
    border-radius: 16px;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid rgba(200, 170, 110, 0.3);
    background: linear-gradient(135deg, rgba(200, 170, 110, 0.08) 0%, rgba(200, 170, 110, 0.02) 100%);
}

.inventory-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inventory-title h2 {
    margin: 0;
    font-size: 24px;
    color: #F0E6D2;
}

.inventory-title i {
    font-size: 28px;
    color: #C8AA6E;
}

.inventory-content {
    padding: 20px 24px;
}

/* Sección de inventario */
.inventory-section {
    margin-bottom: 24px;
}

.inventory-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #C8AA6E;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(200, 170, 110, 0.2);
}

.inventory-items-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

/* Card de item de inventario */
.inventory-item-card {
    background: rgba(15, 30, 45, 0.6);
    border: 2px solid rgba(200, 170, 110, 0.2);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.inventory-item-card:hover {
    transform: translateY(-2px);
    border-color: rgba(200, 170, 110, 0.4);
}

.inventory-item-image {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid;
    overflow: hidden;
    position: relative;
}

.inventory-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.equipped-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #4ade80;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.5);
}

.inventory-item-info {
    text-align: center;
}

.inventory-item-name {
    display: block;
    font-size: 11px;
    color: #F0E6D2;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.equip-btn {
    width: 100%;
    padding: 6px 10px;
    background: rgba(200, 170, 110, 0.2);
    border: 1px solid rgba(200, 170, 110, 0.4);
    border-radius: 6px;
    color: #C8AA6E;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.equip-btn:hover:not(:disabled) {
    background: rgba(200, 170, 110, 0.3);
    border-color: #C8AA6E;
}

.equip-btn.equipped {
    background: rgba(74, 222, 128, 0.2);
    border-color: rgba(74, 222, 128, 0.4);
    color: #4ade80;
    cursor: default;
}

.equip-btn:disabled {
    opacity: 0.7;
}

/* Inventario vacío */
.inventory-empty {
    text-align: center;
    padding: 40px 20px;
    color: #A09B8C;
}

.inventory-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.inventory-empty p {
    margin: 0 0 16px 0;
    font-size: 16px;
}

.shop-link-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #C8AA6E 0%, #8B7355 100%);
    border: none;
    border-radius: 8px;
    color: #0F1E2D;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shop-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 170, 110, 0.4);
}

/* =====================================================
   5. ANIMACIÓN DE COMPRA EXITOSA
   ===================================================== */
.shop-purchase-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: fadeIn 0.3s ease;
}

.shop-purchase-success-modal {
    background: linear-gradient(135deg, #1a3a4a 0%, #0F1E2D 100%);
    border: 3px solid #C8AA6E;
    padding: 32px 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(200, 170, 110, 0.3);
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.purchase-success-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    border-radius: 50%;
    border: 4px solid #C8AA6E;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(200, 170, 110, 0.5);
}

.purchase-success-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-purchase-success-modal h2 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: #4ade80;
}

.purchase-item-name {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
}

.purchase-rarity {
    margin: 0 0 16px 0;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
}

.purchase-balance {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
}

.purchase-balance span:first-child {
    color: rgba(255, 255, 255, 0.7);
}

.balance-amount {
    color: #FFD700;
    font-weight: 700;
}

.purchase-success-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, #C8AA6E 0%, #8B7355 100%);
    border: none;
    border-radius: 8px;
    color: #0F1E2D;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.purchase-success-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(200, 170, 110, 0.4);
}

/* =====================================================
   6. NOTIFICACIONES
   ===================================================== */
.shop-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #1a3a4a 0%, #0F1E2D 100%);
    border: 2px solid;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10003;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.shop-notification.show {
    transform: translateX(0);
}

.shop-notification.success {
    border-color: #4ade80;
    color: #4ade80;
}

.shop-notification.info {
    border-color: #C8AA6E;
    color: #C8AA6E;
}

.shop-notification.error {
    border-color: #ef4444;
    color: #ef4444;
}

.shop-notification i {
    font-size: 20px;
}

.shop-notification span {
    font-size: 14px;
    font-weight: 600;
}

/* =====================================================
   7. BOTÓN DE INVENTARIO EN DASHBOARD
   ===================================================== */
.inventory-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(160, 140, 100, 0.12);
    border: 2px solid rgba(160, 140, 100, 0.25);
    border-radius: 8px;
    color: #A89A70;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.inventory-btn:hover {
    background: rgba(160, 140, 100, 0.2);
    border-color: rgba(160, 140, 100, 0.5);
}

.inventory-btn i {
    font-size: 18px;
}

/* =====================================================
   8. RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .shop-modal-content,
    .inventory-modal-content {
        max-width: 100%;
        width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }

    .shop-header,
    .inventory-header {
        padding: 16px 20px;
    }

    .shop-title h2,
    .inventory-title h2 {
        font-size: 20px;
    }

    .shop-content,
    .inventory-content {
        padding: 16px 20px;
    }

    .shop-items-row {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .shop-item-card {
        padding: 10px;
    }

    .shop-item-image {
        width: 60px;
        height: 60px;
    }

    .shop-item-name {
        font-size: 10px;
        max-width: 80px;
    }

    .buy-btn {
        padding: 6px 8px;
        font-size: 10px;
    }

    .inventory-items-row {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }

    .inventory-item-card {
        padding: 10px;
    }

    .inventory-item-image {
        width: 50px;
        height: 50px;
    }

    .shop-header-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .shop-header-btn span {
        display: none;
    }
}

/* Empty shop message */
.shop-empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: rgba(240, 230, 210, 0.7);
}

.shop-empty-message i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #C8AA6E;
}

.shop-empty-message p {
    font-size: 14px;
    margin: 0;
    max-width: 280px;
}

@media (max-width: 480px) {
    .shop-items-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .shop-item-image {
        width: 50px;
        height: 50px;
    }

    .shop-item-name {
        font-size: 9px;
        max-width: 60px;
    }

    .shop-item-rarity {
        font-size: 8px;
    }

    .buy-btn {
        padding: 5px 6px;
        font-size: 9px;
    }

    .inventory-items-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .shop-purchase-success-modal {
        padding: 24px;
    }

    .purchase-success-icon {
        width: 80px;
        height: 80px;
    }
}

/* =====================================================
   9. ANIMACIONES
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Brillo para items legendarios y champion */
.shop-item-card.legendary .shop-item-image,
.shop-item-card.champion .shop-item-image {
    animation: legendaryGlow 2s ease-in-out infinite alternate;
}

@keyframes legendaryGlow {
    from {
        box-shadow: 0 0 10px currentColor;
    }
    to {
        box-shadow: 0 0 25px currentColor;
    }
}

/* =====================================================
   10. MENÚ GRID ITEM PARA TIENDA
   ===================================================== */
.menu-grid-item[data-mode="shop"] .grid-icon i {
    color: #FFD700;
}

/* Badge de "NEW" para la tienda */
.shop-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    animation: pulse 2s ease-in-out infinite;
}
