/**
 * Xplore Norway Web App - Custom Styles
 * Mobile-first responsive design
 */

/* Reset and base styles */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Leaflet map adjustments */
.leaflet-container {
    font-family: inherit;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 16px;
    font-size: 14px;
    line-height: 1.5;
}

/* Custom marker icons */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
    transition: transform 0.2s;
    position: relative;
}

.custom-marker:hover {
    transform: scale(1.1);
}

.custom-marker-icon {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
}

/* Video badge on marker */
.video-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
    border: 2px solid white;
}

.video-badge svg {
    color: white;
    margin-left: 1px;
}

/* Marker pulse animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.marker-active {
    animation: pulse 2s infinite;
}

/* User location marker */
.user-marker {
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border: 4px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Partner marker (square shape) */
.partner-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.partner-marker-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.partner-marker:hover .partner-marker-icon {
    transform: scale(1.1);
}

/* Locate button styling */
.locate-button {
    background: white !important;
    color: #4b5563 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border: none !important;
    text-decoration: none !important;
}

.locate-button:hover {
    background: #f3f4f6 !important;
}

/* POI Detail Sheet */
#poi-sheet h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

#poi-sheet .poi-image {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 12px;
}

#poi-sheet .poi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 8px;
}

#poi-sheet .poi-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    flex: 1;
}

#poi-sheet .poi-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

#poi-sheet .play-button-small {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

#poi-sheet .youtube-button {
    background: #FF0000;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

#poi-sheet .youtube-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#poi-sheet .play-button-small:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#poi-sheet .play-button-small:active {
    transform: scale(0.95);
}

#poi-sheet .play-button-small.is-playing {
    background: #ef4444;
    animation: pulse-playing 1.5s ease-in-out infinite;
}

@keyframes pulse-playing {
    0%, 100% { box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 2px 16px rgba(239, 68, 68, 0.6); }
}

#poi-sheet .youtube-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #7c3aed;
    font-weight: 500;
    text-decoration: none;
    margin-top: 8px;
}

#poi-sheet .youtube-link:hover {
    text-decoration: underline;
}

#poi-sheet .poi-description {
    color: #4b5563;
    line-height: 1.7;
    margin-bottom: 16px;
}

#poi-sheet .poi-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}

/* Star Rating */
.star-rating {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 16px;
}

.star-rating .star {
    color: #d1d5db;
}

.star-rating .star.filled {
    color: #fbbf24;
}

.star-rating .star.half {
    background: linear-gradient(90deg, #fbbf24 50%, #d1d5db 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* POI Tips */
.poi-tip {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    border-left: 4px solid;
}

.poi-tip .tip-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.poi-tip .tip-content {
    flex: 1;
}

.poi-tip .tip-content strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.poi-tip .tip-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.9;
}

.poi-tip.tip-danger {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.poi-tip.tip-crowd {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.poi-tip.tip-weather {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #166534;
}

/* Play button */
.play-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0, 51, 255, 0.3);
}

.play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 51, 255, 0.4);
}

.play-button:active {
    transform: translateY(0);
}

.play-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Category filter buttons */
.category-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: white;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    cursor: pointer;
}

.category-filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-filter-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.category-filter-btn .category-icon {
    font-size: 16px;
}

/* Hiking level filter buttons */
.hiking-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: white;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    cursor: pointer;
}

.hiking-filter-btn:hover {
    border-color: #84cc16;
    color: #65a30d;
}

.hiking-filter-btn.active {
    border-color: #84cc16;
    background: #84cc16;
    color: white;
}

.hiking-filter-btn .hiking-filter-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Rating filter buttons */
.rating-filter-btn {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: white;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.rating-filter-btn:hover {
    border-color: #fbbf24;
}

.rating-filter-btn.active {
    border-color: #fbbf24;
    background: #fef3c7;
}

.rating-filter-btn .rating-stars {
    color: #fbbf24;
    letter-spacing: 1px;
}

/* Search overlay - styles now handled via Tailwind in HTML */

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Distance badge */
.distance-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 12px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Audio player controls */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 12px;
    margin-top: 16px;
}

.audio-progress {
    flex: 1;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.audio-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.1s linear;
}

/* Trigger point info */
.trigger-info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.trigger-info p {
    color: #1e40af;
    font-size: 13px;
    font-weight: 500;
}

/* Norwegian pronunciation highlight */
.no-pronunciation {
    background: #fef3c7;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* Loading states */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

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

/* Responsive adjustments */
@media (min-width: 768px) {
    /* Tablet landscape */
    #poi-sheet {
        left: auto;
        right: 16px;
        bottom: 76px;
        width: 400px;
        max-height: calc(100vh - 160px);
        border-radius: 16px;
    }

    #filter-panel {
        left: auto;
        right: 16px;
        width: 350px;
        border-radius: 0 0 12px 12px;
    }

    #app-cta {
        left: auto;
        right: 16px;
        width: 350px;
    }
}

@media (min-width: 1024px) {
    /* Desktop */
    #header {
        padding: 0 32px;
    }

    #poi-sheet {
        width: 480px;
    }
}

/* Print styles */
@media print {
    #header,
    #bottom-nav,
    #filter-panel,
    #app-cta {
        display: none;
    }

    #map {
        position: relative;
        height: 400px;
    }

    #poi-sheet {
        position: relative;
        transform: none;
        box-shadow: none;
        max-height: none;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
    /* Will be implemented in future update */
}

/* ============================================
   HIKING LEVEL STYLES
   ============================================ */

/* Hiking level badge in POI meta */
.hiking-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: #166534;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hiking-level-badge:hover {
    background: #dcfce7;
    border-color: #4ade80;
}

.hiking-badge-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.hiking-info-icon {
    color: #22c55e;
    opacity: 0.7;
}

.hiking-level-badge:hover .hiking-info-icon {
    opacity: 1;
}

/* Hiking levels modal overlay */
.hiking-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 16px;
}

.hiking-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Modal content */
.hiking-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.hiking-modal-overlay.visible .hiking-modal-content {
    transform: translateY(0);
}

.hiking-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.hiking-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.hiking-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.hiking-modal-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.hiking-modal-intro {
    padding: 16px 24px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
    border-bottom: 1px solid #f3f4f6;
}

.hiking-levels-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual hiking level card */
.hiking-level-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    transition: background 0.2s ease;
}

.hiking-level-card:hover {
    background: #f3f4f6;
}

.hiking-level-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.hiking-level-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.hiking-level-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.hiking-level-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

/* Mobile adjustments for hiking modal */
@media (max-width: 640px) {
    .hiking-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .hiking-modal-content {
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
    }

    .hiking-modal-header {
        padding: 16px 20px;
    }

    .hiking-modal-intro {
        padding: 12px 20px;
    }

    .hiking-levels-list {
        padding: 12px;
    }

    .hiking-level-card {
        padding: 14px;
    }

    .hiking-level-icon {
        width: 36px;
        height: 36px;
    }
}
