/* Theme override - force content_wrap to be full width when it contains our gigmap */
.content_wrap:has(.gigmap-widget),
.content_wrap .gigmap-widget {
    /* max-width: 100% !important; */
    width: 100% !important;
    margin-left: -5px;
    /* margin: 0 !important; */
    /* padding-left: 15px !important; */
    /* padding-right: 15px !important; */
}

/* Fallback for browsers that don't support :has() */
.gigmap-widget {
    position: relative;
}

.gigmap-widget::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -9999px;
    width: 100vw;
    height: 1px;
}

.gigmap-widget * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.gigmap-widget {
    font-family: 'Arial', sans-serif;
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
    /* border-radius: 10px; */
    /* padding: 20px; */
    max-width: 100%;
    overflow: hidden;
    /* border: 1px solid #e0e0e0; */
    /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
}

.gigmap-container {
    max-width: 1400px;
    margin: 0 auto;
}

.gigmap-header {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    padding: 20px;
    border-radius: 10px;
    color: white;
}

.gigmap-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.gigmap-header p {
    margin: 0;
}

/* Map section - full width at top */
.gigmap-map-section {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

/* Table section - full width below map */
.gigmap-table-section {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.gigmap-section-title {
    color: #0077b6;
    font-size: 1.5em;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

.gigmap-map {
    width: 100%;
    height: 500px; /* Desktop default */
    border-radius: 8px;
    border: 2px solid #0077b6;
    background-color: #f0f0f0;
}

.gigmap-filters-container {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.gigmap-filter-group {
    display: flex;
    flex-direction: column;
}

.gigmap-filter-label {
    color: #0077b6;
    font-size: 14px;
    margin-bottom: 5px;
    font-weight: bold;
}

.gigmap-search-input,
.gigmap-filter-select {
    padding: 10px;
    background-color: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    color: #333333;
    width: 100%;
    font-size: 14px;
}

.gigmap-search-input::placeholder {
    color: #6c757d;
}

.gigmap-search-input:focus,
.gigmap-filter-select:focus {
    outline: none;
    border-color: #0077b6;
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.1);
}

.gigmap-filter-select option {
    background-color: #ffffff;
    color: #333333;
}

.gigmap-table-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto; /* Allow horizontal scrolling on small screens */
    border-radius: 8px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.gigmap-table {
    width: 100%;
    min-width: 600px; /* Ensure table doesn't get too cramped */
    border-collapse: collapse;
    background-color: #ffffff;
}

.gigmap-table th {
    background-color: #0077b6;
    color: white;
    padding: 12px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    font-weight: bold;
}

.gigmap-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #dee2e6;
    color: #333333;
}

.gigmap-table tr:hover {
    background-color: #f8f9fa;
}

.gigmap-table tr:nth-child(even) {
    background-color: #fafafa;
}

.gigmap-table tr:nth-child(even):hover {
    background-color: #f0f0f0;
}

.gigmap-gig-link {
    color: #0077b6;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    display: block;
    padding: 4px 0;
    min-height: 32px; /* Better touch target */
    display: flex;
    align-items: center;
}

.gigmap-gig-link:hover {
    color: #005577;
    text-decoration: underline;
}

.gigmap-show-on-map-btn {
    background-color: #0077b6;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
    text-align: center;
    min-height: 36px; /* Ensure good touch target size */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gigmap-show-on-map-btn:hover,
.gigmap-show-on-map-btn:focus {
    background-color: #005577;
    outline: none;
}

.gigmap-no-map-btn {
    background-color: #6c757d;
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    text-align: center;
    cursor: not-allowed;
    font-style: italic;
    min-height: 36px; /* Ensure good touch target size */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gigmap-rate {
    color: #28a745;
    font-weight: bold;
}

.gigmap-duration {
    color: #fd7e14;
    font-weight: bold;
}

.gigmap-no-results {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    background-color: #ffffff;
}

/* Modal Styles */
.gigmap-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.gigmap-modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 2px solid #0077b6;
    color: #333333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gigmap-modal-close {
    color: #6c757d;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.gigmap-modal-close:hover {
    color: #0077b6;
}

.gigmap-modal-header {
    color: #0077b6;
    font-size: 1.8em;
    margin-bottom: 20px;
    padding-right: 40px;
    font-weight: bold;
}

.gigmap-modal-detail {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.gigmap-modal-label {
    font-weight: bold;
    color: #0077b6;
    min-width: 120px;
    margin-right: 15px;
}

.gigmap-modal-value {
    flex: 1;
    color: #333333;
}

/* Loading indicator */
.gigmap-loading {
    text-align: center;
    padding: 50px;
    color: #0077b6;
    font-size: 18px;
}

.gigmap-error {
    text-align: center;
    padding: 50px;
    color: #dc3545;
    font-size: 18px;
}

/* Responsive design improvements */
@media (max-width: 1200px) {
    .gigmap-container {
        padding: 0 10px;
    }

    .gigmap-header h1 {
        font-size: 2.2em;
    }

    .gigmap-map {
        height: 480px; /* Slightly smaller for large tablets */
    }
}

@media (max-width: 992px) {
    .gigmap-filters-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gigmap-table th,
    .gigmap-table td {
        padding: 10px 8px;
        font-size: 14px;
    }

    .gigmap-map {
        height: 420px; /* Good for tablets */
    }

    .gigmap-header h1 {
        font-size: 2em;
    }

    .gigmap-header p {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .gigmap-filters-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .gigmap-modal-content {
        width: 88%;
        margin: 2% auto;
        padding: 20px;
        max-height: 90vh;
        border-radius: 10px;
    }

    .gigmap-modal-detail {
        flex-direction: column;
        margin-bottom: 12px;
    }

    .gigmap-modal-label {
        min-width: auto;
        margin-bottom: 5px;
    }

    .gigmap-widget {
        padding: 10px;
    }

    .gigmap-header {
        padding: 15px;
        margin-bottom: 20px;
    }

    .gigmap-header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }

    .gigmap-header p {
        font-size: 13px;
    }

    .gigmap-section-title {
        font-size: 1.3em;
        margin-bottom: 12px;
    }

    .gigmap-table {
        font-size: 13px;
    }

    .gigmap-table th,
    .gigmap-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    /* Hide Duration and Date columns on very small screens but keep Action column */
    .gigmap-table th:nth-child(4),
    .gigmap-table td:nth-child(4),
    .gigmap-table th:nth-child(5),
    .gigmap-table td:nth-child(5) {
        display: none;
    }

    .gigmap-show-on-map-btn,
    .gigmap-no-map-btn {
        padding: 6px 8px;
        font-size: 11px;
    }

    .gigmap-map {
        height: 360px; /* Optimal for mobile landscape */
    }

    .gigmap-map-section,
    .gigmap-table-section {
        padding: 15px;
    }

    .gigmap-table-container {
        max-height: 350px;
    }
}

@media (max-width: 576px) {
    .gigmap-widget {
        padding: 8px;
        border-radius: 8px;
    }

    .gigmap-header {
        padding: 12px;
        margin-bottom: 15px;
    }

    .gigmap-header h1 {
        font-size: 1.6em;
        margin-bottom: 6px;
    }

    .gigmap-header p {
        font-size: 12px;
        line-height: 1.4;
    }

    .gigmap-map-section,
    .gigmap-table-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .gigmap-section-title {
        font-size: 1.2em;
        margin-bottom: 10px;
    }

    .gigmap-filters-container {
        padding: 12px;
        gap: 8px;
    }

    .gigmap-search-input,
    .gigmap-filter-select {
        padding: 8px;
        font-size: 13px;
    }

    .gigmap-filter-label {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .gigmap-map {
        height: 320px; /* Compact for small phones */
    }

    .gigmap-table {
        font-size: 12px;
    }

    .gigmap-table th,
    .gigmap-table td {
        padding: 6px 4px;
        font-size: 11px;
    }

    /* Hide Duration and Date columns on very small screens */
    .gigmap-table th:nth-child(4),
    .gigmap-table td:nth-child(4),
    .gigmap-table th:nth-child(5),
    .gigmap-table td:nth-child(5) {
        display: none;
    }

    .gigmap-table-container {
        max-height: 300px;
    }

    .gigmap-show-on-map-btn,
    .gigmap-no-map-btn {
        padding: 5px 6px;
        font-size: 10px;
    }

    .gigmap-modal-content {
        width: 88%;
        margin: 2% auto;
        padding: 15px;
        max-height: 95vh;
        border-radius: 8px;
    }

    .gigmap-modal-header {
        font-size: 1.4em;
        margin-bottom: 15px;
        padding-right: 30px; /* Space for close button */
    }

    .gigmap-modal-close {
        font-size: 24px;
        right: 15px;
        top: 12px;
    }
}

/* Performance optimization classes */
.gigmap-marker-cluster {
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    border: 2px solid #ffffff;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 119, 182, 0.3);
    cursor: pointer;
}

.gigmap-marker-cluster:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* Loading states */
.gigmap-loading-dots::after {
    content: '...';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}
