/**
 * Dealer Finder Plugin Styles
 * Version: 1.0.1
 */

/* Base Styles */
.dealer-finder-container {
    max-width: 100%;
    margin: 0 auto;
}

/* SVG Icon Base Styles */
.dealer-finder-container svg {
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
}

.dealer-finder-container svg path {
    fill: currentColor;
}

.dealer-finder-container svg path[stroke] {
    stroke: currentColor;
}

/* Search Form Styles */
.dealer-search-form {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.search-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.dealer-search-input {
    width: 100%;
    padding: 12px 15px 12px 50px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #f9f9f9;
}

.dealer-search-input:focus {
    outline: none;
    border-color: #007cba;
    background: white;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    width: 16px;
    height: 16px;
    z-index: 2;
}

.search-icon svg {
    width: 16px;
    height: 16px;
}

.filter-wrapper {
    position: relative;
    flex-shrink: 0;
}

.dealer-province-select {
    padding: 12px 40px 12px 45px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f9f9f9;
    font-size: 14px;
    min-width: 180px;
    cursor: pointer;
    transition: border-color 0.3s ease;
    appearance: none;
    width: 100%;
}

.dealer-province-select:focus {
    outline: none;
    border-color: #007cba;
    background: white;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.filter-wrapper::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="%23999999" d="M18 28h-4a2 2 0 0 1-2-2v-7.59L4.59 11A2 2 0 0 1 4 9.59V6a2 2 0 0 1 2-2h20a2 2 0 0 1 2 2v3.59a2 2 0 0 1-.59 1.41L20 18.41V26a2 2 0 0 1-2 2M6 6v3.59l8 8V26h4v-8.41l8-8V6Z"/></svg>') no-repeat center;
    pointer-events: none;
}

.filter-wrapper::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #999;
    pointer-events: none;
}


/* Results Info */
.dealer-results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
}

.results-count {
    font-weight: 500;
    color: #333;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.loading-indicator::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Grid Layout */
.dealer-grid {
    transition: all 0.3s ease;
}

.dealer-grid.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}


/* Grid Card Styles */
.dealer-card {
    transition: all 0.3s ease;
}

.dealer-card.grid-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.dealer-card.grid-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #d0d0d0;
}

.dealer-content {
    flex: 1;
    margin-bottom: 15px;
}

.dealer-name {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.3;
    padding-right: 80px;
}

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



.dealer-address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #4B5563;
    line-height: 1.4;
}

.dealer-address svg {
    width: 16px;
    height: 16px;
    color: #4B5563;
    margin-top: 2px;
    flex-shrink: 0;
}

.dealer-phone {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.dealer-phone svg {
    width: 16px;
    height: 16px;
    color: #4B5563;
    flex-shrink: 0;
}

.dealer-phone a {
    color: #4B5563;
    text-decoration: none;
}

.dealer-phone a:hover {
    color: var(--brand-700);
}

.dealer-province {
    position: absolute;
    top: 20px;
    right: 20px;
}

.province-label {
    background: var(--base-200);
    color: var(--base-900);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.dealer-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
}

.btn-whatsapp {
    background: #16A34A;
    color: white;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.btn-whatsapp:hover {
    background: #15803D;
    color: white;
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}


/* No Results */
.no-dealers-found {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-dealers-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-dealers-found h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.no-dealers-found p {
    margin: 0;
    font-size: 14px;
}

/* Pagination */
.dealer-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination-btn {
    background: white;
    border: 1px solid #ddd;
    color: #333;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: #f5f5f5;
    border-color: #999;
    color: black;
}

.pagination-btn.active {
    background: #28282b;
    color: white;
    border-color: #28282b;
}

.pagination-dots {
    padding: 8px 4px;
    color: #999;
}

/* Responsive Design */
@media (max-width: 768px) {
    
    .dealer-search-form {
        padding: 15px;
    }
    
    .dealer-grid.grid-view {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dealer-results-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 590px) {
    .filter-wrapper {
        width: 100%;
    }
}

@media (max-width: 540px) {
    .search-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .search-input-wrapper {
        min-width: 100%;
    }
    
    .dealer-province-select {
        width: 100%;
        min-width: 100%;
    }
    
    /* Fix dealer name collision with province label */
    .dealer-name {
        padding-right: 0;
        margin-bottom: 8px;
    }
    
    .dealer-province {
        position: static;
        margin-bottom: 12px;
        text-align: left;
    }
    
    .province-label {
        display: inline-block;
        margin-top: 4px;
    }
}

@media (max-width: 480px) {    
    .dealer-search-form {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .dealer-card.grid-card {
        padding: 15px;
    }
    
    .dealer-name {
        font-size: 16px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .pagination-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 36px;
    }
}

/* Animation Classes */
.dealer-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.dealer-slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* Accessibility */
.dealer-search-input:focus,
.dealer-province-select:focus,
.pagination-btn:focus,
.btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .dealer-search-form,
    .dealer-pagination {
        display: none;
    }
    
    .dealer-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dealer-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}