/* Ionmara Contact - Same Style as Product Registration */
.ionmara-contact-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Form Container - Same as product registration */
.ionmara-contact-form-container {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.ionmara-contact-form {
    width: 100%;
}

/* Form Layout - Same as product registration */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 250px;
}

.form-group.full-width {
    flex: 1 1 100%;
}

/* Form Elements - Same as product registration */
.form-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.95rem;
    margin-top: 20px !important;
}

.form-group input, .form-control {
    width: 100%;
    padding: 5px 15px !important;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #EF4136;
    box-shadow: 0 0 0 3px rgba(239, 65, 54, 0.1);
}

#ionmara-contact-subject-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 44px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' 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 16px center;
    background-size: 16px 16px;
}

.form-control.error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.ionmara-contact-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.required {
    color: #dc3545;
    margin-left: 4px;
}

/* Phone Number Group */
.ionmara-phone-group {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ionmara-phone-code {
    /* Slightly wider so flag + country name + code fit nicely */
    flex: 0 0 200px;
}

.ionmara-phone-number {
    flex: 1;
}

/* Country Code Dropdown */
.ionmara-country-select {
    /* Reset font to ensure emoji display */
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji',
                 'Android Emoji', 'EmojiSymbols', 'Segoe UI Symbol',
                 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px; /* Slightly larger for better visibility */
    line-height: 1.5;
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background-color: #ffffff;
    transition: all 0.3s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' 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 12px center;
    background-size: 16px 16px;
    padding-right: 36px;
}

.ionmara-country-select:focus {
    outline: none;
    border-color: #EF4136;
    box-shadow: 0 0 0 3px rgba(239, 65, 54, 0.1);
}

/* Select2 flag images (phone code dropdown) */
.select2-container--default .select2-selection--single {
    height: 40px !important;
    padding: 5px 12px !important;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #fff;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    padding-left: 12px;
    padding-right: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 10px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #888 transparent transparent transparent;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    height: 0;
    left: 50%;
    margin-left: -4px;
    margin-top: -5px !important;
    position: absolute;
    top: 50%;
    width: 0;
}

.ionmara-phonecode-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ionmara-flag {
    width: 18px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.08);
}

/* Textarea */
.ionmara-contact-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* Error Messages */
.error-message {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.form-group.has-error .error-message {
    display: block;
}

.ionmara-phone-code .error-message,
.ionmara-phone-number .error-message {
    display: none;
}

.ionmara-phone-code .error-message.show,
.ionmara-phone-number .error-message.show {
    display: block;
}

.form-group.has-error .ionmara-phone-code .error-message:not(.show),
.form-group.has-error .ionmara-phone-number .error-message:not(.show) {
    display: none;
}

/* Submit Section - Same as product registration */
.submit-section {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid #e9ecef;
    margin-top: 40px;
}

.ionmara-contact-submit {
    background: #EF4136;
    color: #ffffff;
    padding: 16px 40px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 250px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ionmara-contact-submit:hover {
    background: #d6342a;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 65, 54, 0.3);
}

.ionmara-contact-submit:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading State */
.ionmara-contact-submit.loading {
    background: #6c757d;
    cursor: not-allowed;
    position: relative;
    padding-right: 56px;
}

.ionmara-contact-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 24px;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 0;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: ionmara-spin 1s linear infinite !important;
}

@keyframes ionmara-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.ionmara-contact-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.ionmara-contact-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.ionmara-contact-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Subject other input spacing */
.ionmara-contact-subject-other-group {
    margin-top: 10px;
}

/* Responsive Design */

/* Tablet */
@media (max-width: 1024px) {
    .ionmara-contact-container {
        padding: 25px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-group {
        min-width: 100%;
    }
    
    /* Keep phone code + number on a single row even on tablets */
    .ionmara-phone-group {
        flex-direction: row;
        gap: 10px;
    }
    
    .ionmara-phone-code {
        flex: 0 0 200px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .ionmara-contact-container {
        padding: 20px;
        margin: 0 10px;
    }
    
    .ionmara-contact-form-container {
        padding: 15px;
    }

    .form-row {
        gap: 10px;
        margin-bottom: 10px;
    }

    .form-group label {
        margin-top: 10px !important;
        margin-bottom: 6px;
    }

    .ionmara-phone-group {
        flex-direction: column;
        gap: 10px;
    }

    .ionmara-phone-code {
        flex: 0 0 0px;
        position: relative;
    }
    
    .form-control,
    .ionmara-country-select {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .ionmara-contact-label {
        font-size: 14px;
    }
    
    .ionmara-contact-submit {
        padding: 14px 30px;
        font-size: 15px;
        min-width: 200px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .ionmara-contact-container {
        padding: 15px;
        margin: 0 5px;
    }
    
    .ionmara-contact-form-container {
        padding: 12px;
    }

    .form-row {
        gap: 8px;
        margin-bottom: 8px;
    }

    .form-group label {
        margin-top: 8px !important;
        margin-bottom: 6px;
    }

    .ionmara-phone-group {
        flex-direction: column;
        gap: 8px;
    }

    .ionmara-phone-code {
        flex: 0 0 0px !important;
        position: relative;
        width: 100%;
    }

    .ionmara-phone-number {
       flex: 1;
       width: 100%;
    }
    
    .form-control,
    .ionmara-country-select {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .ionmara-contact-label {
        font-size: 13px;
    }
    
    .ionmara-contact-submit {
        padding: 12px 20px;
        font-size: 14px;
        min-width: 180px;
    }
    
    .ionmara-contact-textarea {
        min-height: 100px;
    }
}

/* Accessibility */
.ionmara-contact-submit:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.form-control:focus,
.ionmara-country-select:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ionmara-contact-container {
        border: 2px solid #000;
    }
    
    .ionmara-contact-form-container {
        border: 2px solid #000;
    }
    
    .form-control,
    .ionmara-country-select {
        border: 2px solid #000;
    }
    
    .ionmara-contact-submit {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .form-control,
    .ionmara-country-select,
    .ionmara-contact-submit {
        transition: none;
    }
    
    .ionmara-contact-submit:hover {
        transform: none;
        box-shadow: none;
    }
    
    .ionmara-contact-submit.loading::after {
        animation: none;
    }
}
