/**
 * Frontend Styles for Distributor Locator Map
 *
 * @package DistributorLocatorMap
 */

/* Container */
.dlm-map-container {
    position: relative;
    width: 100%;
    background-color: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
}

/* Search Section */
.dlm-search-section {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: transparent;
    padding: 0;
    max-width: 500px;
    width: auto;
}

.dlm-search-wrapper {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.dlm-postal-code-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 255px;
    background: white;
}

.dlm-postal-code-input:focus {
    outline: none;
    border-color: #C4B59A;
}

.dlm-search-btn,
.dlm-reset-btn {
    padding: 8px 16px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.dlm-search-btn:hover,
.dlm-reset-btn:hover {
    background-color: #555;
}

.dlm-reset-btn {
    background-color: #999;
}

.dlm-reset-btn:hover {
    background-color: #777;
}

.dlm-search-results {
    margin-top: 10px;
    font-size: 13px;
}

/* Map Views */
.dlm-map-views {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Poland Overview Map */
.dlm-poland-overview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: auto;
    padding: 150px 20px 50px;
}

.dlm-map-title {
    margin-bottom: 30px;
    text-align: center;
}

.dlm-map-title h3 {
    color: #333;
    font-size: 28px;
    font-weight: 400;
    margin: 0;
}

#dlm-poland-svg {
    max-width: 500px;
    max-height: 550px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Voivodeship paths styling */
.dlm-voivodeship {
    fill: #E8DCC4 !important;
    stroke: #333 !important;
    stroke-width: 1.5 !important;
    cursor: pointer;
    transition: fill 0.3s ease;
}

.dlm-voivodeship:hover {
    fill: #D4C5A9 !important;
}

.dlm-voivodeship.active {
    fill: #C4B59A !important;
    stroke: #000 !important;
    stroke-width: 2 !important;
}

/* Distributor points on SVG map */
.dlm-distributor-point {
    cursor: pointer;
    transition: all 0.2s ease;
}

.dlm-distributor-point:hover {
    fill: #a00 !important;
    stroke-width: 3 !important;
}

/* Mobile-specific styles for distributor points */
@media (max-width: 768px) {
    .dlm-distributor-point {
        pointer-events: auto;
    }

    .dlm-distributor-point:hover {
        stroke-width: 2.5 !important;
    }
}

/* Google Map View */
.dlm-google-map-view {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dlm-map-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid #ddd;
    margin-top: 80px;
}

.dlm-back-btn {
    padding: 8px 16px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.dlm-back-btn:hover {
    background-color: #e8e8e8;
}

.dlm-map-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 400;
    color: #333;
    text-transform: capitalize;
}

.dlm-google-map-container {
    flex: 1;
    display: flex;
    position: relative;
}

.dlm-google-map {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Distributor Panel */
.dlm-distributor-panel {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 350px;
    max-height: calc(100% - 40px);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    z-index: 10;
}

.dlm-panel-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.dlm-panel-close:hover {
    color: #333;
}

.dlm-panel-content {
    padding: 20px;
}

.dlm-panel-content h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding-right: 30px;
}

.dlm-panel-details {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.dlm-panel-details p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.dlm-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

/* Buttons */
.dlm-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s;
}

.dlm-btn-primary {
    background-color: #333;
    color: white;
}

.dlm-btn-primary:hover {
    background-color: #555;
}

.dlm-btn-secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.dlm-btn-secondary:hover {
    background-color: #e8e8e8;
}

/* Contact Form */
.dlm-contact-form-wrapper {
    margin-top: 20px;
    padding-top: 0;
}

.dlm-contact-form-wrapper h5 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.dlm-form-group {
    margin-bottom: 15px;
}

.dlm-form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.dlm-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.dlm-form-group input:focus {
    outline: none;
    border-color: #C4B59A;
}

.dlm-recaptcha-wrapper {
    margin: 15px 0;
}

.dlm-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.dlm-contact-message {
    margin-top: 15px;
}

/* Messages */
.dlm-error {
    padding: 10px 15px;
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
    border-radius: 4px;
    font-size: 14px;
}

.dlm-success {
    padding: 10px 15px;
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
    border-radius: 4px;
    font-size: 14px;
}

/* Loading Overlay */
.dlm-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dlm-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: dlm-spin 1s linear infinite;
}

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

/* reCAPTCHA Modal */
.dlm-recaptcha-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.dlm-recaptcha-modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
}

.dlm-recaptcha-modal-content h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

.dlm-recaptcha-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.dlm-recaptcha-modal-close:hover {
    color: #333;
}

/* Error Modal */
.dlm-error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    z-index: 10000;
    overflow-y: auto;
}

.dlm-error-modal-content {
    background: white;
    padding: 35px 45px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: dlm-modal-slide-in 0.3s ease;
}

@keyframes dlm-modal-slide-in {
    from {
        transform: translate(-50%, -60%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.dlm-error-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.dlm-error-modal-close:hover {
    color: #333;
}

.dlm-error-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.dlm-error-modal-content h4 {
    margin: 0 0 15px 0;
    font-size: 22px;
    color: #333;
    font-weight: 600;
}

.dlm-error-modal-content p {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.5;
}

/* Fallback modal specific styles */
.dlm-fallback-modal {
    max-width: 600px;
    padding: 40px 50px;
}

.dlm-nearest-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
}

.dlm-nearest-list li {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 3px solid #d63638;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.dlm-nearest-list li:hover {
    background: #e8e8e8;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dlm-nearest-list li strong {
    display: block;
    margin-bottom: 4px;
    color: #d63638;
}

.dlm-show-nearest-btn {
    margin-top: 20px;
    width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dlm-error-modal-content {
        padding: 25px 30px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .dlm-fallback-modal {
        padding: 30px 35px;
    }

    .dlm-error-modal-content h4 {
        font-size: 18px;
    }

    .dlm-error-modal-content p {
        font-size: 14px;
    }

    .dlm-nearest-list li {
        padding: 10px 12px;
        font-size: 14px;
    }

    .dlm-search-section {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        max-width: 100%;
        padding: 12px 0;
        margin-bottom: 10px;
        z-index: 100;
        border-radius: 0;
        box-shadow: none;
    }

    .dlm-search-wrapper {
        flex-direction: column;
        gap: 8px;
        padding: 0 15px;
    }

    .dlm-postal-code-input {
        padding: 8px 12px;
        font-size: 14px;
        width: 100%;
    }

    .dlm-search-btn,
    .dlm-reset-btn {
        width: 100%;
        padding: 8px 16px;
        font-size: 14px;
    }

    .dlm-google-map-container {
        position: relative;
    }

    .dlm-distributor-panel {
        position: absolute;
        right: 10px;
        top: 60px;
        left: auto;
        bottom: auto;
        transform: none;
        width: calc(100% - 20px);
        max-width: 260px;
        max-height: 35vh;
        border-radius: 8px;
        z-index: 150;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        overflow-y: auto;
    }

    .dlm-map-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin-top: 0;
        padding: 10px 15px;
        position: relative;
        z-index: 200;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .dlm-map-header h3 {
        font-size: 14px;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dlm-back-btn {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .dlm-poland-overview {
        padding: 0;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }

    #dlm-poland-map {
        height: auto !important;
        display: flex;
        flex-direction: column;
    }

    .dlm-map-title {
        padding: 0 10px;
        flex-shrink: 0;
    }

    .dlm-map-title {
        margin-bottom: 20px;
    }

    .dlm-map-title h3 {
        font-size: 20px;
    }

    #dlm-poland-svg {
        width: 100% !important;
        height: auto !important;
        flex: 1;
        display: block;
    }
}

@media (max-width: 480px) {
    .dlm-map-title h3 {
        font-size: 18px;
    }

    .dlm-panel-content {
        padding: 8px;
    }

    .dlm-panel-content h4 {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .dlm-panel-details p {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .dlm-panel-actions {
        margin-top: 8px;
    }

    .dlm-panel-actions .dlm-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .dlm-form-actions {
        flex-direction: column;
    }
}
