/* Desktop action bar styles */
.desktop-action-bar {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.qr-code-container {
    position: relative;
}

.qr-code-block {
    width: 60px;
    height: 60px;
    background-color: #e8491d;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.qr-code-block:hover {
    background-color: #ff5a2c;
    transform: scale(1.05);
}

.qr-code-popup {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 250px;
    height: 280px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    display: none;
    padding: 20px;
    z-index: 1001;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.qr-code-popup:before {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 25px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

.qr-code-popup h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    font-size: 16px;
}

.qr-code-popup img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border: 1px solid #eee;
    border-radius: 8px;
}

.qr-code-container:hover .qr-code-popup {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.up-button {
    width: 60px;
    height: 60px;
    background-color: #333;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 28px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.up-button:hover {
    background-color: #555;
    transform: scale(1.05);
}

/* Hide on mobile */
@media screen and (max-width: 768px) {
    .desktop-action-bar {
        display: none;
    }
}
/* Status indicator styles */
.status-indicator {
    display: inline-block;
    padding: 1px 5px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    border-radius: 3px;
    color: white;
}

.status-active {
    background-color: #4CAF50; /* Green for active */
}

.status-inactive {
    background-color: #333; /* Dark gray for inactive */
}

/* Header with search styles */
.header-with-search {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.header-with-search h1 {
    margin: 0;
    padding: 0;
}

/* Compact search styles */
.compact-search {
    flex-shrink: 0;
    display: none; /* Hide search bar in desktop view */
}

.compact-search-form {
    display: flex;
    align-items: center;
}

.compact-search-group {
    display: flex;
    align-items: center;
    position: relative;
    background-color: rgba(253, 155, 7, 0.2);
    border-radius: 20px;
    padding: 5px 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.compact-search-group input {
    border: none;
    background: transparent;
    padding: 5px;
    width: 150px;
    font-size: 14px;
    outline: none;
}

.compact-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #555;
    font-size: 14px;
}

.compact-clear-btn {
    display: inline-block;
    margin-left: 5px;
    color: #999;
    text-decoration: none;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

.compact-clear-btn:hover {
    color: #e8491d;
}

.search-icon {
    font-style: normal;
}

/* Filter section styles */
.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 4px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
}

.filter-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.filter-group select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
/* Region menu styles */
.region-menu {
    margin-bottom: 20px;
}

.region-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0; /* Remove spacing between items */
    padding: 0; /* Remove padding */
}

.region-link {
    padding: 8px 10px; /* Reduce padding inside each link */
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 18px; /* Increase font size by 1 font point */
}

.region-link:hover {
    background-color: #f0f0f0;
}

.region-link.active {
    background-color: #e8491d;
    color: white;
}

/* Service type menu styles */
.service-type-menu {
    margin-bottom: 20px;
    padding: 15px;
    text-align: left;
}

.service-type-form {
    display: block;
    width: 100%;
    max-width: 300px;
    margin-left: 15px;
}

.service-type-dropdown-container {
    position: relative;
    width: 100%;
}

.service-type-dropdown {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background-color: #fff;
    font-size: 16px;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.service-type-dropdown:focus {
    outline: none;
    border-color: #e8491d;
    box-shadow: 0 0 0 2px rgba(232, 73, 29, 0.2);
}

/* Add a custom dropdown arrow */
.service-type-dropdown-container::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #888;
    pointer-events: none;
}

/* Subcategory menu styles */
.subcategory-menu {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.subcategory-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 0 10px;
}

.subcategory-link {
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 15px;
    background-color: #f8f8f8;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 5px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-weight: 500;
    text-align: center;
    min-width: 80px;
}

.subcategory-link:hover {
    background-color: #e8491d;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    border-color: #e8491d;
}

.subcategory-link.active {
    background-color: #e8491d;
    color: white;
    border-color: #e8491d;
}

/* Homepage subcategory links specific styling */
.region-menu:not(:has(.region-link.active)) .subcategory-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
    padding: 15px;
}

.region-menu:not(:has(.region-link.active)) .subcategory-link {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    min-width: 100px;
    font-weight: normal;
}

@media screen and (max-width: 768px) {
    .region-menu:not(:has(.region-link.active)) .subcategory-links {
        gap: 8px;
        padding: 10px;
    }
    
    .region-menu:not(:has(.region-link.active)) .subcategory-link {
        min-width: 80px;
    }
}
/* Styles for index page */
.search-form {
    display: flex;
    flex-direction: column;
}

.search-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-gray {
    background-color: #777;
}

.auth-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.auth-text {
    margin-left: 5px;
}

.ad-card {
    display: flex;
    flex-direction: column;
    height: 318px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    background-color: #ffffff;
    padding-bottom: 0 !important;
}

.ad-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.ad-content-wrapper {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.ad-image {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 0;
    padding-bottom: 120%; /* 600:900 = 2:3 aspect ratio = 120% */
    overflow: hidden;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    margin: 0 auto;
}

.ad-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.location-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 12px;
}

.location-content {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.location-text {
    margin: 0;
    font-size: 13px;
    text-align: center;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.service-type {
    padding: 1px 5px;
    border-radius: 0px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 8px;
    display: inline-block;
    flex-shrink: 0; /* Prevent the badge from shrinking */
}
.service-type-club {
    background-color: rgb(45, 179, 156); /* Material Design Green */
    color: white;
}
.service-type-spa {
    background-color: #9C27B0; /* Material Design Red */
    color: white;
}
.service-type-massage {
    background-color:rgb(253, 155, 7); /* Material Design Orange */
    color: white;
}
.service-type-incall {
    background-color:rgb(242, 255, 59); /* Material Design Yellow */
    color: black; /* Black text for better contrast on yellow */
}
.service-type-jk {
    background-color: #2196F3; /* Material Design Blue */
    color: white;
}
.service-type-caucasian {
    background-color: #FFFFFF; /* White */
    color: black;
    border: 1px solid #999999; /* Darker border for better visibility */
}
.service-type-private {
    background-color: rgb(243, 45, 104); /* Material Design Purple */
    color: white;
}
.service-type-ktv {
    background-color:rgb(160, 5, 5); /* Material Design red */
    color: white;
}

.business-hours {
    width: 100%;
    background-color: #f8f8f8;
    padding: 5px 8px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.business-hours p {
    margin: 0;
    font-size: 14px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px;
    font-weight: normal;
    color: #888;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Changed back to 2 to allow two lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis; /* Added to ensure ellipsis is shown */
    line-height: 1.2;
    max-height: 2.4em; /* Changed back to 2.4em to allow two lines */
    height: auto;
}

/* Mobile location info - hidden by default */
.mobile-location-info {
    display: none;
}

/* Location icon for mobile view */
.location-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="%23ff0033" d="M192 0C85.97 0 0 85.97 0 192c0 77.41 26.97 99.03 172.3 309.7c9.531 13.77 29.91 13.77 39.44 0C357 291 384 269.4 384 192C384 85.97 298 0 192 0zM192 271.1c-44.13 0-80-35.88-80-80S147.9 111.1 192 111.1s80 35.88 80 80S236.1 271.1 192 271.1z"/></svg>');
    background-repeat: no-repeat;
    background-size: contain;
    margin-right: 5px;
    vertical-align: middle;
}

/* Ensure the location in parentheses is always visible in desktop */
.ad-title span {
    display: inline !important;
    white-space: nowrap !important;
}

.ad-description {
    margin-bottom: 15px;
    flex-grow: 1;
    text-align: center;
    display: none; /* Hide description in desktop view */
}

.pagination-card {
    text-align: center;
}

/* Grid layout */
.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, auto);
    grid-gap: 20px;
    margin: 0 auto;
    max-width: 1400px;
}

/* Style for ads outside working hours */
.faded {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.faded:hover {
    opacity: 0.8;
}

/* Make card position relative for absolute positioning */
.card {
    position: relative;
}

/* Mobile optimizations */
@media screen and (max-width: 1200px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    /* Show search bar in mobile view */
    .compact-search {
        display: block;
    }
    
    /* Hide ads and service type filter in mobile view */
    .grid, 
    .service-type-menu {
        display: none;
    }
    
    /* Make region menu display in a single line with horizontal scrolling */
    .region-links {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Hide scrollbar in Firefox */
        -ms-overflow-style: none; /* Hide scrollbar in IE/Edge */
        justify-content: flex-start; /* Start from left instead of center */
        padding: 0; /* Remove padding */
    }
    
    /* Hide scrollbar in Chrome/Safari */
    .region-links::-webkit-scrollbar {
        display: none;
    }
    
    .region-link {
        flex-shrink: 0; /* Prevent items from shrinking */
        white-space: nowrap; /* Prevent text wrapping */
    }
    
    .search-buttons {
        flex-direction: column;
    }
    
    .auth-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .auth-text {
        margin: 10px 0;
        text-align: center;
    }
    
    .grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 1px; /* Further reduced space between ad posts in mobile view */
    }
    
    /* Mobile ad card layout - horizontal instead of vertical */
    .ad-card {
        flex-direction: row;
        padding: 8px !important;
        height: auto;
    }
    
    .ad-content-wrapper {
        width: 45%;
        margin-right: 10px;
        position: relative;
    }
    
    .ad-image {
        max-width: 110%;
        padding-bottom: 120%; /* Slightly reduced height */
        margin: 0;
    }
    
    /* Right side content container */
    .ad-card-right-content {
        display: flex;
        flex-direction: column;
        width: 55%;
        position: relative;
    }
    
    /* Move title to the right side and align left */
    .ad-title {
        font-size: 18px;
        text-align: left;
        order: -1; /* Move to top */
        margin-bottom: 5px !important;
        padding: 0 0 5px 0 !important;
        border-bottom: 1px solid #eee;
        font-weight: bold; /* Make title bold in mobile view */
        color: #333; /* Make title dark in mobile view */
    }
    
    /* Hide location in title for mobile view */
    .location-in-title {
        display: none !important;
    }
    
    /* Mobile location info at bottom left corner */
    .mobile-location-info {
        display: block;
        margin-top: auto; /* Push to bottom */
        padding-top: 10px;
        /* Removed border-top to eliminate second division line */
        text-align: left;
    }
    
    .location-container {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        align-items: center;
        white-space: nowrap;           /* make sure text stays on one line */
        overflow: hidden;              /* hide any overflow */
        text-overflow: ellipsis;       /* add ... at the end */
        padding: 5px 0;
        width: 100%;
    }
    
    .location-label {
        font-weight: 500;
        color: #666;
        margin-right: 5px;
    }
    
    .state-name {
        color: #333;
        font-weight: 500;
        margin-right: 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .state-name:after {
        content: "";
        margin-left: 2px;
        margin-right: 2px;
        color: #333;
    }
    
.location-address {
    color: #888; /* Gray color for address */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-size: 15px; /* Added font size for mobile view */
}
    
    /* Add description styling */
    .ad-description {
        font-size: 15px;
        text-align: left;
        color: #666;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 6; /* Increased from 5 to 6 lines as requested */
        -webkit-box-orient: vertical;
        line-height: 1.3;
        margin: 0;
        max-height: 7.7em; /* Increased from 6.5em to 7.7em to accommodate 6 lines */
    }
    
    /* Hide location overlay in mobile view */
    .location-overlay {
        display: none;
    }
    
    /* Position business hours below the photo */
    .business-hours {
        position: relative;
        padding: 4px 4px;
        background-color: #f8f8f8;
        margin-top: 0px;
        border-radius: 4px;
    }
    
    .business-hours p {
        font-size: 13px;
    }
    
    /* Improve touch targets */
    .btn, .pagination li a {
        padding: 12px 16px;
        min-height: 44px; /* Minimum touch target size */
    }
}

@media screen and (max-width: 480px) {
    .grid {
        grid-template-columns: 1fr;
    }
}