/**
 * Frontend CSS for Carte des Éleveurs.
 * Features a modern, elegant, and horse-themed palette (warm saddle browns, golds, and slate grays).
 */

/* Map Container */
.eleveurs-map-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    background-color: #f7fafc;
}

/* Map Loader */
.eleveurs-map-loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background-color: #f7fafc;
    gap: 16px;
}

.eleveurs-map-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 90, 43, 0.1);
    border-radius: 50%;
    border-top-color: #8b5a2b; /* Saddle brown theme color */
    animation: eleveurs-spin 1s ease-in-out infinite;
}

.eleveurs-map-loader-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #718096;
    font-weight: 500;
    margin: 0;
}

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

/* Custom Marker Pins */
.eleveurs-marker-icon-wrapper {
    background: none !important;
    border: none !important;
}

.eleveurs-marker-pin {
    width: 36px;
    height: 46px;
    cursor: pointer;
}

.eleveurs-marker-pin svg {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom center;
}

.eleveurs-marker-pin:hover svg {
    transform: scale(1.18) translateY(-2px);
}

/* Pin Parts Color Palette */
.eleveurs-marker-pin .pin-bg {
    fill: #8b5a2b; /* Primary Theme (Saddle Brown) */
    transition: fill 0.2s;
}

.eleveurs-marker-pin:hover .pin-bg {
    fill: #704822; /* Darker brown on hover */
}

.eleveurs-marker-pin .pin-circle {
    fill: #ffffff;
}

.eleveurs-marker-pin .pin-horseshoe {
    stroke: #d4af37; /* Gold Horseshoe */
    stroke-width: 2.2;
}

.eleveurs-marker-pin .pin-dot {
    fill: #8b5a2b;
}

/* Leaflet Popup Styling Overrides */
.eleveurs-map-container .leaflet-popup-content-wrapper {
    border-radius: 16px;
    padding: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
}

.eleveurs-map-container .leaflet-popup-content {
    margin: 10px 12px 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #2d3748;
    font-size: 14px;
    line-height: 1.5;
}

.eleveurs-map-container .leaflet-popup-tip {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Popup Custom Card Layout */
.eleveurs-popup-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 290px;
}

/* Card Header */
.eleveurs-popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 10px;
}

.eleveurs-popup-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1.5px solid #edf2f7;
    background-color: #f7fafc;
    flex-shrink: 0;
}

.eleveurs-popup-header-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* Ensures text truncation works on children if needed */
}

.eleveurs-popup-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.25;
}

.eleveurs-popup-title a {
    color: #1a202c;
    text-decoration: none;
    transition: color 0.15s ease;
}

.eleveurs-popup-title a:hover {
    color: #8b5a2b;
}

.eleveurs-popup-address {
    font-size: 12px;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.eleveurs-popup-address svg {
    flex-shrink: 0;
    color: #a0aec0;
}

.eleveurs-popup-address span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Body */
.eleveurs-popup-body {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.45;
}

.eleveurs-popup-desc {
    margin: 0;
}

.eleveurs-popup-info {
    max-height: 80px;
    overflow-y: auto;
    font-size: 12.5px;
}

/* Custom Scrollbar for info */
.eleveurs-popup-info::-webkit-scrollbar {
    width: 4px;
}
.eleveurs-popup-info::-webkit-scrollbar-track {
    background: #f7fafc;
}
.eleveurs-popup-info::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

/* Card Horses Section */
.eleveurs-popup-horses-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.eleveurs-popup-horses-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a0aec0;
    margin: 0;
    font-weight: 700;
}

.eleveurs-popup-horses-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background-color: #f7fafc;
    border-radius: 8px;
    padding: 6px;
}

.eleveurs-popup-horse-item {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.eleveurs-popup-horse-item:hover {
    background-color: #edf2f7;
    transform: translateX(2px);
}

.eleveurs-popup-horse-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #e2e8f0;
    border: 1px solid #edf2f7;
    flex-shrink: 0;
}

.eleveurs-popup-horse-thumb-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.eleveurs-popup-horse-name {
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
}

.eleveurs-popup-horse-item:hover .eleveurs-popup-horse-name {
    color: #1a202c;
}

/* Card Footer */
.eleveurs-popup-footer {
    display: flex;
    justify-content: stretch;
    margin-top: 4px;
}

.eleveurs-popup-button {
    flex-grow: 1;
    text-align: center;
    background: #8b5a2b;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none !important;
    box-shadow: 0 4px 6px rgba(139, 90, 43, 0.15);
    transition: background-color 0.15s ease, transform 0.1s, box-shadow 0.15s ease;
}

.eleveurs-popup-button:hover {
    background: #704822;
    box-shadow: 0 6px 12px rgba(139, 90, 43, 0.25);
    transform: translateY(-1px);
}

.eleveurs-popup-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(139, 90, 43, 0.15);
}

/* Wide and Full block alignments targeting the WP block wrapper */
.wp-block-plugin-eleveur-map.alignwide {
    max-width: 100% !important;
    width: 100% !important;
}

.wp-block-plugin-eleveur-map.alignwide .eleveurs-map-container {
    width: 100% !important;
    max-width: 100% !important;
}

.wp-block-plugin-eleveur-map.alignfull {
    width: 100vw !important;
    max-width: 100vw !important;
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.wp-block-plugin-eleveur-map.alignfull .eleveurs-map-container {
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    left: auto !important;
    transform: none !important;
    border-radius: 0 !important;
}
