/**
 * Onboarding Tour Styles
 * Styling untuk panduan interaktif user baru
 */

/* Overlay gelap - transparent untuk allow spotlight */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    pointer-events: auto;
}

/* Spotlight untuk highlight element - ini yang buat lubang terang */
.tour-spotlight {
    position: fixed;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10002;
    background: transparent;
}

/* Highlight effect untuk element yang ditunjuk */
.tour-highlighted {
    position: relative;
    z-index: 10000 !important;
    outline: 4px solid rgba(76, 175, 80, 0.9) !important;
    outline-offset: 4px !important;
    border-radius: 8px;
    animation: tourPulse 1.5s ease-in-out infinite;
}

@keyframes tourPulse {
    0%, 100% {
        outline-color: rgba(76, 175, 80, 0.9);
        outline-offset: 4px;
        filter: drop-shadow(0 0 15px rgba(76, 175, 80, 0.6));
    }
    50% {
        outline-color: rgba(76, 175, 80, 1);
        outline-offset: 6px;
        filter: drop-shadow(0 0 25px rgba(76, 175, 80, 0.8));
    }
}

/* Butang dalam hero slider - kekalkan warna asal */
.tour-highlighted.btn,
a.tour-highlighted,
button.tour-highlighted {
    /* Jangan override background - kekalkan warna asal butang */
    outline: 5px solid #4CAF50 !important;
    outline-offset: 5px !important;
    filter: drop-shadow(0 0 20px rgba(76, 175, 80, 0.8)) drop-shadow(0 0 40px rgba(76, 175, 80, 0.5)) !important;
}

/* Hero section buttons - extra visibility */
#heroTambahListingBtn.tour-highlighted,
#heroCariHasilBtn.tour-highlighted,
#heroPermintaanBtn.tour-highlighted,
.hero-section .tour-highlighted,
.hero-content .tour-highlighted,
.carousel-item .tour-highlighted {
    outline: 5px solid #ffffff !important;
    outline-offset: 5px !important;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 30px rgba(76, 175, 80, 0.8)) !important;
    transform: scale(1.02);
}

/* Mobile bottom nav highlight - pastikan nampak jelas */
.mobile-bottom-nav .tour-highlighted {
    z-index: 10001 !important;
    border-radius: 12px;
    outline: 4px solid rgba(76, 175, 80, 0.9) !important;
    outline-offset: 3px !important;
}

.mobile-bottom-nav .tour-highlighted .add-button {
    outline: 3px solid rgba(76, 175, 80, 0.9) !important;
    outline-offset: 3px !important;
}

/* Pastikan parent container tak block highlight */
.mobile-bottom-nav.tour-parent-highlight {
    z-index: 9999 !important;
}

/* Card dan element lain yang perlu background terang */
.card.tour-highlighted,
.category-col.tour-highlighted,
.nav-tabs.tour-highlighted,
#listingTabs.tour-highlighted {
    background: rgba(255, 255, 255, 0.98) !important;
}

/* Tooltip container */
.tour-tooltip {
    position: absolute;
    width: 320px;
    max-width: 90vw;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 10003;
    animation: tooltipFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-height: calc(100vh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Tooltip header */
.tour-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.tour-step-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
}

.tour-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.tour-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Tooltip content */
.tour-title {
    margin: 0;
    padding: 16px 16px 8px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1B5E20;
}

.tour-content {
    margin: 0;
    padding: 0 16px 16px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

/* Tooltip footer */
.tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.tour-nav {
    display: flex;
    gap: 8px;
}

/* Buttons */
.tour-btn {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.tour-btn-prev {
    background: #e9ecef;
    color: #555;
}

.tour-btn-prev:hover {
    background: #dee2e6;
}

.tour-btn-next {
    background: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.tour-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(46, 125, 50, 0.4);
}

/* Mobile responsive - Tablet */
@media (max-width: 768px) {
    .tour-tooltip {
        position: fixed !important;
        width: calc(100vw - 32px) !important;
        max-width: 400px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        z-index: 10003 !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(76, 175, 80, 0.5) !important;
        max-height: calc(100vh - 24px - env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .tour-title {
        font-size: 0.9rem;
        padding: 8px 10px 2px;
    }
    
    .tour-content {
        font-size: 0.8rem;
        padding: 0 10px 8px;
        line-height: 1.35;
    }
    
    .tour-footer {
        flex-direction: row;
        gap: 4px;
        padding: 4px 8px;
    }
    
    .tour-nav {
        width: 100%;
        justify-content: flex-end;
    }
    
    .tour-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
        flex: 0 0 auto;
        text-align: center;
    }
    
    /* Spotlight lebih visible di mobile */
    .tour-spotlight {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.85) !important;
        border: 3px solid rgba(76, 175, 80, 0.8) !important;
    }
    
    /* Highlight lebih terang di mobile */
    .tour-highlighted {
        outline: 3px solid rgba(76, 175, 80, 1) !important;
        outline-offset: 3px !important;
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.6) !important;
    }
    
    .tour-tooltip-header {
        padding: 6px 10px;
    }
    
    .tour-step-indicator {
        font-size: 0.75rem;
    }

    /* Tooltip extra compact khas untuk step 4 di mobile */
    .tour-tooltip.tour-tooltip-compact {
        max-height: none;
        padding-bottom: 2px;
    }

    .tour-tooltip.tour-tooltip-compact .tour-title {
        font-size: 0.78rem;
        padding: 4px 8px 0;
    }

    .tour-tooltip.tour-tooltip-compact .tour-content {
        font-size: 0.7rem;
        padding: 0 8px 4px;
        line-height: 1.25;
    }

    .tour-tooltip.tour-tooltip-compact .tour-footer {
        padding: 2px 6px 4px;
    }
}

/* Mobile responsive - Small phones */
@media (max-width: 576px) {
    .tour-tooltip {
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        left: 12px !important;
        right: 12px !important;
        transform: none !important;
        border-radius: 10px;
        max-height: calc(100vh - 28px - env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .tour-title {
        font-size: 0.85rem;
        padding: 8px 8px 2px;
    }
    
    .tour-content {
        font-size: 0.78rem;
        padding: 0 8px 6px;
        line-height: 1.3;
    }
    
    .tour-footer {
        padding: 4px 8px;
        gap: 4px;
    }
    
    .tour-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    .tour-tooltip-header {
        padding: 8px 12px;
    }
    
    .tour-close-btn {
        width: 26px;
        height: 26px;
        font-size: 1.1rem;
    }
    
    .tour-spotlight {
        border-radius: 6px;
    }
    
    .tour-highlighted {
        outline-width: 2px !important;
        outline-offset: 2px !important;
    }
}

/* Mobile responsive - Extra small phones (iPhone SE, etc) */
@media (max-width: 375px) {
    .tour-tooltip {
        width: calc(100vw - 16px) !important;
        left: 8px !important;
        right: 8px !important;
        border-radius: 8px;
        max-height: calc(100vh - 24px - env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .tour-title {
        font-size: 0.8rem;
        padding: 6px 8px 2px;
    }
    
    .tour-content {
        font-size: 0.72rem;
        padding: 0 8px 6px;
        line-height: 1.25;
    }
    
    .tour-footer {
        padding: 4px 8px;
        gap: 4px;
    }
    
    .tour-nav {
        gap: 6px;
    }
    
    .tour-btn {
        padding: 4px 6px;
        font-size: 0.68rem;
        border-radius: 14px;
    }
    
    .tour-tooltip-header {
        padding: 6px 10px;
    }
    
    .tour-step-indicator {
        font-size: 0.75rem;
    }
    
    .tour-close-btn {
        width: 24px;
        height: 24px;
        font-size: 1rem;
    }
}

/* Landscape mode untuk mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .tour-tooltip {
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    
    .tour-title {
        padding: 8px 12px 4px;
        font-size: 0.9rem;
    }
    
    .tour-content {
        padding: 0 12px 8px;
        font-size: 0.8rem;
    }
    
    .tour-footer {
        padding: 8px 12px;
    }
    
    .tour-btn {
        padding: 8px 12px;
    }
}

/* Butang untuk trigger tour manual - dalam header navbar */
.tour-trigger-btn-header {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.tour-trigger-btn-header:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.5);
}

.tour-trigger-btn-header i {
    animation: questionPulse 2s infinite;
}

@keyframes questionPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Mobile adjustment untuk butang trigger dalam header */
@media (max-width: 991.98px) {
    .tour-trigger-btn-header {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .tour-trigger-btn-header {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }
}

/* Progress dots (optional) */
.tour-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
}

.tour-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dee2e6;
    transition: all 0.3s ease;
}

.tour-progress-dot.active {
    background: #4CAF50;
    transform: scale(1.2);
}

.tour-progress-dot.completed {
    background: #2E7D32;
}
