/* General Styling */
#carat-buttons button,
#filters button {
    border: 1px solid #38BDA6;
    background: none;
    color: #333;
    padding: 10px 15px;
    margin: 5px;
    cursor: pointer;
    width: 100%; /* Ensure buttons take full width in mobile view */
    max-width: 120px; /* Increased max-width to accommodate text */
    white-space: nowrap; /* Prevent text wrapping */
    text-align: center; /* Center the text inside the button */
    font-size: 14px; /* Adjust font size */
}

#carat-buttons button.active {
    background-color: #38BDA6;
    color: white;
    border-color: #38BDA6;
}

.diamond-filter-section button,
#filters button {
    border: 1px solid #38BDA6;
    background: none;
    color: #333;
    padding: 5px 10px;
    margin: 2px;
    cursor: pointer;
}

.diamond-filter-section button.active,
#filters button.active {
    background-color: #38BDA6;
    color: white;
}

#search-diamonds {
    display: block;
    margin: 20px auto;
    font-size: 20px;
    padding: 10px 20px;
}

.diamond-filter-section {
    margin-bottom: 20px;
}

.diamond-filter-section label {
    display: block;
    margin-bottom: 5px;
    color: #38BDA6;
    font-weight: bold;
}

.diamond-filter-section .diamond-shape-filter {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.diamond-filter-section .diamond-shape-filter button {
    border: 2px solid transparent;
    background: none;
    padding: 0;
    margin: 5px;
    cursor: pointer;
}

.diamond-filter-section .diamond-shape-filter button img {
    display: block;
    margin: 0 auto;
    max-width: 80px;
    max-height: 80px;
}

.diamond-filter-section .diamond-shape-filter button.active {
    border-color: #38BDA6; /* Highlight border on active button */
}

.diamond-filter-section .carat-inputs input {
    width: 100px; /* Increase width */
    height: 40px; /* Increase height */
    margin-left: 2px;
    margin-right: 12px;
    margin-bottom: 20px; /* Add space below the input text boxes */
    padding: 10px; /* Add more padding for larger input */
    display: inline-block;
    border: 2px solid #38BDA6; /* Bolder border */
    border-radius: 4px; /* Optional: Add some border radius */
    font-size: 16px; /* Increase font size */
}

.diamond-filter-section .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

#filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-column {
    width: calc(50% - 10px);
}

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: left; /* Align buttons to the left */
    flex-wrap: nowrap; /* Prevent wrapping to the next line */
    gap: 2px; /* Space between the buttons */
}

.pagination .page-btn {
    border: 1px solid #38BDA6; /* Border styling */
    background: none; /* Transparent background */
    color: #333; /* Text color */
    padding: 5px 10px; /* Adjust padding */
    cursor: pointer;
    min-width: 50px; /* Ensures buttons have a minimum width */
    text-align: center; /* Center align text inside the buttons */
    line-height: 1.5; /* Adjust line height for better vertical alignment */
}

.pagination .page-btn:hover {
    background-color: #38BDA6; /* Highlight background on hover */
    color: white; /* Change text color on hover */
}

.pagination .page-btn.active {
    background-color: #38BDA6; /* Active state background */
    color: white; /* Text color for active state */
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Ensures wrapping on smaller screens */
}

.results-header .results-count {
    color: #333;
    font-size: 14px;
    flex-basis: 100%; /* Ensure it takes full width on small screens */
    margin-bottom: 10px; /* Adds space below in mobile view */
}

.results-header .results-sort {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-basis: 100%; /* Make sure it also wraps to a new line on smaller screens */
}

.results-header .results-sort label {
    margin-right: 10px;
}

.results-header .results-sort select {
    border: 1px solid #38BDA6; /* Ensures a visible border */
    background-color: white; /* Keeps the dropdown visible */
    color: #333;
    padding: 8px 12px; /* Add padding for spacing inside the dropdown */
    font-size: 16px;
    width: auto; /* Allows the dropdown to resize based on content */
    border-radius: 4px; /* Gives it a rounded dropdown look */
    margin-right: 10px; /* Adds space between the dropdown and screen */
}

/* Loading Styling */
.loading {
    background: url('/htdocs/wp-content/plugins/diamond-filter/images/loader.gif') no-repeat center center;
    height: 25px;
    background-size: contain;
}

.results-sort label {
    font-size: 18px;
    margin-right: 10px;
}

.results-sort select {
    font-size: 16px;
    padding: 8px;
    width: 200px;
    height: auto;
}

@media screen and (min-width: 768px) {
    .results-header .results-count {
        flex-basis: auto; /* On larger screens, show inline */
        margin-bottom: 0;
    }

    .results-header .results-sort {
        flex-basis: auto; /* Keep "Sort By" inline on larger screens */
    }
}

#diamond-results.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 25px;
    height: 25px;
    background: url('/htdocs/wp-content/plugins/diamond-filter/images/loader.gif') no-repeat center center;
    background-size: contain;
    z-index: 9999;
}

#diamond-results.loading {
    position: relative;
    min-height: 25px;
}

#diamond-results.loading > * {
    filter: blur(2px);
    opacity: 0.5;
}

/* Table Styling */
table th, table td {
    padding: 10px;
    text-align: left;
}

table td:nth-child(2),
table td:nth-child(2) { /* Lab & Certificate column */
    width: 180px;
}

table th:nth-child(10),
table td:nth-child(10) {
    width: 200px;
    white-space: nowrap;
}

table th:nth-child(11),
table td:nth-child(11) {
    width: 180px;
    white-space: nowrap;
}


#sort-by {
    font-size: 16px;
    padding: 8px;
    width: 200px;
    height: auto;
}

/* Cart Button Styling */
.add-to-cart {
    display: inline-flex; /* Ensure icon and text are in the same line */
    align-items: center;  /* Vertically center icon and text */
    justify-content: center; /* Center content horizontally */
    padding: 10px; /* Adjust padding */
    font-size: 16px; /* Set font size for text */
    color: #38BDA6; /* Text and icon color */
    border: 2px solid #38BDA6; /* Border color */
    background-color: transparent; /* Transparent background */
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.add-to-cart i {
    margin-right: 8px; /* Add some space between the icon and the text */
    font-size: 20px; /* Adjust icon size */
}

.add-to-cart:hover {
    background-color: #38BDA6; /* Hover effect */
    color: #fff; /* Text and icon color on hover */
}

.add-to-cart.added {
    background-color: #38BDA6; /* Style for button when added to cart */
    color: #fff;
}

/* Responsive Styling */
@media screen and (max-width: 768px) {
    .diamond-filter-section {
        display: block;
        margin-bottom: 10px;
    }

    .filter-column {
        width: 100%;
        margin-bottom: 10px;
    }

    .diamond-shape-filter {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }

    .diamond-shape-filter button img {
        max-width: 60px;
        max-height: 60px;
    }

    #carat-buttons button {
        font-size: 14px;
        padding: 8px 12px;
    }

    .pagination {
        overflow-x: auto; /* Allow horizontal scrolling if needed */
        justify-content: flex-start;
        white-space: nowrap;
        padding: 5px;
    }

    .pagination .page-btn {
        padding: 5px 10px;
        font-size: 12px;
        min-width: 35px;
    }

    .results-header {
        display: block;
        text-align: center;
    }

    .results-header .results-sort {
        margin-top: 10px;
    }

    /* Scrollable table for small devices */
    .table-responsive {
        overflow-x: auto;
        display: block;
        width: 100%;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    table th, table td {
        white-space: nowrap;
    }

    /* Ensure cart icon stays touch-friendly on small devices */
    .add-to-cart {
        font-size: 20px;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    .filter-column {
        width: 48%;
    }

    .diamond-shape-filter button img {
        max-width: 70px;
        max-height: 70px;
    }
}
