/* Phone Mask Plugin Styles */

.phone-mask-container {
    display: flex;
    align-items: center;
    margin: 10px 0;
    position: relative;
    z-index: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    overflow: visible;
    flex-wrap: nowrap;
}

/* Стили для WordPress Contact Form 7 */
.wpcf7-form .phone-mask-container {
    display: flex;
    align-items: center;
    margin: 10px 0;
    position: relative;
    z-index: 1;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    overflow: visible;
    flex-wrap: nowrap;
}

.phone-mask-country-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    margin-right: 10px;
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
    position: relative;
    z-index: 1000;
}

/* Стили для option элементов */
.phone-mask-country-select option {
    padding: 8px 12px;
    background: white;
    color: #333;
    font-size: 14px;
}

/* Кастомный выпадающий список с флагами */
.phone-mask-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 10px;
    min-width: 200px;
    z-index: 1000;
    border-right: 1px solid #ddd;
}

/* Стили для WordPress Contact Form 7 */
.wpcf7-form .phone-mask-dropdown {
    position: relative;
    z-index: 1000;
    border-right: 1px solid #ddd;
    margin-right: 0;
    min-width: 120px;
}

.phone-mask-dropdown-toggle {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1001;
}

/* Стили для WordPress Contact Form 7 */
.wpcf7-form .phone-mask-dropdown-toggle {
    padding: 12px 15px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1001;
    border: none;
    min-width: 120px;
    border-radius: 4px 0 0 4px;
    width: auto;
}

.phone-mask-dropdown-toggle:hover {
    background-color: #f8f9fa;
}

.phone-mask-dropdown-toggle:focus {
    outline: none;
    background-color: #f8f9fa;
}

.phone-mask-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999;
    margin-top: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.phone-mask-dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.phone-mask-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.phone-mask-dropdown-item:last-child {
    border-bottom: none;
}

.phone-mask-dropdown-item:hover {
    background-color: #f8f9fa;
}

.phone-mask-dropdown-item.selected {
    background-color: #007cba;
    color: white;
}

.phone-mask-flag {
    width: 20px;
    height: 15px;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.phone-mask-country-name {
    flex: 1;
    font-size: 14px;
}

.phone-mask-country-code {
    color: #666;
    font-size: 12px;
    margin-left: 8px;
}

.phone-mask-dropdown-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

/* Стили для шеврона */
.phone-mask-dropdown-arrow.m-select-chevron {
    font-size: 1.25rem; /* maz-text-xl */
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-mask-dropdown.open .phone-mask-dropdown-arrow {
    transform: rotate(180deg);
}

.phone-mask-country-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.phone-mask-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

/* Стили для WordPress Contact Form 7 */
.wpcf7-form .phone-mask-phone-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    font-size: 14px;
    background: transparent;
    border-radius: 0 4px 4px 0;
    overflow: hidden;
}

.phone-mask-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* Стили для WordPress Contact Form 7 */
.wpcf7-form .phone-mask-phone-input:focus {
    outline: none;
}

.wpcf7-form .phone-mask-container:focus-within {
    border-color: #ddd;
    box-shadow: none;
}

.phone-mask-input.valid {
    border-color: #28a745;
}

.phone-mask-input.invalid {
    border-color: #dc3545;
}

/* Стили для WordPress Contact Form 7 */
.wpcf7-form .phone-mask-container.valid {
    border-color: #28a745;
    background-color: #f8fff9;
}

.wpcf7-form .phone-mask-container.invalid {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.phone-mask-validation {
    margin-top: 5px;
    font-size: 12px;
    min-height: 16px;
    transition: color 0.3s ease;
}

.phone-mask-validation.valid {
    color: #28a745;
}

.phone-mask-validation.invalid {
    color: #dc3545;
}

.phone-mask-flag {
    width: 20px;
    height: 15px;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.phone-mask-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
}

/* Responsive design */
@media (max-width: 768px) {
    .phone-mask-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .phone-mask-country-select {
        margin-right: 0;
        margin-bottom: 10px;
        min-width: auto;
    }
}

/* Loading state */
.phone-mask-loading {
    opacity: 0.6;
    pointer-events: none;
}

.phone-mask-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: phone-mask-spin 1s linear infinite;
}

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

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .phone-mask-country-select,
    .phone-mask-input {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .phone-mask-country-select:focus,
    .phone-mask-input:focus {
        border-color: #3182ce;
        box-shadow: 0 0 0 1px #3182ce;
    }
    
    .phone-mask-input.valid {
        border-color: #38a169;
    }
    
    .phone-mask-input.invalid {
        border-color: #e53e3e;
    }
    
    .phone-mask-validation.valid {
        color: #38a169;
    }
    
    .phone-mask-validation.invalid {
        color: #e53e3e;
    }
}
