/**
 * Discovery Compass Styles
 * Mobile-first design with portrait/landscape support
 */

/* Discovery Button in Toolbar */
.discovery-button {
    position: relative !important;
    width: 55px;
    height: 55px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.discovery-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.discovery-button:hover img {
    transform: scale(1.1);
}

/* Glow effect when goals available */
.discovery-button.has-goals {
    animation: discoveryGlow 2s ease-in-out infinite;
}

@keyframes discoveryGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(0, 212, 255, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.9));
    }
}

/* Badge showing number of goals */
.discovery-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.5);
}

.discovery-badge .badge-content {
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 5px;
}

/* Discovery Panel Container */
.discovery-panel {
    position: fixed;
    display: none; /* Hidden by default, shown via JS */
    z-index: 145; /* Below modals (2000) but above toolbar (150) */
    background: rgba(10, 25, 47, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: panelSlideIn 0.3s ease-out;
}

.discovery-panel.visible {
    display: block;
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Container */
.discovery-cards-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.5) rgba(255, 255, 255, 0.1);
}

.discovery-cards-container::-webkit-scrollbar {
    height: 6px;
}

.discovery-cards-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.discovery-cards-container::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.5);
    border-radius: 3px;
}

.discovery-cards-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.7);
}

/* Individual Discovery Card */
.discovery-card {
    flex: 0 0 auto;
    width: 180px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.discovery-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.discovery-card:hover::before {
    left: 100%;
}

.discovery-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}

/* Card Icon */
.card-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    display: block;
    margin: 0 auto 8px;
    border-radius: 8px;
}

/* Card Icon Emoji (for products) */
.card-icon-emoji {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 40px;
    line-height: 1;
    background: rgba(0, 212, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.15);
}

/* Card Content */
.card-content {
    text-align: center;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 4px 0;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.card-description {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

/* Progress Bar */
.progress-bar-discovery {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: visible;
    margin: 8px 0 4px 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-fill-discovery {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #0096c8);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.progress-text-discovery {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    font-size: 11px;
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 5px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.3px;
}

/* Action Button */
.card-action {
    width: 100%;
    padding: 6px 12px;
    margin-top: 8px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 150, 200, 0.2));
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-action:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 150, 200, 0.3));
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

/* Completed Card State */
.discovery-card.completed {
    border-color: rgba(0, 255, 128, 0.4);
    background: linear-gradient(145deg, rgba(0, 255, 128, 0.08), rgba(0, 255, 128, 0.03));
}

.discovery-card.completed .progress-fill-discovery {
    background: linear-gradient(90deg, #00ff80, #00c060);
    box-shadow: 0 0 10px rgba(0, 255, 128, 0.5);
}

.completion-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #00ff80, #00c060);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 255, 128, 0.5);
}

/* Claim Button */
.claim-button {
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    background: linear-gradient(135deg, #ff6b00, #ff4500);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
    animation: claimPulse 2s ease-in-out infinite;
}

@keyframes claimPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(255, 107, 0, 0.6);
    }
}

.claim-button:hover {
    background: linear-gradient(135deg, #ff8800, #ff5500);
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 107, 0, 0.6);
}

.claim-button:active {
    transform: scale(0.98);
}

/* Claimed Card State */
.discovery-card.claimed {
    opacity: 0.5;
    pointer-events: none;
}

/* Landscape Layout */
@media (orientation: landscape) {
    .discovery-panel {
        bottom: max(calc(env(safe-area-inset-bottom) + 80px), 100px);
        right: max(calc(env(safe-area-inset-right) + 80px), 100px);
        max-width: 620px;
        max-height: calc(100vh - 180px);
    }

    .discovery-cards-container {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .discovery-card {
        width: 180px;
        min-height: 220px;
    }
}

/* Portrait Layout */
@media (orientation: portrait) {
    .discovery-panel {
        bottom: max(calc(env(safe-area-inset-bottom) + 100px), 120px);
        left: 0;
        right: 0;
        margin: 0 auto;
        width: 90%;
        max-width: 400px;
        max-height: calc(100dvh - 180px);
        padding: 10px;
    }

    .discovery-cards-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        overflow-y: auto;
        overflow-x: hidden;
        max-height: calc(100dvh - 200px);
    }

    .discovery-card {
        width: 160px;
    }

    .card-icon {
        width: 50px;
        height: 50px;
    }

    .card-icon-emoji {
        width: 50px;
        height: 50px;
        font-size: 34px;
    }

    .card-title {
        font-size: 12px;
    }

    .card-description {
        font-size: 10px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .discovery-panel {
        width: 95%;
        padding: 8px;
    }

    .discovery-cards-container {
        gap: 8px;
    }

    .discovery-card {
        padding: 10px;
        min-height: 180px;
    }

    .card-icon {
        width: 45px;
        height: 45px;
    }

    .card-icon-emoji {
        width: 45px;
        height: 45px;
        font-size: 30px;
    }

    .card-title {
        font-size: 11px;
    }

    .card-description {
        font-size: 9px;
    }
}

/* Tablet landscape */
@media (orientation: landscape) and (min-width: 768px) and (max-width: 1024px) {
    .discovery-panel {
        max-width: 700px;
    }

    .discovery-card {
        width: 200px;
    }
}

/* Close button for panel (optional) */
.discovery-panel-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.discovery-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Tutorial completion hint */
.discovery-tap-hint {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    pointer-events: none;
    animation: discoveryTap 1.2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    z-index: 1000;
}

@keyframes discoveryTap {
    0%, 100% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) translateY(-8px) scale(1.1);
        opacity: 0.9;
    }
}
