/**
 * Postal Code Modal - Frontend Styles
 */

/* Prevent body scroll when modal is open */
body.pcm-modal-open {
    overflow: hidden;
}

/* Modal Overlay */
.pcm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, var(--pcm-overlay-opacity, 0.8));
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pcm-modal-overlay[style*="display: flex"],
.pcm-modal-overlay[style*="display: block"] {
    display: flex !important;
}

/* Modal Container */
.pcm-modal-container {
    position: relative;
    width: 100%;
    max-width: var(--pcm-modal-width, 500px);
    animation: pcmSlideUp 0.3s ease;
}

@keyframes pcmSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Content */
.pcm-modal-content {
    background: #ffffff;
    border-radius: var(--pcm-border-radius, 8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    padding: 40px 30px 30px;
}

/* Close Button */
.pcm-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 10;
}

.pcm-modal-close:hover {
    color: #000;
}

.pcm-modal-close svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Modal Header */
.pcm-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.pcm-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.pcm-modal-description {
    font-size: 15px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* Modal Body */
.pcm-modal-body {
    margin: 0;
}

/* Form Group */
.pcm-form-group {
    margin-bottom: 20px;
}

/* Label */
.pcm-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

/* Input Field */
.pcm-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.pcm-input:focus {
    outline: none;
    border-color: var(--pcm-primary-color, #0073aa);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.pcm-input.pcm-error {
    border-color: #dc3232;
}

.pcm-input.pcm-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.1);
}

/* Error Message */
.pcm-error-message {
    display: block;
    color: #dc3232;
    font-size: 13px;
    margin-top: 8px;
    font-weight: 500;
}

/* Form Actions */
.pcm-form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Buttons */
.pcm-button {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.pcm-button:focus {
    outline: none;
}

.pcm-button-primary {
    background-color: var(--pcm-primary-color, #0073aa);
    color: #ffffff;
}

.pcm-button-primary:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--pcm-primary-color, #0073aa) 85%, black);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.pcm-button-primary:active:not(:disabled) {
    transform: translateY(0);
}

.pcm-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pcm-button-primary.pcm-loading {
    position: relative;
    color: transparent;
}

.pcm-button-primary.pcm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: pcmSpin 0.6s linear infinite;
}

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

.pcm-button-skip {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.pcm-button-skip:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
}

/* Responsive Design */
@media (max-width: 600px) {
    .pcm-modal-content {
        padding: 30px 20px 20px;
    }

    .pcm-modal-title {
        font-size: 20px;
    }

    .pcm-modal-description {
        font-size: 14px;
    }

    .pcm-input,
    .pcm-button {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* Custom CSS Variables Support */
:root {
    --pcm-primary-color: #0073aa;
    --pcm-overlay-opacity: 0.8;
    --pcm-modal-width: 500px;
    --pcm-border-radius: 8px;
}
