/**
 * KTPA Route Map Styles
 *
 * Styles for Google Maps slide-up modal and view map buttons.
 *
 * @package KTPA
 * @since 1.0.0
 */

/* ========================================
   Route Map Slide-up Modal
   ======================================== */

.ktpa-map-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.ktpa-map-modal.active {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.3s ease;
}

/* Backdrop overlay */
.ktpa-map-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ktpa-map-modal.active .ktpa-map-modal-backdrop {
    opacity: 1;
}

/* Modal content panel */
.ktpa-map-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 70vh;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
}

.ktpa-map-modal.active .ktpa-map-modal-content {
    transform: translateY(0);
}

/* Dragging state - disable transition for smooth drag */
.ktpa-map-modal-content.dragging {
    transition: none;
}

/* Drag handle area */
.ktpa-map-modal-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    cursor: grab;
    touch-action: none;
    user-select: none;
    flex-shrink: 0;
}

.ktpa-map-modal-handle:active {
    cursor: grabbing;
}

/* Visual drag indicator */
.ktpa-map-drag-indicator {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
}

/* Close button - hidden by default, only show on mobile */
.ktpa-map-close-btn {
    display: none;
}

/* Map container fills remaining space */
.ktpa-map-modal #ktpa-route-map-container {
    flex: 1;
    width: 100%;
    min-height: 0;
}

/* ========================================
   View Map Button - Day Header
   ======================================== */

.ktpa-day-map-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #ffffff;
    color: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    white-space: nowrap;
}

.ktpa-day-map-btn:hover {
    background: #3b82f6;
    color: #ffffff;
}

.ktpa-day-map-btn:active {
    transform: scale(0.98);
}

.ktpa-day-map-btn .ktpa-map-icon {
    font-size: 16px;
    line-height: 1;
}

/* ========================================
   View Map Link - Activity Card
   ======================================== */

.ktpa-view-map-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 0;
    color: #3b82f6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    transition: color 0.2s ease;
    text-decoration: none;
}

.ktpa-view-map-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
    background: none !important;
    background-color: transparent !important;
}

.ktpa-view-map-link .ktpa-map-icon {
    font-size: 14px;
    line-height: 1;
}

/* Custom activity without coordinates - hidden until address is added */
.ktpa-view-map-link.no-location {
    display: none;
}

/* ========================================
   Missing Location Badge (inside modal)
   ======================================== */

.ktpa-missing-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(251, 191, 36, 0.95);
    color: #78350f;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ktpa-missing-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ktpa-badge-icon {
    font-size: 14px;
}

.ktpa-badge-text {
    white-space: nowrap;
}

.ktpa-badge-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    margin-left: 4px;
    font-size: 16px;
    font-weight: bold;
    color: #78350f;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ktpa-badge-close:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ========================================
   Info Window Styles - Horizontal Layout
   ======================================== */

.ktpa-map-info-window {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px;
    max-width: 300px;
    min-width: 200px;
}

.ktpa-info-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.ktpa-info-content {
    flex: 1;
    min-width: 0;
}

.ktpa-info-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px;
    line-height: 1.3;
}

.ktpa-info-address {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    margin: 0;
}

.ktpa-info-label {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    font-style: italic;
}

/* Hotel info window */
.ktpa-hotel-info .ktpa-info-image {
    width: 70px;
    height: 70px;
}

/* Google Maps info window overrides - cleaner look */
.gm-style-iw-d {
    overflow: hidden !important;
}

.gm-style-iw-chr {
    display: none !important;
}

.gm-style .gm-style-iw-c {
    padding: 12px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}

.gm-style .gm-style-iw-tc::after {
    background: #ffffff !important;
}

/* ========================================
   Map Loading State
   ======================================== */

.ktpa-map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    background: #f8fafc;
}

.ktpa-map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: ktpa-spin 0.8s linear infinite;
}

.ktpa-map-loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #64748b;
}

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

/* ========================================
   Map Not Configured State
   ======================================== */

.ktpa-map-not-configured {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    padding: 24px;
    text-align: center;
    background: #f8fafc;
    border-radius: 12px;
}

.ktpa-map-not-configured-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.ktpa-map-not-configured h3 {
    font-size: 18px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 8px;
}

.ktpa-map-not-configured p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    max-width: 300px;
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media (max-width: 767px) {
    /* Full width modal on mobile */
    .ktpa-map-modal-content {
        max-width: 100%;
        height: 80vh;
        border-radius: 16px 16px 0 0;
    }

    /* Larger touch target for drag handle */
    .ktpa-map-modal-handle {
        padding: 16px;
    }

    .ktpa-map-drag-indicator {
        width: 48px;
        height: 5px;
    }

    /* Day header button - smaller on mobile */
    .ktpa-day-map-btn {
        top: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 13px;
    }

    .ktpa-day-map-btn .ktpa-map-icon {
        font-size: 14px;
    }

    /* Activity card link */
    .ktpa-view-map-link {
        font-size: 12px;
    }

    /* Missing badge */
    .ktpa-missing-badge {
        top: 8px;
        left: 8px;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Info window - smaller image on mobile */
    .ktpa-map-info-window {
        max-width: 240px;
        min-width: 180px;
    }

    .ktpa-info-image {
        width: 50px;
        height: 50px;
    }

    .ktpa-info-title {
        font-size: 13px;
    }

    .ktpa-info-address {
        font-size: 11px;
    }
}

/* Extra small screens */
@media (max-width: 380px) {
    .ktpa-day-map-btn span:not(.ktpa-map-icon) {
        display: none;
    }

    .ktpa-day-map-btn {
        padding: 8px;
    }
}

/* ========================================
   Dark Mode Support (Future)
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Prepared for future dark mode support */
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .ktpa-map-modal {
        display: none !important;
    }

    .ktpa-day-map-btn {
        display: none !important;
    }

    .ktpa-view-map-link {
        display: none !important;
    }
}
