/**
 * MMG Agent Directory Styles
 * WPEngine Optimized
 */

/* Main Container */
#mmg-agent-directory {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Filters Section */
.mmg-filters {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .mmg-filters {
        grid-template-columns: 1fr;
    }
}

.mmg-filter-group {
    display: flex;
    flex-direction: column;
}

.mmg-filter-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

.mmg-filter-input,
.mmg-filter-select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.mmg-filter-input:focus,
.mmg-filter-select:focus {
    outline: none;
    border-color: var(--agent-primary-color);
    box-shadow: 0 0 0 3px var(--agent-shadow-light);
}

/* Main Layout */
.mmg-directory-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    height: calc(100vh - 250px);
    min-height: 600px;
}

@media (max-width: 1024px) {
    .mmg-directory-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Agent List */
.mmg-agent-list-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#mmg-agent-list {
    flex: 1;
    max-height: 550px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    padding: 1rem;
}

/* Custom Scrollbar */
#mmg-agent-list::-webkit-scrollbar {
    width: 8px;
}

#mmg-agent-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#mmg-agent-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#mmg-agent-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Agent Item */
.mmg-agent-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mmg-agent-item:hover {
    border-color: var(--agent-primary-color);
    box-shadow: 0 4px 12px var(--agent-shadow-medium);
    transform: translateY(-2px);
}

.mmg-agent-item.active {
    border-color: var(--agent-primary-color);
    background: var(--agent-light-bg);
    box-shadow: 0 4px 16px var(--agent-shadow-strong);
}

.mmg-agent-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.mmg-agent-content p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mmg-agent-content .dashicons {
    color: var(--agent-primary-color);
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.mmg-agent-content a {
    color: var(--agent-primary-color);
    text-decoration: none;
}

.mmg-agent-content a:hover {
    text-decoration: underline;
}

.mmg-agent-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.mmg-btn-view-map {
    background: var(--agent-primary-color);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.mmg-btn-view-map:hover {
    background: var(--agent-primary-hover);
}

.mmg-btn-view-map .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Map Container */
.mmg-map-container {
    position: relative;
    height: 100%;
}

#mmg-agent-map {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    min-height: 600px;
}

@media (max-width: 1024px) {
    #mmg-agent-map {
        min-height: 400px;
    }
}

#mmg-agent-map.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Map Info Window */
/* Override Google Maps InfoWindow container styles */
.gm-style-iw.gm-style-iw-c {
    min-width: 400px !important;
}

.mmg-map-info {
    padding: 0.5rem;
    max-width: 350px;
}

.mmg-map-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #2c3e50;
}

.mmg-map-info p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: #555;
}

.mmg-map-info a {
    color: var(--agent-primary-color);
    text-decoration: none;
    font-weight: 600;
}

.mmg-map-info .mmg-action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e0e0e0;
}

.mmg-map-info .mmg-directions-btn,
.mmg-map-info .mmg-share-btn {
    display: inline-block;
    background: var(--agent-primary-color);
    color: #fff !important;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.2s;
    text-align: center;
    flex: 1;
}

.mmg-map-info .mmg-directions-btn:hover,
.mmg-map-info .mmg-share-btn:hover {
    background: var(--agent-primary-hover);
}

.mmg-map-info .mmg-share-btn {
    background: #28a745;
}

.mmg-map-info .mmg-share-btn:hover {
    background: #218838;
}

.mmg-map-info .mmg-hours {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e0e0e0;
}

.mmg-map-info .mmg-hours p {
    margin-bottom: 0.25rem;
}

.mmg-map-info .mmg-hours ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mmg-map-info .mmg-hours li {
    font-size: 0.8rem;
    color: #666;
    padding: 0.15rem 0;
    line-height: 1.4;
}

.mmg-map-info .mmg-hours li strong {
    display: inline-block;
    min-width: 40px;
    color: #333;
}

/* Loading State */
.mmg-loading {
    padding: 3rem;
    text-align: center;
    font-size: 1.1rem;
    color: #666;
}

.mmg-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--agent-primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    margin-left: 10px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.mmg-error {
    padding: 2rem;
    text-align: center;
    color: #d32f2f;
    background: #ffebee;
    border-radius: 4px;
    margin: 1rem 0;
}

.mmg-no-results {
    padding: 3rem;
    text-align: center;
    color: #666;
    font-size: 1.1rem;
}

/* Pagination */
#mmg-pagination {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.mmg-pagination-info {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.mmg-pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mmg-page-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    min-width: 40px;
}

.mmg-page-btn:hover {
    border-color: var(--agent-primary-color);
    background: var(--agent-light-bg);
    color: var(--agent-primary-color);
}

.mmg-page-btn.active {
    background: var(--agent-primary-color);
    color: #fff;
    border-color: var(--agent-primary-color);
    font-weight: 600;
}

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

.mmg-page-ellipsis {
    padding: 0.5rem;
    color: #666;
}

.mmg-page-prev,
.mmg-page-next {
    font-weight: 600;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #mmg-agent-directory {
        padding: 1rem;
    }
    
    .mmg-agent-item {
        padding: 1rem;
    }
    
    .mmg-pagination-buttons {
        font-size: 0.85rem;
    }
    
    .mmg-page-btn {
        padding: 0.4rem 0.6rem;
        min-width: 35px;
    }
}

