/* Ported from animated-pirate-map.html */
@import url('https://fonts.googleapis.com/css2?family=Pirata+One&family=Crimson+Text:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', serif;
    background: linear-gradient(to bottom, #F4E8D0 0%, #E8D4B0 100%);
    color: #2C1810;
    overflow-x: hidden;
}

/* Parchment texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 69, 19, 0.03) 2px, rgba(139, 69, 19, 0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(139, 69, 19, 0.03) 2px, rgba(139, 69, 19, 0.03) 4px);
    pointer-events: none;
    z-index: 1;
}

.container {
    position: relative;
    z-index: 2;
}

/* Hero Section with Scroll Animation */
.hero {
    text-align: center;
    padding: 80px 20px;
    background:
        radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.3), transparent 70%),
        linear-gradient(180deg, rgba(139, 69, 19, 0.15) 0%, transparent 100%);
    border-bottom: 5px double #654321;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

/* Animated skull and crossbones */
.hero::before {
    content: '☠️';
    position: absolute;
    font-size: 200px;
    opacity: 0.05;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    50% {
        transform: translate(-50%, -55%) rotate(5deg);
    }
}

.pirate-flag {
    font-size: 80px;
    animation: wave 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes wave {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

h1 {
    font-family: 'Pirata One', cursive;
    font-size: clamp(48px, 8vw, 96px);
    color: #8B0000;
    text-shadow:
        4px 4px 0 #FFD700,
        6px 6px 10px rgba(0, 0, 0, 0.5);
    margin: 20px 0;
    letter-spacing: 6px;
    animation: title-glow 3s ease-in-out infinite;
}

@keyframes title-glow {

    0%,
    100% {
        text-shadow: 4px 4px 0 #FFD700, 6px 6px 10px rgba(0, 0, 0, 0.5);
    }

    50% {
        text-shadow: 4px 4px 0 #FFD700, 6px 6px 20px rgba(212, 175, 55, 0.8);
    }
}

.subtitle {
    font-size: clamp(18px, 3vw, 28px);
    color: #654321;
    font-style: italic;
    margin: 20px auto;
    max-width: 600px;
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.scroll-indicator {
    margin-top: 40px;
    font-size: 48px;
    animation: bounce 2s infinite;
    cursor: pointer;
}

@keyframes bounce {

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

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

/* Stats Bar with Counter Animation */
.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 60px 20px;
    background:
        linear-gradient(to right, rgba(139, 69, 19, 0.1), rgba(212, 175, 55, 0.2), rgba(139, 69, 19, 0.1));
    border-top: 3px solid #654321;
    border-bottom: 3px solid #654321;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
}

.stats-bar::before,
.stats-bar::after {
    content: '🗡️';
    position: absolute;
    font-size: 60px;
    opacity: 0.3;
    top: 50%;
    transform: translateY(-50%);
}

.stats-bar::before {
    left: 20px;
}

.stats-bar::after {
    right: 20px;
    transform: translateY(-50%) scaleX(-1);
}

.stat-item {
    text-align: center;
    padding: 20px;
    min-width: 200px;
    position: relative;
    animation: slideIn 0.8s ease-out;
}

.stat-item:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-item:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-item:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-item:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

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

.stat-number {
    font-size: clamp(36px, 6vw, 64px);
    font-weight: bold;
    color: #D4AF37;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
    font-family: 'Pirata One', cursive;
}

.stat-label {
    font-size: clamp(14px, 2vw, 20px);
    color: #654321;
    margin-top: 10px;
    font-weight: 600;
}

/* Map Container */
.map-section {
    max-width: 1600px;
    margin: 80px auto;
    padding: 40px 20px;
}

.map-header {
    text-align: center;
    margin-bottom: 40px;
}

.map-title {
    font-family: 'Pirata One', cursive;
    font-size: clamp(36px, 6vw, 56px);
    color: #8B0000;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 25px;
    background: rgba(244, 232, 208, 0.8);
    border: 3px solid #654321;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    animation: popIn 0.5s ease-out;
}

.legend-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background: rgba(255, 215, 0, 0.3);
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.legend-icon {
    font-size: 32px;
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

/* Filters */
.filters {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 15px 30px;
    background:
        linear-gradient(135deg, #8B4513 0%, #654321 100%);
    color: #F4E8D0;
    border: 3px solid #D4AF37;
    border-radius: 10px;
    font-family: 'Crimson Text', serif;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(212, 175, 55, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.filter-btn:hover::before {
    width: 300px;
    height: 300px;
}

.filter-btn:hover {
    transform: translateY(-3px) rotate(2deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    border-color: #FFD700;
}

.filter-btn.active {
    background: linear-gradient(135deg, #8B0000 0%, #660000 100%);
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.filter-btn span {
    position: relative;
    z-index: 1;
}

/* Map Container with Border */
.map-container {
    background: rgba(255, 255, 255, 0.4);
    border: 8px double #654321;
    border-radius: 15px;
    padding: 40px;
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(139, 69, 19, 0.1);
    position: relative;
    min-height: 600px;
    /* Ensure map has height */
    position: relative;
}

/* Corner decorations */
.map-container::before,
.map-container::after {
    content: '⚓';
    position: absolute;
    font-size: 48px;
    color: #654321;
    opacity: 0.3;
}

.map-container::before {
    top: 10px;
    left: 10px;
    animation: rotate-anchor 4s linear infinite;
}

.map-container::after {
    bottom: 10px;
    right: 10px;
    animation: rotate-anchor 4s linear infinite reverse;
}

@keyframes rotate-anchor {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* SVG Map Styling */
.ibiza-map {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.ibiza-map .region {
    transition: all 0.3s ease;
    cursor: pointer;
    fill-opacity: 0.2;
    stroke: #654321;
    stroke-width: 2;
}

.ibiza-map .region:hover {
    fill-opacity: 0.5 !important;
    filter: brightness(1.2);
}

.ibiza-map .marker {
    cursor: pointer;
    transition: all 0.3s ease;
    transform-origin: center;
}

.ibiza-map .marker:hover {
    transform: scale(1.5);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: rgba(244, 232, 208, 0.98);
    border: 3px solid #654321;
    border-radius: 10px;
    padding: 20px;
    max-width: 300px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip.active {
    opacity: 1;
    transform: scale(1);
}

.tooltip-title {
    font-size: 22px;
    font-weight: bold;
    color: #8B0000;
    margin-bottom: 10px;
    font-family: 'Pirata One', cursive;
}

.tooltip-rating {
    color: #D4AF37;
    font-size: 18px;
    margin-bottom: 5px;
}

.tooltip-reviews {
    color: #654321;
    font-size: 14px;
}

/* Modal for detailed info */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #F4E8D0 0%, #E8D4B0 100%);
    border: 8px double #654321;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: treasureOpen 0.6s ease-out;
    position: relative;
}

@keyframes treasureOpen {
    0% {
        transform: scale(0.5) rotateX(90deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.05) rotateX(-10deg);
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 3px solid #654321;
    padding-bottom: 20px;
}

.modal-title {
    font-family: 'Pirata One', cursive;
    font-size: 36px;
    color: #8B0000;
}

.close-btn {
    font-size: 36px;
    cursor: pointer;
    color: #654321;
    transition: all 0.3s;
    line-height: 1;
}

.close-btn:hover {
    color: #8B0000;
    transform: rotate(90deg) scale(1.2);
}

.modal-treasure {
    font-size: 64px;
    text-align: center;
    margin: 20px 0;
    animation: spin-treasure 2s ease-in-out;
}

@keyframes spin-treasure {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

.modal-details {
    margin: 20px 0;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.5);
    border-left: 4px solid #D4AF37;
    border-radius: 5px;
}

.detail-icon {
    font-size: 24px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.action-btn {
    flex: 1;
    padding: 15px;
    border: 3px solid #654321;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.btn-primary {
    background: linear-gradient(135deg, #8B0000 0%, #660000 100%);
    color: #F4E8D0;
}

.btn-secondary {
    background: linear-gradient(135deg, #D4AF37 0%, #FFD700 100%);
    color: #2C1810;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Floating decorative elements */
.floating-treasure {
    position: fixed;
    font-size: 48px;
    opacity: 0.1;
    pointer-events: none;
    animation: float-diagonal 20s linear infinite;
    z-index: 100;
}

@keyframes float-diagonal {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(100vw, 100vh) rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 40px 20px;
    }

    .stats-bar {
        padding: 40px 20px;
    }

    .legend {
        flex-direction: column;
        align-items: center;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .map-container {
        padding: 10px;
        min-height: auto;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        border-width: 4px;
    }

    /* Force map to be large enough to be readable/interactable */
    .ibiza-map {
        min-width: 800px;
        height: auto;
    }

    /* Hint for user to scroll */
    .map-container::after {
        content: '🖐️ Drag to Explore';
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 14px;
        background: rgba(255, 255, 255, 0.8);
        padding: 5px 10px;
        border-radius: 20px;
        pointer-events: none;
        opacity: 0.8;
        animation: none;
        /* Override the anchor animation */
        color: #654321;
        font-weight: bold;
    }

    .map-container::before {
        display: none;
        /* Hide decorative anchor on mobile to save space */
    }

    .modal-content {
        padding: 20px;
        width: 95%;
        margin: 10px;
    }
}

/* Loading animation */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #F4E8D0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.treasure-chest {
    font-size: 120px;
    animation: chest-bounce 1s ease-in-out infinite;
}

@keyframes chest-bounce {

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

    50% {
        transform: translateY(-30px) scale(1.1);
    }
}

/* -------------------------------------------------------------------------- */
/*                                View Toggles                                */
/* -------------------------------------------------------------------------- */
.view-toggle-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    position: relative;
    z-index: 10;
}

.view-toggle {
    display: inline-flex;
    background: #462815;
    /* Dark wood */
    border: 4px double #D4AF37;
    border-radius: 50px;
    padding: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    position: relative;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #F4E8D0;
    /* Parchment white */
    padding: 12px 30px;
    font-family: 'Pirata One', cursive;
    font-size: 24px;
    cursor: pointer;
    border-radius: 40px;
    transition: all 0.3s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-btn:hover {
    color: #FFD700;
    transform: translateY(-2px);
}

.toggle-btn.active {
    background: linear-gradient(180deg, #D4AF37 0%, #B8860B 100%);
    color: #2C1810;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.3),
        inset 0 2px 5px rgba(255, 255, 255, 0.4);
    text-shadow: none;
}

/* -------------------------------------------------------------------------- */
/*                              Card Grid Layout                              */
/* -------------------------------------------------------------------------- */
.map-grid {
    display: grid;
    /* Responsive Grid: min 320px width per card */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 20px 0;
    max-width: 1400px;
    margin: 0 auto;
}

.treasure-card {
    background: linear-gradient(135deg, #F9F1E0 0%, #E8D4B0 100%);
    border: 4px double #654321;
    border-radius: 15px;
    padding: 25px;
    position: relative;
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.2),
        inset 0 0 60px rgba(139, 69, 19, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

/* Texture overlay for cards */
.treasure-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.5;
    pointer-events: none;
}

.treasure-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #D4AF37;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(212, 175, 55, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(139, 69, 19, 0.2);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.card-title {
    font-family: 'Pirata One', cursive;
    font-size: 28px;
    color: #8B0000;
    margin: 0;
    line-height: 1.1;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 36px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.card-rating-container {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-rating {
    color: #D4AF37;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-reviews {
    color: #654321;
    font-size: 14px;
    font-style: italic;
    opacity: 0.8;
}

.card-details p {
    margin: 8px 0;
    font-size: 16px;
    color: #4A3728;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feature-tags {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card-feature {
    background: linear-gradient(to bottom, #fff 0%, #f0f0f0 100%);
    border: 1px solid #D4AF37;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    color: #654321;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Mobile specific improvements */
@media (max-width: 600px) {
    .map-grid {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        padding: 10px;
    }

    .view-toggle-container {
        margin: 15px 0;
    }

    .toggle-btn {
        padding: 10px 20px;
        font-size: 20px;
    }

    .treasure-card {
        padding: 20px;
    }
}