/* Main Container Styles */
.gf-listings-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
    position: relative;
    overflow: visible;

    /* Ensure container respects WordPress content width */
    display: block;
    clear: both;
}

/* Tabulator table container */
.tabulator {
    max-width: 100%;
    overflow-x: auto;
}

/* Map container constraints */
#gf-listings-map {
    max-width: 100%;
    width: 100%;
    height: 400px;
    margin: 20px 0;
    box-sizing: border-box;
}

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

.gf-modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.gf-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.gf-modal-close:hover,
.gf-modal-close:focus {
    color: #333;
    text-decoration: none;
}

#gf-modal-title {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.gf-entry-field {
    margin-bottom: 15px;
}

.gf-field-label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.gf-field-value {
    padding: 5px 0;
}

.gf-complex-field {
    margin-left: 15px;
}

.gf-complex-field-item {
    margin-bottom: 5px;
}

.gf-complex-field-label {
    font-weight: 600;
}

/* Style entry links */
.gf-entry-details-link {
    cursor: pointer;
    color: #0073aa;
    text-decoration: underline;
}

.gf-entry-details-link:hover {
    color: #00a0d2;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}
.dataTables_wrapper .dt-buttons {
    display: inline-block;
    margin: 0 15px;
    vertical-align: middle;
}

.dataTables_wrapper .dt-buttons .dt-button {
    margin: 0 5px;
    padding: 6px 12px;
    font-size: 14px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dataTables_wrapper .dt-buttons .dt-button:hover {
    background-color: #e9e9e9;
}

/* Layout adjustments */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    white-space: nowrap;
}

.dataTables_wrapper .dataTables_length label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
    white-space: nowrap;
}

.dataTables_wrapper .dataTables_length select {
    margin: 0 5px;
    min-width: 60px;
    height: auto;
    padding: 4px 8px;
}

.dataTables_wrapper .dataTables_filter label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
}

.dataTables_wrapper .dataTables_filter input {
    margin-left: 5px;
    padding: 4px 8px;
}

.dataTables_wrapper {
    padding-top: 10px;
}

.dataTables_wrapper .top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* Responsive adjustments */
@media screen and (max-width: 767px) {
    .dataTables_wrapper .top {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dt-buttons,
    .dataTables_wrapper .dataTables_filter {
        margin: 5px 0;
        text-align: left;
        width: 100%;
    }
    
    .dataTables_wrapper .dataTables_filter {
        margin-top: 10px;
    }
}
#gf-listings-map {
    height: 400px !important;
    width: 100%;
    max-width: 100%;
    margin: 0 0 30px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f8f8;
    position: relative;
    z-index: 1;
    clear: both;
    display: block;
    min-height: 300px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    box-sizing: border-box;

    /* Prevent map from breaking out of WordPress content area */
    contain: layout style;
}

/* Table styling - Updated for Tabulator */
.gf-listings-table-wrapper {
	margin-top: 20px;
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	overflow-y: visible;
	padding: 0;
	box-sizing: border-box;

	/* Prevent table from breaking out of WordPress content width */
	contain: layout;
}

/* Tabulator Table Styling */
.tabulator {
	width: 100% !important;
	max-width: 100% !important;
	background-color: white !important;
	border: 1px solid #ddd !important;
	border-radius: 4px !important;
	font-family: inherit !important;
	font-size: 14px !important;
	box-sizing: border-box !important;

	/* Prevent table from breaking out of container */
	table-layout: fixed !important;
	word-wrap: break-word !important;
}

.tabulator .tabulator-header {
	background-color: #f8f9fa !important;
	border-bottom: 2px solid #dee2e6 !important;
}

.tabulator .tabulator-tableHolder {
	background-color: white !important;
}

/* Tabulator Controls Styling */
.tabulator-search-container {
	margin-bottom: 15px !important;
	padding: 0 !important;
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	flex-wrap: wrap !important;
	gap: 15px !important;
}

.tabulator-search-input {
	padding: 8px 12px !important;
	border: 1px solid #ddd !important;
	border-radius: 4px !important;
	font-size: 14px !important;
	min-width: 200px !important;
}

.tabulator-export-buttons {
	display: flex !important;
	gap: 8px !important;
}

.tabulator-export-btn {
	background-color: #f5f5f5 !important;
	color: #333 !important;
	border: 1px solid #ddd !important;
	padding: 8px 16px !important;
	border-radius: 4px !important;
	cursor: pointer !important;
	font-size: 14px !important;
	transition: background-color 0.2s !important;
}

.tabulator-export-btn:hover {
	background-color: #e9e9e9 !important;
}
/* DataTables specific styling */
table.dataTable {
    width: 100% !important;
    margin-bottom: 1em !important;
    clear: both;
}

.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter, 
.dataTables_wrapper .dataTables_info, 
.dataTables_wrapper .dataTables_processing, 
.dataTables_wrapper .dataTables_paginate {
    color: #333 !important;
}

.dataTables_wrapper .dataTables_length select {
    padding: 4px !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 5px !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    margin-left: 5px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.3em 0.8em !important;
    border: 1px solid #ddd !important;
    margin: 0 2px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #f0f0f0 !important;
    border: 1px solid #ccc !important;
}
/* When map is disabled, give the table more prominence */
.gf-listings-container:not(:has(#gf-listings-map)) .gf-listings-table-wrapper {
    margin-top: 0;
}

/* Entry details link styling */
.gf-entry-details-link {
    color: #0073aa;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.gf-entry-details-link:hover {
    color: #00a0d2;
    text-decoration: underline;
}

/* Directions link styling */
.gf-directions-link {
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    background-color: #D2252A;
    border-radius: 4px;
    border: 0 solid #ddd;
    transition: all 0.2s ease;
}

.gf-directions-link:hover {
    color: #fff;
    background-color: #d2252bd5;
    border-color: #bbb;
    text-decoration: none;
}

.gf-directions-link img {
    margin-right: 5px;
}

.gf-directions-link svg {
	fill: #fff !important;
}

/* Modal styling */
.gf-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh; /* Full viewport height */
    overflow: hidden; /* Prevent scrolling of background */
    background-color: rgba(0,0,0,0.7);
}

/* Apply this to body when modal is open */
body.modal-open {
    overflow: hidden; /* Prevent page scrolling when modal is open */
    position: fixed;
    width: 100%;
}

.gf-modal-content {
    background-color: #fefefe;
    margin: 0 auto;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: absolute;  /* Changed to absolute for custom positioning */
    top: 100px;  /* Default positioning */
    left: 50%;
    transform: translateX(-50%);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

.gf-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    margin-top: -5px;
}

.gf-modal-close:hover,
.gf-modal-close:focus {
    color: black;
    text-decoration: none;
}

#gf-modal-title {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    color: #333;
}

#gf-modal-content {
    margin-top: 15px;
}

.gf-entry-field {
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.gf-entry-field:last-child {
    border-bottom: none;
}

.gf-field-label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #444;
}

.gf-field-value {
    color: #666;
}

.gf-complex-field {
    margin-left: 15px;
    margin-top: 5px;
}

.gf-complex-field-item {
    margin-bottom: 5px;
}

.gf-complex-field-label {
    font-weight: 500;
    color: #555;
    display: inline-block;
    min-width: 120px;
}

/* Custom map controls */
.leaflet-control-reset-view a,
.leaflet-control-bigimage a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    line-height: 30px;
    background: white;
    color: #333;
    text-decoration: none;
}

.leaflet-control-reset-view a:hover,
.leaflet-control-bigimage a:hover {
    background: #f4f4f4;
}

/* BigImage control styles */
.leaflet-control-bigimage {
    clear: none !important; /* Allow positioning next to other controls */
}

.leaflet-control-bigimage a {
    font-size: 16px;
    font-weight: bold;
}

.bigimage-screen {
    background-color: #fff;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.leaflet-popup-content {
	text-transform: capitalize;
}
/* DataTables Buttons styling */
.dt-buttons {
    display: inline-block !important;
    margin: 0 15px !important;
    vertical-align: middle !important;
}

.dataTables_wrapper .dt-buttons {
    display: inline-block !important;
    margin: 0 15px !important;
    vertical-align: middle !important;
}

/* Style for the actual buttons */
.dt-button,
button.dt-button,
div.dt-button,
a.dt-button {
    padding: 6px 12px !important;
    margin: 0 5px !important;
    background-color: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    color: #333 !important;
    cursor: pointer !important;
    font-size: 14px !important;
    text-decoration: none !important;
    transition: background-color 0.2s !important;
}

.dt-button:hover,
button.dt-button:hover,
div.dt-button:hover,
a.dt-button:hover {
    background-color: #e9e9e9 !important;
    border-color: #ccc !important;
}

/* Remove complex positioning overrides */
.dt-buttons:after {
    content: "";
    display: table;
    clear: both;
}
/* Responsive adjustments */
@media (max-width: 768px) {
    #gf-listings-map {
        height: 300px !important;
    }
    
    .gf-modal-content {
        width: 95%;
        margin: 10% auto;
    }    
    .dt-buttons {
        text-align: center !important;
        float: none !important;
        margin-bottom: 10px !important;
    }
    
    .dataTables_filter {
        text-align: center !important;
        float: none !important;
        margin-bottom: 10px !important;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    #gf-listings-map {
        height: 350px !important;
    }
}

@media (min-width: 1201px) {
    #gf-listings-map {
        height: 450px !important;
    }
}

/* Clean responsive layout */
.gf-listings-table-wrapper .top {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.gf-listings-table-wrapper .top .dt-buttons {
    margin: 0;
    padding: 0;
}

@media (max-width: 768px) {
    .gf-listings-table-wrapper .top {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .dataTables_length,
    .dataTables_filter {
        width: 100%;
        justify-content: center;
    }
}