/**
 * Unified Sighting View Component Styles
 * Version: 1.2.0
 * 
 * Include this file in both index.html and trips.html
 * <link rel="stylesheet" href="sighting-view.css">
 */

/* ============================================
   BODY SCROLL LOCK
   ============================================ */
body.modal-open {
    overflow: hidden;
}

/* ============================================
   SIGHTING VIEW OVERLAY & MODAL
   ============================================ */
.sighting-view-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: flex-end;
    padding: 0;
}

.sighting-view-overlay.active {
    display: flex;
}

@media (min-width: 600px) {
    .sighting-view-overlay {
        align-items: center;
        padding: 20px;
    }
}

.sighting-view-modal {
    background: var(--sand-100, #faf8f4);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    animation: sightingViewSlideUp 0.3s ease;
}

@media (min-width: 600px) {
    .sighting-view-modal {
        border-radius: 20px;
        max-height: 85vh;
    }
}

@keyframes sightingViewSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close animation */
.sighting-view-modal.closing {
    animation: sightingViewSlideDown 0.25s ease forwards;
}

@keyframes sightingViewSlideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

/* Overlay fade animation */
.sighting-view-overlay.closing {
    animation: sightingViewOverlayFadeOut 0.25s ease forwards;
}

@keyframes sightingViewOverlayFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .sighting-view-modal,
    .sighting-view-modal.closing,
    .sighting-view-overlay.closing {
        animation: none;
    }
}

/* ============================================
   PHOTO HEADER
   ============================================ */
.sighting-view-header {
    position: relative;
    aspect-ratio: 4 / 3;
    background: linear-gradient(145deg, var(--forest-50, #f4faf6) 0%, var(--sand-200, #f5f0e8) 100%);
    overflow: hidden;
}

.sighting-view-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.sighting-view-header img:hover {
    transform: scale(1.02);
}

/* Close button */
.sighting-view-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    color: var(--text-secondary, #555);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    z-index: 10;
}

.sighting-view-close:hover {
    background: white;
    color: var(--text-primary, #1a1a1a);
    transform: scale(1.05);
}

/* Photo badge ("Your photo") */
.sighting-view-photo-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 8px;
    color: var(--forest-700, #234d38);
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

/* Lifer badge */
.sighting-view-lifer-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #daa520, #f4c430);
    border-radius: 8px;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(218, 165, 32, 0.4);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Photo expand hint */
.sighting-view-photo-expand {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 6px;
    color: white;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 5;
}

.sighting-view-header:hover .sighting-view-photo-expand {
    opacity: 1;
}

/* Photo carousel dots */
.sighting-view-photo-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}

.sighting-view-photo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.sighting-view-photo-dot.active {
    background: white;
    transform: scale(1.2);
}

.sighting-view-photo-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

/* Photo navigation arrows */
.sighting-view-photo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 6;
    opacity: 0.7;
}

.sighting-view-photo-nav:hover {
    background: rgba(0, 0, 0, 0.6);
    opacity: 1;
}

.sighting-view-photo-prev {
    left: 12px;
}

.sighting-view-photo-next {
    right: 12px;
}

/* Hide arrows on very small screens - rely on swipe */
@media (max-width: 400px) {
    .sighting-view-photo-nav {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }
}

/* No photo placeholder */
.sighting-view-header.no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sighting-view-header.no-photo img {
    display: none;
}

.sighting-view-no-photo-placeholder {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--forest-500, #3d7a52);
}

.sighting-view-header.no-photo .sighting-view-no-photo-placeholder {
    display: flex;
}

.sighting-view-no-photo-placeholder svg {
    width: 64px;
    height: 64px;
    opacity: 0.25;
}

.sighting-view-no-photo-placeholder span {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    opacity: 0.5;
}

.sighting-view-add-photo-hint {
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--forest-600, #2d5a3d);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.sighting-view-add-photo-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* ============================================
   CONTENT AREA
   ============================================ */
.sighting-view-content {
    padding: 20px;
}

/* Species name section */
.sighting-view-species {
    margin-bottom: 20px;
}

.sighting-view-species h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.4rem;
    color: var(--forest-800, #1a3a2a);
    margin: 0 0 4px 0;
}

.sighting-view-species p {
    font-size: 0.9rem;
    color: var(--text-muted, #666);
    font-style: italic;
    margin: 0;
}

.sighting-view-afrikaans {
    font-size: 1rem !important;
    color: var(--bark-600, #7a5a45) !important;
    font-style: normal !important;
    font-weight: 500;
    margin-bottom: 2px !important;
}

/* Info card */
.sighting-view-info {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--forest-100, #e8f5ed);
}

.sighting-view-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--forest-50, #f4faf6);
}

.sighting-view-row:last-child {
    border-bottom: none;
}

.sighting-view-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sighting-view-label {
    font-size: 0.8rem;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sighting-view-value {
    font-size: 0.95rem;
    color: var(--text-primary, #1a1a1a);
    margin-top: 2px;
}

.sighting-view-value a {
    color: var(--sky-600, #3a7a8e);
    text-decoration: none;
}

.sighting-view-value a:hover {
    text-decoration: underline;
}

/* ============================================
   MAP
   ============================================ */
.sighting-view-map {
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    position: relative;
}

/* Lifer popup on map */
.sighting-view-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sighting-view-popup .leaflet-popup-content {
    margin: 10px 12px;
    font-size: 0.85rem;
}

.sighting-view-popup-lifer {
    background: linear-gradient(135deg, #daa520, #f4c430);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sighting-view-popup-date {
    font-weight: 600;
    color: var(--forest-700, #234d38);
}

.sighting-view-popup-type {
    color: var(--text-muted, #666);
    font-size: 0.8rem;
}

/* Notes section */
.sighting-view-notes {
    background: var(--forest-50, #f4faf6);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary, #555);
    line-height: 1.5;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */
.sighting-view-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.sighting-view-btn {
    flex: 1;
    padding: 14px 12px;
    border-radius: 12px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.sighting-view-btn:active {
    transform: scale(0.97);
}

.sighting-view-btn.primary {
    background: var(--forest-600, #2d5a3d);
    color: white;
}

.sighting-view-btn.primary:hover {
    background: var(--forest-500, #3d7a52);
}

.sighting-view-btn.secondary {
    background: var(--sand-200, #f5f0e8);
    color: var(--text-primary, #1a1a1a);
}

.sighting-view-btn.secondary:hover {
    background: var(--forest-100, #e8f5ed);
}

.sighting-view-btn.danger {
    background: #fee2e2;
    color: #b91c1c;
    flex: 0 0 auto;
    padding: 14px 16px;
}

.sighting-view-btn.danger:hover {
    background: #fecaca;
}

.sighting-view-btn.tertiary {
    background: transparent;
    color: var(--forest-600, #2d5a3d);
    border: 1px solid var(--forest-200, #c5e0d0);
    flex: 0 0 auto;
    padding: 14px 16px;
}

.sighting-view-btn.tertiary:hover {
    background: var(--forest-50, #f4faf6);
    border-color: var(--forest-300, #9fd1b3);
}

/* ============================================
   DELETE CONFIRMATION DIALOG
   ============================================ */
.sighting-view-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}

.sighting-view-confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.sighting-view-confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.sighting-view-confirm-title {
    margin: 0 0 12px;
    color: #1a1a1a;
    font-size: 20px;
    font-family: inherit;
}

.sighting-view-confirm-message {
    margin: 0 0 24px;
    color: #666;
    font-size: 15px;
    line-height: 1.5;
}

.sighting-view-confirm-buttons {
    display: flex;
    gap: 12px;
}

.sighting-view-confirm-btn {
    flex: 1;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.sighting-view-confirm-btn.cancel {
    border: 1px solid #ddd;
    background: white;
    color: #333;
}

.sighting-view-confirm-btn.cancel:hover {
    background: #f5f5f5;
}

.sighting-view-confirm-btn.confirm-delete {
    border: none;
    background: #dc2626;
    color: white;
}

.sighting-view-confirm-btn.confirm-delete:hover {
    background: #b91c1c;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.sighting-view-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10002;
    animation: sightingViewToastIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sighting-view-toast.success {
    background: var(--forest-600, #2d5a3d);
    color: white;
}

.sighting-view-toast.error {
    background: #dc2626;
    color: white;
}

.sighting-view-toast.info {
    background: var(--sky-600, #3a7a8e);
    color: white;
}

@keyframes sightingViewToastIn {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 400px) {
    .sighting-view-actions {
        flex-wrap: wrap;
    }
    
    .sighting-view-btn {
        min-width: calc(50% - 4px);
        font-size: 0.8rem;
        padding: 12px 10px;
    }
    
    .sighting-view-btn.danger,
    .sighting-view-btn.tertiary {
        flex: 1;
    }
}

/* ============================================
   UNIFIED MAP MARKERS STYLES
   ============================================ */

/* Reset default Leaflet divIcon background for all marker types */
.kagn-map-marker,
.kagn-map-marker-draggable,
.sighting-view-marker,
.sighting-detail-marker,
.species-sighting-marker,
.sighting-marker-draggable,
.custom-marker {
    background: transparent !important;
    border: none !important;
}

/* Draggable marker cursor states */
.kagn-map-marker-draggable,
.sighting-marker-draggable {
    cursor: grab !important;
}

.kagn-map-marker-draggable:active,
.sighting-marker-draggable:active {
    cursor: grabbing !important;
}

/* ============================================
   UNIFIED POPUP STYLES
   ============================================ */

/* Main popup container - unified styling */
.kagn-sighting-popup .leaflet-popup-content-wrapper,
.sighting-detail-popup .leaflet-popup-content-wrapper {
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
    padding: 0;
}

.kagn-sighting-popup .leaflet-popup-content,
.sighting-detail-popup .leaflet-popup-content {
    margin: 10px 14px;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    text-align: center;
    min-width: 140px;
}

.kagn-sighting-popup .leaflet-popup-tip,
.sighting-detail-popup .leaflet-popup-tip {
    background: white;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
}

/* Lifer badge in popup - unified */
.kagn-popup-lifer,
.sighting-popup-lifer {
    background: linear-gradient(135deg, #daa520 0%, #f4d03f 100%);
    color: #5a4000;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    margin-bottom: 6px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Species name in popup */
.kagn-popup-name {
    font-weight: 600;
    font-size: 15px;
    color: #1a3a2a;
    margin-bottom: 4px;
    line-height: 1.3;
}

/* Date in popup - unified */
.kagn-popup-date,
.sighting-popup-date {
    font-weight: 600;
    font-size: 13px;
    color: #1a3a2a;
    margin-bottom: 2px;
}

/* Type (Seen/Heard) and time in popup - unified */
.kagn-popup-type,
.sighting-popup-type {
    font-size: 12px;
    color: #666;
}

/* View Details button in popup */
.kagn-popup-view-details {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #2d5a3d 0%, #3d7a52 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.kagn-popup-view-details:hover {
    background: linear-gradient(135deg, #234d38 0%, #2d5a3d 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(45, 90, 61, 0.3);
}

.kagn-popup-view-details:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ============================================
   DRAG HINT STYLES
   ============================================ */

#logSightingDragHint,
#newSightingDragHint,
.kagn-drag-hint {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

#logSightingDragHint.show,
#newSightingDragHint.show,
.kagn-drag-hint.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   FULLSCREEN PHOTO OVERLAY
   ============================================ */
.sighting-view-photo-fullscreen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sighting-view-photo-fullscreen img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.sighting-view-photo-fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sighting-view-photo-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
