/* ============================================================
   TOUR DETAIL VIEW - iOS-Style Mobile Design
   Max-width 600px, centered, optimized for mobile
   ============================================================ */

/* Container - Full width */
.tour-detail-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #000000;
    display: none;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    overflow: hidden;
}

.tour-detail-view.active {
    opacity: 1;
}

/* ============================================================
   PREVIEW IMAGE SECTION
   ============================================================ */

.tour-detail-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(135deg, #0066FF 0%, rgba(0, 102, 255, 0.6) 100%);
    flex-shrink: 0;
}

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

/* Close button */
.close-tour-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease-out;
}

.close-tour-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

.close-tour-btn:active {
    transform: scale(0.95);
}

.close-tour-btn svg {
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============================================================
   CONTENT SECTION
   ============================================================ */

.tour-detail-content {
    flex: 1;
    background-color: #000000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tour-content-scroll {
    flex: 1;
    width: 100%;
    max-width: 600px;
    overflow-y: auto;
    padding-bottom: 120px; /* Space for fixed buttons */
    overscroll-behavior-y: contain;
}

/* Scrollbar styling */
.tour-content-scroll::-webkit-scrollbar {
    width: 3px;
}

.tour-content-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.tour-content-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.tour-content-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   TOUR HEADER SECTION
   ============================================================ */

.tour-header-section {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tour-name {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    word-break: break-word;
}

.tour-theme {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: #FFD700;
    letter-spacing: 0.3px;
}

/* Tour Stats Row - Simple inline text */
.tour-stats-row {
    font-size: 14px;
    font-weight: 500;
    color: #999999;
    margin-bottom: 0;
}

/* Override modern.css .stat-item styles for tour detail view */
.tour-detail-view .stat-item,
.tour-header-section .stat-item {
    display: inline !important;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    flex-direction: unset !important;
    align-items: unset !important;
    text-align: unset !important;
    gap: unset !important;
}

.tour-detail-view .stat-item:hover,
.tour-header-section .stat-item:hover {
    background: none !important;
}

.tour-detail-view .stat-item:not(:last-child)::after,
.tour-header-section .stat-item:not(:last-child)::after {
    content: " · ";
    margin: 0 4px;
}

.stat-icon {
    display: none;
}

/* Tour Code Section - REMOVED per user request */

/* ============================================================
   WAYPOINTS LIST - iOS Style
   ============================================================ */

.waypoints-list {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.waypoint-card {
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
    transition: background-color 0.2s ease-out;
}

.waypoint-card:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.waypoint-card.expanded {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Waypoint Header (Collapsed State) */
.waypoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.waypoint-header:active {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Waypoint Thumbnail - Small, left side */
.waypoint-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Loading state for images - skeleton effect */
.waypoint-thumbnail.loading,
.waypoint-image-wrapper.loading {
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waypoint-thumbnail.loading::after,
.waypoint-image-wrapper.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #0066FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.waypoint-image-wrapper.loading::after {
    width: 32px;
    height: 32px;
}

.waypoint-image-wrapper.loading .waypoint-image {
    opacity: 0;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Waypoint Number Badge - Between thumbnail and info */
.waypoint-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    color: white;
    font-weight: 700;
    font-size: 13px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Waypoint Info - Right side, takes remaining space */
.waypoint-info {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.waypoint-name {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
}

/* Description excerpt in collapsed state */
.waypoint-category {
    margin: 0;
    font-size: 14px;
    color: #999999;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Chevron indicator */
.waypoint-chevron {
    width: 18px;
    height: 18px;
    color: #666666;
    flex-shrink: 0;
    transition: transform 0.3s ease-out;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.waypoint-card.expanded .waypoint-chevron {
    transform: rotate(90deg);
}

/* Waypoint Content (Expanded State) */
.waypoint-content {
    display: none;
    padding: 0 20px 20px;
    text-align: center;
}

.waypoint-card.expanded .waypoint-content {
    display: block;
}

/* Full-width image in expanded state */
.waypoint-image-wrapper {
    display: inline-flex;
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #1a1a1a;
    margin-bottom: 16px;
    align-items: center;
    justify-content: center;
}

.waypoint-image {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    display: block;
}

/* Waypoint details in expanded state */
.waypoint-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.waypoint-description {
    margin: 0;
    font-size: 15px;
    color: #CCCCCC;
    line-height: 1.6;
}

.waypoint-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: #888888;
}

.waypoint-address svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ============================================================
   ACTION BAR - Fixed at bottom
   ============================================================ */

.tour-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #000000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 20px 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.action-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    width: 100%;
    max-width: 600px;
    justify-content: center;
}

/* Saved message */
.saved-message {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 10px;
    color: #22c55e;
    font-size: 14px;
    font-weight: 600;
}

.saved-checkmark {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Action Button Base */
.action-button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease-out;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.action-button:active:not(:disabled) {
    transform: scale(0.96);
}

.action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Save Button - iOS Blue */
.action-button-save {
    background: #0066FF;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.4);
}

.action-button-save:hover:not(:disabled) {
    background: #0052CC;
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.5);
}

/* Redeem Button - Gold */
.action-button-redeem {
    background: linear-gradient(135deg, #CC9933 0%, #E6B34D 100%);
    box-shadow: 0 4px 12px rgba(204, 153, 51, 0.4);
}

.action-button-redeem:hover:not(:disabled) {
    background: linear-gradient(135deg, #B38629 0%, #CC9933 100%);
    box-shadow: 0 6px 16px rgba(204, 153, 51, 0.5);
}

/* Purchased Badge - Golden label above Start button */
.purchased-badge {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    order: -1; /* Put badge before button */
}

.purchased-badge-text {
    font-size: 11px;
    font-weight: 600;
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Primary (Start) Button */
.action-button-primary {
    width: 100%;
    background: #0066FF;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.4);
}

.action-button-primary:hover:not(:disabled) {
    background: #0052CC;
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.5);
}

/* Upgrade Button - Gold */
.action-button-upgrade {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.4);
}

.action-button-upgrade:hover:not(:disabled) {
    background: linear-gradient(135deg, #FFE44D 0%, #FFB833 100%);
    box-shadow: 0 6px 16px rgba(255, 165, 0, 0.5);
}

.action-button-upgrade svg {
    fill: #1a1a1a;
}

/* Buy Button - Gold (All-Inclusive) */
.action-button-buy {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.4);
}

.action-button-buy:hover:not(:disabled) {
    background: linear-gradient(135deg, #FFE44D 0%, #FFB833 100%);
    box-shadow: 0 6px 16px rgba(255, 165, 0, 0.5);
}

.action-button-buy svg {
    fill: #1a1a1a;
}

/* Spinner for loading states */
.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   REDEMPTION SHEET MODAL
   ============================================================ */

.redeem-sheet-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

.redeem-sheet-modal.active {
    opacity: 1;
    pointer-events: all;
}

.redeem-sheet-modal.closing {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.redeem-sheet {
    width: 100%;
    max-width: 600px;
    background-color: #1a1a1a;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    animation: slideUpModal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.redeem-sheet-modal.closing .redeem-sheet {
    animation: slideDownModal 0.3s ease-out forwards;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDownModal {
    to {
        transform: translateY(100%);
    }
}

.redeem-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.redeem-sheet-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.redeem-sheet-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.redeem-sheet-close:hover {
    opacity: 0.7;
}

.redeem-sheet-close svg {
    width: 20px;
    height: 20px;
}

.redeem-sheet-content {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
}

.redeem-code-input {
    width: 100%;
    padding: 16px;
    background-color: #0a0f1f;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: border-color 0.2s;
}

.redeem-code-input::placeholder {
    color: #666666;
}

.redeem-code-input:focus {
    outline: none;
    border-color: #0066FF;
    background-color: #050812;
}

.redeem-sheet-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.redeem-cancel-btn,
.redeem-find-btn {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.redeem-cancel-btn {
    background-color: #2a2a2a;
    color: white;
}

.redeem-cancel-btn:hover {
    background-color: #333333;
}

.redeem-cancel-btn:active {
    transform: scale(0.96);
}

.redeem-find-btn {
    background: #0066FF;
    color: white;
}

.redeem-find-btn:hover {
    background: #0052CC;
}

.redeem-find-btn:active {
    transform: scale(0.96);
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

/* Very small screens */
@media (max-width: 375px) {
    .tour-name {
        font-size: 22px;
    }

    .tour-header-section {
        padding: 20px 16px 16px;
    }

    .waypoint-header {
        padding: 14px 16px;
    }

    .waypoint-content {
        padding: 0 16px 16px;
    }

    .action-button {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* Landscape or wider screens */
@media (min-width: 600px) {
    .tour-detail-view {
        border-radius: 0;
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
    }

    .tour-detail-image {
        height: 300px;
    }
}

/* ============================================================
   FIRST VISIT INTRO MODAL
   Floating overlay above action buttons - doesn't block page
   ============================================================ */

.first-visit-intro-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.first-visit-intro-modal.active {
    opacity: 1;
}

.intro-modal-content {
    position: relative;
    width: 100%;
    background: rgba(15, 15, 15, 0.98);
    border-radius: 16px 16px 0 0;
    padding: 10px 20px 16px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.first-visit-intro-modal.active .intro-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.intro-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-out;
}

.intro-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.intro-modal-close svg {
    width: 14px;
    height: 14px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.intro-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0 0 10px;
    padding-right: 30px;
}

.intro-modal-features {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.intro-modal-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    line-height: 1.3;
}

.intro-modal-features .feature-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.intro-modal-cta {
    width: 100%;
    padding: 12px 20px;
    background: #0066FF;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease-out;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.intro-modal-cta:hover {
    background: #0052CC;
}

.intro-modal-cta:active {
    transform: scale(0.98);
}

.intro-modal-cta svg {
    width: 18px;
    height: 18px;
}

/* Small screen adjustments for intro modal (iPhone SE etc.) */
@media (max-height: 700px) {
    .intro-modal-content {
        padding: 10px 16px 12px;
    }

    .intro-modal-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .intro-modal-features {
        gap: 3px;
        margin-bottom: 10px;
    }

    .intro-modal-features li {
        font-size: 13px;
    }

    .intro-modal-features .feature-icon {
        font-size: 15px;
        width: 20px;
    }

    .intro-modal-cta {
        padding: 10px 16px;
        font-size: 15px;
        border-radius: 10px;
    }
}
