/* ============================================
   COMPANION SYSTEM - Styling
   ============================================
   Sunwell Midnight Theme (Void Purple + Sunwell Gold)
   Integrates with game-economy.css theme
   ============================================ */

/* ===== COMPANION SECTION ===== */

.companion-section {
    background: linear-gradient(135deg,
        rgba(13, 0, 26, 0.6) 0%,
        rgba(46, 8, 84, 0.4) 100%
    );
    border: 1px solid var(--void-pink, #9932CC);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.section-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== ACTIVE COMPANION SHOWCASE ===== */

.companion-showcase {
    background: linear-gradient(135deg,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.2) 100%
    );
    border: 2px solid var(--mystic-teal, #26A69A);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Glow effect */
.companion-showcase::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle,
        rgba(153, 50, 204, 0.1) 0%,
        transparent 70%
    );
    animation: rotateGlow 10s linear infinite;
    pointer-events: none;
}

@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.companion-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    font-weight: 600;
}

.active-companion-icon {
    font-size: 100px;
    margin: 20px 0;
    filter: drop-shadow(0 8px 24px rgba(153, 50, 204, 0.6));
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-12px);
    }
}

.companion-name {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg,
        var(--sunwell-gold, #FFD700) 0%,
        var(--void-pink, #9932CC) 100%
    );
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
}

.companion-rarity {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

/* Rarity Colors */
.companion-rarity.common {
    background: linear-gradient(135deg, #B0B0B0, #909090);
    box-shadow: 0 0 15px rgba(176, 176, 176, 0.3);
}

.companion-rarity.rare {
    background: linear-gradient(135deg, #4A90E2, #357ABD);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.5);
}

.companion-rarity.epic {
    background: linear-gradient(135deg, #9B59B6, #8E44AD);
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.5);
}

.companion-rarity.legendary {
    background: linear-gradient(135deg, var(--firefly-gold, #FFB300), var(--firefly-amber, #FFA726));
    box-shadow: 0 0 20px rgba(255, 179, 0, 0.6);
}

.companion-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.companion-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid var(--void-pink, #9932CC);
}

.companion-stat-label {
    font-size: 13px;
    color: #aaa;
    font-weight: 600;
}

.companion-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--firefly-gold, #FFB300);
}

/* ===== COMPANION COLLECTION GRID ===== */

.companion-collection {
    margin-top: 24px;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.collection-title {
    font-size: 18px;
    font-weight: 700;
    color: #ddd;
}

.collection-count {
    font-size: 14px;
    color: var(--bio-cyan, #00CED1);
    font-weight: 600;
}

.companion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.companion-card {
    background: linear-gradient(135deg,
        rgba(13, 0, 26, 0.6) 0%,
        rgba(46, 8, 84, 0.4) 100%
    );
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.companion-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center,
        rgba(153, 50, 204, 0.1) 0%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.companion-card:hover::before {
    opacity: 1;
}

.companion-card:hover {
    border-color: var(--void-pink, #9932CC);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(153, 50, 204, 0.3);
}

.companion-card.active {
    border-color: var(--sunwell-gold, #FFD700);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg,
        rgba(255, 215, 0, 0.1) 0%,
        rgba(153, 50, 204, 0.1) 100%
    );
}

.companion-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.companion-card.locked:hover {
    transform: none;
    border-color: transparent;
}

.companion-card.locked::before {
    opacity: 0;
}

.companion-icon {
    font-size: 48px;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.companion-card.active .companion-icon {
    animation: pulse 2s ease-in-out infinite;
}

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

.companion-card-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #ddd;
}

.companion-card-bonus {
    font-size: 10px;
    color: var(--bio-cyan, #00CED1);
    line-height: 1.3;
}

.companion-card-level {
    font-size: 11px;
    color: var(--firefly-gold, #FFB300);
    font-weight: 700;
    margin-top: 4px;
}

.lock-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 16px;
    opacity: 0.6;
}

.unlock-hint {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

/* ===== COMPANION ACTIONS ===== */

.companion-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.companion-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.companion-btn-primary {
    background: linear-gradient(135deg,
        var(--void-pink, #9932CC) 0%,
        var(--void-purple, #4B0082) 100%
    );
    color: #fff;
    box-shadow: 0 4px 15px rgba(153, 50, 204, 0.4);
}

.companion-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(153, 50, 204, 0.6);
}

.companion-btn-secondary {
    background: linear-gradient(135deg,
        var(--void-indigo, #2E0854) 0%,
        var(--void-deep, #1A0033) 100%
    );
    color: #fff;
    border: 1px solid var(--void-pink, #9932CC);
}

.companion-btn-secondary:hover {
    background: linear-gradient(135deg,
        var(--void-deep, #1A0033) 0%,
        var(--void-indigo, #2E0854) 100%
    );
}

.companion-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.companion-btn:disabled:hover {
    transform: none;
}

/* ===== MINI COMPANION BADGE (on 3D card) ===== */

.card-companion-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(153, 50, 204, 0.3);
    margin-top: 12px;
}

.companion-mini-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 6px rgba(153, 50, 204, 0.4));
}

.companion-mini-name {
    font-size: 12px;
    font-weight: 600;
    color: #ddd;
    flex: 1;
}

.companion-mini-level {
    font-size: 11px;
    color: var(--firefly-gold, #FFB300);
    font-weight: 700;
}

/* ===== EVOLUTION ANIMATION ===== */

.evolution-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

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

.evolution-content {
    text-align: center;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.evolution-icon {
    font-size: 150px;
    margin: 20px 0;
    animation: evolveGlow 2s ease-in-out infinite;
}

@keyframes evolveGlow {
    0%, 100% {
        filter: drop-shadow(0 0 30px rgba(153, 50, 204, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 60px rgba(255, 215, 0, 1));
    }
}

.evolution-title {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg,
        var(--sunwell-gold, #FFD700),
        var(--void-pink, #9932CC),
        var(--bio-cyan, #00CED1)
    );
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.evolution-message {
    font-size: 18px;
    color: #ddd;
    margin-bottom: 30px;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .companion-section {
        padding: 16px;
        margin-bottom: 16px;
    }

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

    .companion-showcase {
        padding: 20px;
    }

    .active-companion-icon {
        font-size: 80px;
    }

    .companion-name {
        font-size: 24px;
    }

    .companion-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .companion-card {
        padding: 12px;
    }

    .companion-icon {
        font-size: 40px;
    }

    .companion-card-name {
        font-size: 12px;
    }

    .companion-card-bonus {
        font-size: 9px;
    }

    .companion-actions {
        flex-direction: column;
    }

    .companion-btn {
        width: 100%;
    }

    .evolution-icon {
        font-size: 100px;
    }

    .evolution-title {
        font-size: 32px;
    }

    .evolution-message {
        font-size: 16px;
    }
}

/* ===== UNLOCK NOTIFICATION ===== */

.companion-unlock-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg,
        var(--void-pink, #9932CC),
        var(--void-purple, #4B0082)
    );
    color: #fff;
    padding: 20px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    animation: slideInRight 0.5s ease-out;
    max-width: 350px;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.unlock-notification-header {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.unlock-notification-body {
    display: flex;
    align-items: center;
    gap: 16px;
}

.unlock-notification-icon {
    font-size: 48px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.unlock-notification-info {
    flex: 1;
}

.unlock-notification-name {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
}

.unlock-notification-bonus {
    font-size: 13px;
    opacity: 0.9;
}

/* ===== NO COMPANIONS STATE ===== */

.no-companions {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.no-companions-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-companions-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #aaa;
}

.no-companions-message {
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   🚀 MOBILE PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* 🔥 DISABLE ROTATE GLOW ANIMATION - Heavy GPU load */
    .companion-showcase::before {
        animation: none !important;
        background: radial-gradient(circle,
            rgba(153, 50, 204, 0.05) 0%,
            transparent 70%
        ) !important;
    }

    /* 🔥 DISABLE FLOAT ANIMATION */
    .active-companion-icon {
        animation: none !important;
        filter: drop-shadow(0 4px 12px rgba(153, 50, 204, 0.4)) !important;
    }

    /* 🔥 DISABLE PULSE ANIMATION */
    .companion-card.active .companion-icon {
        animation: none !important;
    }

    /* 🔥 SIMPLIFY CARD TRANSITIONS */
    .companion-card {
        transition: border-color 0.2s ease, transform 0.15s ease !important;
    }

    .companion-card:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 12px rgba(153, 50, 204, 0.2) !important;
    }

    /* 🔥 SIMPLIFY BUTTON TRANSITIONS */
    .companion-btn {
        transition: transform 0.15s ease !important;
    }

    .companion-btn-primary:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 12px rgba(153, 50, 204, 0.3) !important;
    }

    /* 🔥 CONTAIN LAYOUT */
    .companion-section,
    .companion-showcase,
    .companion-grid,
    .companion-card {
        contain: layout !important;
    }
}
