/**
 * Frontend Styles - Leaflet Map & Form Enhancements
 */

/* ===========================
   Map Container
   =========================== */
#fitters-map {
    width: 100%;
    height: 700px;
    border-radius: 0;
    z-index: 1;
}

@media (max-width: 768px) {
    #fitters-map {
        height: 450px;
    }
}

/* ===========================
   Custom Marker Icon
   =========================== */
.ffm-marker-icon {
    background: none;
    border: none;
}

.ffm-marker-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.ffm-marker-pin:hover {
    transform: scale(1.2);
}

/* ===========================
   Popup Styles
   =========================== */
.ffm-popup-container .leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.ffm-popup-container .leaflet-popup-content {
    margin: 0;
    min-width: 220px;
}

.ffm-popup-container .leaflet-popup-tip {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ffm-popup {
    padding: 16px;
}

.ffm-popup-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

.ffm-popup-info {
    margin: 0 0 6px;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.ffm-popup-services {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 10px 0;
}

.ffm-popup-service {
    display: inline-block;
    padding: 2px 8px;
    background-color: #f0f0f0;
    border-radius: 12px;
    font-size: 11px;
    color: #555;
    white-space: nowrap;
}

.ffm-popup-service.ffm-more {
    background-color: #e0e0e0;
    color: #333;
    font-weight: 600;
}

.ffm-popup-details-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background-color: #c8232c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}

.ffm-popup-details-btn:hover {
    background-color: #a01b22;
}

/* ===========================
   Detail Modal
   =========================== */
.ffm-detail-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.ffm-detail-modal-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ffm-detail-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.ffm-detail-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 650px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: ffmModalIn 0.3s ease;
}

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

.ffm-detail-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    z-index: 2;
    transition: background-color 0.2s ease;
    line-height: 1;
}

.ffm-detail-modal-close:hover {
    background-color: #ddd;
}

.ffm-detail-modal-body {
    padding: 30px;
}

/* Detail Modal Header */
.ffm-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ffm-detail-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
}

.ffm-detail-range-badge {
    display: inline-block;
    padding: 6px 14px;
    background-color: #c8232c;
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* Detail Modal Contact */
.ffm-detail-contact {
    margin-bottom: 20px;
}

.ffm-detail-contact h4,
.ffm-detail-services h4,
.ffm-detail-portfolio h4 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.ffm-detail-contact p {
    margin: 0 0 8px;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}

.ffm-detail-contact a {
    color: #c8232c;
    text-decoration: none;
}

.ffm-detail-contact a:hover {
    text-decoration: underline;
}

/* Detail Modal Services */
.ffm-detail-services {
    margin-bottom: 20px;
}

.ffm-detail-services ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ffm-detail-services li {
    padding: 6px 14px;
    background-color: #f5f5f5;
    border-radius: 20px;
    font-size: 13px;
    color: #444;
}

/* Detail Modal Portfolio Gallery */
.ffm-detail-portfolio {
    margin-bottom: 10px;
}

.ffm-detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.ffm-gallery-item {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.ffm-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ffm-gallery-item:hover img {
    transform: scale(1.05);
}

/* ===========================
   Form Enhancements
   =========================== */
.ffm-form-messages {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.ffm-form-errors {
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.ffm-form-errors ul {
    margin: 0;
    padding: 0 0 0 18px;
}

.ffm-form-errors li {
    margin: 4px 0;
}

.ffm-form-success {
    background-color: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.ffm-form-success p {
    margin: 0;
}

.ffm-field-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15) !important;
}

.ffm-loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.ffm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ffmSpin 0.6s linear infinite;
}

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

/* File upload drag zone */
.input-file.drag-over {
    border-color: #c8232c !important;
    background-color: rgba(200, 35, 44, 0.05) !important;
}

/* File list */
#ffm-file-list {
    display: none;
    margin-top: 10px;
}

.ffm-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: #f9f9f9;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px;
}

.ffm-file-item.ffm-file-invalid {
    background-color: #fef2f2;
}

.ffm-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ffm-file-size {
    color: #888;
    font-size: 12px;
}

.ffm-file-error {
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
}

/* ===========================
   Marker Cluster Overrides
   =========================== */
.marker-cluster-small {
    background-color: rgba(200, 35, 44, 0.2);
}

.marker-cluster-small div {
    background-color: rgba(200, 35, 44, 0.6);
    color: white;
    font-weight: 700;
}

.marker-cluster-medium {
    background-color: rgba(200, 35, 44, 0.3);
}

.marker-cluster-medium div {
    background-color: rgba(200, 35, 44, 0.7);
    color: white;
    font-weight: 700;
}

.marker-cluster-large {
    background-color: rgba(200, 35, 44, 0.4);
}

.marker-cluster-large div {
    background-color: rgba(200, 35, 44, 0.8);
    color: white;
    font-weight: 700;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 600px) {
    .ffm-detail-modal-body {
        padding: 20px;
    }

    .ffm-detail-header h3 {
        font-size: 18px;
    }

    .ffm-detail-gallery {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .ffm-popup {
        padding: 12px;
    }

    .ffm-popup-title {
        font-size: 14px;
    }
}
