/* Map Objects Styling */

:root {
    --object-size: 80px;
    --object-border-radius: 20px;
    --glow-common: rgba(62, 200, 255, 0.6);
    --glow-rare: rgba(123, 97, 255, 0.6);
    --glow-epic: rgba(255, 77, 141, 0.6);
    --glow-legendary: rgba(255, 215, 95, 0.8);
    --glow-chest: rgba(255, 180, 100, 0.6);
}

/* Map object container */
.map-object-marker {
    position: absolute;
    width: var(--object-size);
    height: var(--object-size);
    border-radius: var(--object-border-radius);
    overflow: hidden;
    transform-style: preserve-3d;
    pointer-events: all;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
    will-change: transform, filter;
}

/* Video inside marker */
.map-object-marker video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--object-border-radius);
}

/* Floating animation */
@keyframes float {

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

    50% {
        transform: translateY(-8px) translateZ(4px);
    }
}

.map-object-marker {
    animation: float 3s ease-in-out infinite;
}

/* Dimmed state - far away */
.map-object-marker.dimmed {
    opacity: 0.35;
    filter: grayscale(60%) brightness(0.7);
    transform: scale(0.85);
}

.map-object-marker.dimmed:hover {
    opacity: 0.5;
    transform: scale(0.9);
}

/* In range state - can collect */
.map-object-marker.in-range {
    opacity: 1;
    filter: drop-shadow(0 0 20px currentColor) drop-shadow(0 0 40px currentColor);
    animation: float 3s ease-in-out infinite, pulse-glow 1.5s ease-in-out infinite;
}

.map-object-marker.in-range:hover {
    transform: scale(1.1) translateY(-4px);
}

/* Pulse glow animation for in-range objects */
@keyframes pulse-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 15px currentColor) brightness(1);
    }

    50% {
        filter: drop-shadow(0 0 30px currentColor) drop-shadow(0 0 50px currentColor) brightness(1.15);
    }
}

/* Rarity colors */
.map-object-marker[data-rarity="common"] {
    color: var(--glow-common);
    border: 2px solid rgba(62, 200, 255, 0.4);
}

.map-object-marker[data-rarity="rare"] {
    color: var(--glow-rare);
    border: 2px solid rgba(123, 97, 255, 0.4);
}

.map-object-marker[data-rarity="epic"] {
    color: var(--glow-epic);
    border: 2px solid rgba(255, 77, 141, 0.4);
}

.map-object-marker[data-rarity="legendary"] {
    color: var(--glow-legendary);
    border: 2px solid rgba(255, 215, 95, 0.5);
}

.map-object-marker[data-type="chest"] {
    color: var(--glow-chest);
    border: 2px solid rgba(255, 180, 100, 0.4);
}

/* Emoji Marker Styles - FIXED STABILITY */
.map-object-emoji-marker {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Removed transition on transform to prevent "floating" drift during map movement */
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    will-change: transform;
    /* Optimize for composition */
}

.map-object-emoji-marker .marker-content {
    font-size: 28px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    /* Removed bounce animation to ensure rigid position */
}

/* Rarity Colors for Glow */
.map-object-emoji-marker.common {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

.map-object-emoji-marker.rare {
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.6);
    border-color: rgba(0, 191, 255, 0.6);
}

.map-object-emoji-marker.epic {
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.7);
    border-color: rgba(138, 43, 226, 0.7);
}

.map-object-emoji-marker.legendary {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    border-color: rgba(255, 215, 0, 0.8);
}

.map-object-emoji-marker.dimmed {
    opacity: 0.6;
    filter: grayscale(0.5);
    transform: scale(0.8);
}

.map-object-emoji-marker.in-range {
    opacity: 1;
    filter: none;
    transform: scale(1.2);
    z-index: 100;
    background: rgba(255, 140, 0, 0.3);
    border-color: #FF8C00;
    box-shadow: 0 0 30px rgba(255, 140, 0, 0.8);
    /* Stronger glow when close */
}

/* Static Marker Styles */
.map-object-marker-static {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 165, 0, 0.4) 0%, rgba(255, 165, 0, 0) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.map-object-marker-static img {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    animation: float 2s ease-in-out infinite;
}

.map-object-marker-static.dimmed {
    opacity: 0.6;
    filter: grayscale(0.8);
}

.map-object-marker-static.in-range {
    opacity: 1;
    filter: none;
    transform: scale(1.1);
}

@keyframes float {

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

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

/* Collect Button */
.map-object-collect-btn {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FF8C00, #FF4500);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.4);
    z-index: 1000;
    cursor: pointer;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.map-object-collect-btn:active {
    transform: translateX(-50%) scale(0.95);
}

@keyframes popIn {
    from {
        transform: translateX(-50%) scale(0);
    }

    to {
        transform: translateX(-50%) scale(1);
    }
}

/* Toast */
.map-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 2000;
    font-size: 14px;
    backdrop-filter: blur(5px);
}

/* Modal Styles Reuse/Override */
.object-interaction-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 24px;
    width: 90%;
    max-width: 320px;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    text-align: center;
}

.object-interaction-modal.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.object-interaction-modal__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.object-interaction-modal__overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 20px auto;
    filter: drop-shadow(0 0 20px rgba(255, 165, 0, 0.3));
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-button {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.modal-button.primary {
    background: #FF8C00;
    color: white;
}

.modal-button.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Interaction Modal */
.object-interaction-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 420px;
    background: linear-gradient(135deg, rgba(22, 25, 34, 0.98), rgba(30, 35, 48, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 32px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.object-interaction-modal.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.object-interaction-modal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.object-interaction-modal__overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Modal header */
.modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.modal-header__title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-header__subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* Video preview in modal */
.modal-video-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid currentColor;
    box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    animation: float 3s ease-in-out infinite;
}

.modal-video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Modal info */
.modal-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
}

.modal-info__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.modal-info__label {
    color: rgba(255, 255, 255, 0.6);
}

.modal-info__value {
    color: #fff;
    font-weight: 600;
}

/* Modal buttons */
.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-button {
    flex: 1;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.modal-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-button:hover::before {
    opacity: 1;
}

.modal-button--primary {
    background: linear-gradient(135deg, #ff7a1a, #ff5a00);
    color: #fff;
    box-shadow: 0 4px 16px rgba(255, 122, 26, 0.4);
}

.modal-button--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 122, 26, 0.6);
}

.modal-button--secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-button--secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Result screen */
.modal-result {
    text-align: center;
}

.modal-result__icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-result__title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 16px 0;
}

.modal-result__items {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
}

.modal-result__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-result__item:last-child {
    border-bottom: none;
}

.modal-result__item-name {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.modal-result__item-quantity {
    color: #ffd75f;
    font-weight: 700;
    font-size: 16px;
}

/* Loading state */
.modal-loading {
    text-align: center;
    padding: 24px;
}

.modal-loading__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff7a1a;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

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

.modal-loading__text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Distance indicator */
.map-object-marker__distance {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    color: #fff;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.map-object-marker.in-range .map-object-marker__distance,
.map-object-marker:hover .map-object-marker__distance {
    opacity: 1;
}