/**
 * CREHQ Locations Integration - Frontend Styles
 * Modern, responsive design for company locations display
 */

/* Main Wrapper */
.crehq-company-locations-section {
    margin: 40px 0;
    padding: 30px 0;
    border-top: 2px solid #e5e7eb;
}

.crehq-company-locations-section h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 25px;
    color: #1f2937;
}

/* Locations Wrapper */
.crehq-locations-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Map Container */
.crehq-locations-map,
.crehq-locations-map-only {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background: #f3f4f6;
}

.crehq-locations-map-only {
    margin-bottom: 20px;
}

/* Locations Count */
.locations-count {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: #f9fafb;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
}

/* State Groups */
.state-group {
    margin-bottom: 40px;
}

.state-name {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Locations Grid */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

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

/* Location Card */
.location-card {
    position: relative;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.location-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #3b82f6;
}

/* Headquarters Badge */
.location-card.headquarters {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.hq-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Location Details */
.location-name {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 12px 0;
    padding-right: 50px; /* Space for HQ badge */
    line-height: 1.3;
}

.location-address {
    margin-bottom: 12px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

.location-address div {
    margin-bottom: 3px;
}

.location-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    color: #374151;
    font-size: 14px;
}

.location-phone .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #3b82f6;
}

.location-phone a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s ease;
}

.location-phone a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* Location Actions */
.location-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f3f4f6;
}

.directions-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 6px;
    background: #eff6ff;
}

.directions-link:hover {
    background: #dbeafe;
    color: #2563eb;
    transform: translateX(2px);
}

.directions-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Leaflet Map Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 5px;
}

.leaflet-popup-content {
    margin: 12px 14px;
    line-height: 1.5;
}

.leaflet-popup-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #111827;
}

.leaflet-popup-content .popup-address {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 8px;
}

.leaflet-popup-content .popup-hq {
    display: inline-block;
    background: #f59e0b;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    margin-bottom: 8px;
}

/* Loading State */
.crehq-locations-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: #6b7280;
}

.crehq-locations-loading:before {
    content: "";
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

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

/* Empty State */
.crehq-locations-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px dashed #e5e7eb;
}

.crehq-locations-empty .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    opacity: 0.3;
    margin-bottom: 15px;
}

.crehq-locations-empty p {
    font-size: 16px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 640px) {
    .crehq-company-locations-section {
        margin: 30px 0;
        padding: 20px 0;
    }
    
    .crehq-company-locations-section h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .crehq-locations-map {
        height: 350px;
    }
    
    .state-name {
        font-size: 20px;
    }
    
    .location-card {
        padding: 16px;
    }
    
    .location-name {
        font-size: 16px;
    }
}

/* Print Styles */
@media print {
    .crehq-locations-map {
        display: none;
    }
    
    .location-card {
        break-inside: avoid;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .directions-link {
        display: none;
    }
}

/* Accessibility */
.location-card:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.directions-link:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .crehq-company-locations-section {
        border-top-color: #374151;
    }
    
    .location-card {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .location-card.headquarters {
        background: linear-gradient(135deg, #78350f 0%, #1f2937 100%);
    }
    
    .location-name {
        color: #f9fafb;
    }
    
    .location-address,
    .locations-count {
        color: #d1d5db;
    }
    
    .state-name {
        color: #f9fafb;
        border-bottom-color: #374151;
    }
}
