/* Mobile-first padding optimizations */
.directory {
    padding: 1rem 0;
}

.directory-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.directory-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: white;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin: 0;
}

.search-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    margin: 0 1rem 3rem 1rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.search-fields {
    display: grid;
    grid-template-columns: 3fr 2fr 1.5fr auto;
    gap: 1.5rem;
    align-items: center;
}

.search-input-group,
.location-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-group i,
.location-input-group i {
    position: absolute;
    left: 1rem;
    color: #666;
    z-index: 1;
}

.search-input,
.location-input,
.category-select {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3rem;
    border: 2px solid transparent;
    border-radius: 25px;
    background: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    min-width: 0;
}

.search-input:focus,
.location-input:focus,
.category-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.category-select {
    padding-left: 1rem;
    cursor: pointer;
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--primary-dark);
}

.filter-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.5rem;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.businesses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
    margin-bottom: 3rem;
}

.businesses-grid.list-view {
    grid-template-columns: 1fr;
}

.businesses-grid.list-view .business-card {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 1.5rem;
    align-items: start;
}

.business-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.business-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.business-image {
    height: 200px;
    background:#f1e3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.business-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8d9f5, #d4c5e8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #8b7ba8;
}

.image-placeholder i {
    opacity: 0.6;
}

.business-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.business-info h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.25rem;
    line-height: 1.3;
}

.business-category {
    color: var(--primary-color);
    font-weight: 500;
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
}

.business-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
}

.stars {
    display: flex;
    gap: 2px;
}

.stars i {
    color: #ddd;
    font-size: 0.9rem;
}

.stars i.active {
    color: #ffc107;
}

.rating-text {
    font-size: 0.9rem;
    color: #666;
}

.business-address {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 1rem 0;
    line-height: 1.4;
}

.business-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.pagination-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.no-businesses {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.no-businesses i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #ddd;
}

.no-businesses h3 {
    margin-bottom: 1rem;
    color: #333;
}

.no-businesses p {
    margin-bottom: 2rem;
    line-height: 1.6;
}



/* Directory Page Styles */
.directory-main {
    padding-top: 0;
    min-height: 100vh;
}

/* Search and Filter Section */
.search-filters {
    background: linear-gradient(135deg, #7F2F6C 0%, #7F2F6C 100%);
    color: white;
    padding: 2rem 0;
}

.search-header {
    text-align: center;
    margin-bottom: 2rem;
}

.search-header h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.search-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.search-form {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    margin-bottom: 1.5rem;
}

.search-row {
    display: grid;
    grid-template-columns: 3fr 2fr 1.5fr auto;
    gap: 1rem;
    align-items: center;
}

.search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.search-field i {
    position: absolute;
    left: 1.25rem;
    color: #666;
    z-index: 2;
}

.search-field input,
.search-field select {
    width: 100%;
    padding: 1rem 1.25rem 1rem 3rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    color: #333;
    min-width: 0;
    outline: none;
}

.search-field select {
    padding-left: 1rem;
    cursor: pointer;
}

.filter-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-options label {
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.sort-options select {
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    background: white;
    color: #333;
}

.view-options {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem;
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.search-filters .view-options .view-btn,
.filter-options .view-options .view-btn {
    background: none !important;
    border: none;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0.75rem;
    border-radius: 8px;
    min-width: 44px;
    min-height: 44px;
}

.view-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.search-filters .view-options .view-btn i,
.filter-options .view-options .view-btn i {
    color: inherit !important;
    font-size: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-filters .view-options .view-btn:hover,
.filter-options .view-options .view-btn:hover {
    color: white !important;
}

.view-btn:hover::before {
    opacity: 1;
}

.search-filters .view-options .view-btn.active,
.filter-options .view-options .view-btn.active {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--primary-color) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.view-btn.active::before {
    opacity: 0;
}

.search-filters .view-options .view-btn.active i,
.filter-options .view-options .view-btn.active i {
    color: var(--primary-color) !important;
}

.view-btn.active:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.search-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    font-size: 1rem;
}

.search-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.search-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

/* Results Section */
.directory-results {
    padding: 3rem 0;
    background:#f1e3ff;
}

.businesses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.business-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.business-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.business-image {
    height: 200px;
    position: relative;
    overflow: hidden;
    background: white;
}

.business-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    background: white;
}

.business-card:hover .business-image img {
    transform: scale(1.05);
}

.image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8d9f5, #d4c5e8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #8b7ba8;
}

.image-placeholder i {
    opacity: 0.6;
}

.featured-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: linear-gradient(135deg, #ffc107, #ff8f00);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.verified-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #28a745;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.business-info {
    padding: 1.5rem;
}

.business-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.business-name {
    margin: 0;
    font-size: 1.25rem;
}

.business-name a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.business-name a:hover {
    color: var(--primary-color);
}

.favorite-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
}

.favorite-btn:hover,
.favorite-btn.active {
    color: #e74c3c;
}

.favorite-btn i {
    transition: transform 0.3s ease;
}

/* Heart animation when clicked */
.favorite-btn.animating i {
    animation: heartBeat 0.6s ease-in-out;
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    20% {
        transform: scale(1.4) rotate(-10deg);
    }
    40% {
        transform: scale(1.6) rotate(10deg);
    }
    60% {
        transform: scale(1.4) rotate(-5deg);
    }
    80% {
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Floating hearts animation */
.floating-heart {
    position: fixed;
    font-size: 1.5rem;
    color: #ff6b9d;
    pointer-events: none;
    z-index: 10000;
    animation: floatUp 1.5s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-30px) scale(1.2) rotate(15deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.5) rotate(30deg);
    }
}

.business-category {
    color: var(--primary-color);
    font-weight: 600;
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.business-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stars {
    display: flex;
    gap: 0.125rem;
}

.stars i {
    color: #ddd;
    font-size: 0.875rem;
}

.stars i.active {
    color: #ffc107;
}

.rating-text {
    font-size: 0.875rem;
    color: #666;
}

.business-address {
    color: #666;
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.business-description {
    color: #555;
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
    font-size: 0.9rem;
}

.business-card .business-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.business-card .business-actions .btn-primary,
.business-card .business-actions .btn-outline {
    width: auto !important;
    margin-bottom: 0 !important;
    padding: 0.6rem 1rem !important;
    font-size: 0.875rem !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    justify-content: center !important;
    white-space: nowrap !important;
    min-width: 0 !important;
    text-align: center !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Two buttons - each takes half width */
.business-card .business-actions:has(> :nth-child(2):last-child) .btn-primary,
.business-card .business-actions:has(> :nth-child(2):last-child) .btn-outline {
    flex: 1;
    width: auto !important;
}

/* Three buttons - first two on top row, third on bottom */
.business-card .business-actions:has(> :nth-child(3)) {
    flex-direction: row;
    justify-content: space-between;
}

.business-card .business-actions:has(> :nth-child(3)) .btn-primary:nth-child(1),
.business-card .business-actions:has(> :nth-child(3)) .btn-outline:nth-child(1),
.business-card .business-actions:has(> :nth-child(3)) .btn-primary:nth-child(2),
.business-card .business-actions:has(> :nth-child(3)) .btn-outline:nth-child(2) {
    flex: 0 1 48%;
    max-width: 48%;
}

.business-card .business-actions:has(> :nth-child(3)) .btn-primary:nth-child(3),
.business-card .business-actions:has(> :nth-child(3)) .btn-outline:nth-child(3) {
    flex: 0 1 100%;
    width: 100% !important;
    margin-top: 0.5rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #ddd;
}

.no-results h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: #333;
}

.no-results p {
    margin: 0 0 2rem 0;
    font-size: 1.1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination-btn {
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* List View */
.businesses-grid.list-view {
    grid-template-columns: 1fr;
}

.businesses-grid.list-view .business-card {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 0;
}

.businesses-grid.list-view .business-image {
    height: auto;
    min-height: 150px;
}

/* Any other icons that might be blue */
i.fas, i.far, i.fab {
    color: inherit;
}

/* Specific overrides for any hardcoded colors */
[style*="color: blue"], [style*="color: #007bff"], [style*="color: #0066cc"], [style*="color: #764BA2"] {
    color: var(--primary-color) !important;
}

/* Responsive Design */
@media (max-width: 992px) {
    .search-filters {
        padding: 1.5rem 0;
    }

    .search-header h1 {
        font-size: 2.2rem;
    }

    .search-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .search-row .search-field:last-of-type {
        grid-column: 1 / -1;
    }

    .search-row button[type="submit"] {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .directory {
        padding: 0.5rem 0;
    }

    /* Stack search row fully on mobile */
    .search-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .search-row button[type="submit"] {
        width: 100%;
        justify-content: center;
        padding: 0.9rem;
        border-radius: 8px;
    }

    .search-field input,
    .search-field select {
        font-size: 16px;
        padding: 0.9rem 1rem 0.9rem 2.75rem;
    }

    .search-field select {
        padding-left: 1rem;
    }

    /* Stack filter bar vertically */
    .filter-options {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .sort-options {
        justify-content: space-between;
    }

    .sort-options select {
        flex: 1;
        font-size: 16px;
        padding: 0.6rem 0.75rem;
    }

    .view-options {
        justify-content: flex-end;
    }

    /* Single column card grid */
    .businesses-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }

    .business-image {
        height: 160px;
    }

    .image-placeholder {
        height: 160px;
        font-size: 2.5rem;
    }

    .business-info {
        padding: 1rem;
    }

    .business-info h3 {
        font-size: 1.1rem;
    }

    .business-category,
    .business-address {
        font-size: 0.85rem;
    }

    .directory-results {
        padding: 1.5rem 0;
    }

    /* List view resets to column on mobile */
    .businesses-grid.list-view {
        grid-template-columns: 1fr;
    }

    .businesses-grid.list-view .business-card {
        display: flex;
        flex-direction: column;
    }

    .businesses-grid.list-view .business-image {
        height: 160px;
    }
}

@media (max-width: 640px) {
    .search-header h1 {
        font-size: 1.8rem;
    }

    .container {
        padding: 0 0.75rem;
    }
}

@media (max-width: 480px) {
    .search-filters {
        padding: 1rem 0;
    }

    .search-header h1 {
        font-size: 1.6rem;
    }

    .search-form {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .container {
        padding: 0 0.5rem;
    }

    .search-field input,
    .search-field select {
        padding: 0.8rem 0.9rem 0.8rem 2.5rem;
    }

    .search-field select {
        padding-left: 0.9rem;
    }

    .business-image {
        height: 140px;
    }

    .image-placeholder {
        height: 140px;
        font-size: 2rem;
    }

    .business-info {
        padding: 0.875rem;
    }

    .business-info h3 {
        font-size: 1rem;
    }

    .business-category,
    .business-address {
        font-size: 0.8rem;
    }

    .business-actions {
        gap: 0.25rem;
    }

    .business-card .business-actions .btn-primary,
    .business-card .business-actions .btn-outline {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }
}

/* Fallback for browsers without :has() support */
@supports not (selector(:has(*))) {
    .business-card .business-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .business-card .business-actions .btn-primary,
    .business-card .business-actions .btn-outline {
        width: 100% !important;
    }
    
    .business-card .business-actions .btn-primary:nth-child(3),
    .business-card .business-actions .btn-outline:nth-child(3) {
        grid-column: 1 / -1;
        margin-top: 0.5rem;
    }
}

@media (max-width: 360px) {
    .search-header h1 {
        font-size: 1.4rem;
    }

    .search-form {
        padding: 0.5rem;
    }

    .container {
        padding: 0 0.25rem;
    }

    .business-card .business-actions .btn-primary,
    .business-card .business-actions .btn-outline {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}