/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500&display=swap');

/* iAM Smart Error Message Styles */
.iamsmart-error-message {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border: 1px solid #f5c6cb !important;
    border-radius: 4px !important;
    padding: 8px 12px !important;
    margin: 10px 0 !important;
    font-size: 14px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif !important;
    display: inline-block !important;
    width: fit-content !important;
    max-width: 100% !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
}

/* Container alignment */
.iamsmart-container {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Responsive design for error message */
@media (max-width: 768px) {
    .iamsmart-error-message {
        padding: 6px 10px !important;
        font-size: 13px !important;
        margin: 8px 0 !important;
    }
}

/* iAM Smart Button - High specificity to override Elementor and theme styles */
.iamsmart-container .iamsmart-button,
button.iamsmart-button,
.iamsmart-button.iamsmart-button {
    background-color: #2B7367 !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 12px !important; /* Reduced padding */
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    font-family: 'Noto Sans SC', Arial, sans-serif !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    outline: none !important;
    transition: background-color 0.2s ease !important;
    box-shadow: none !important;
    border-left: none !important;
    margin: 0 !important;
    line-height: normal !important;
}

.iamsmart-container .iamsmart-button:hover,
button.iamsmart-button:hover,
.iamsmart-button.iamsmart-button:hover {
    background-color: #1f5a50 !important;
    color: white !important;
    border: none !important;
    box-shadow: none !important;
}

.iamsmart-container .iamsmart-button:active,
.iamsmart-container .iamsmart-button:focus,
button.iamsmart-button:active,
button.iamsmart-button:focus,
.iamsmart-button.iamsmart-button:active,
.iamsmart-button.iamsmart-button:focus {
    background-color: #1f5a50 !important;
    color: white !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Logo */
.iamsmart-button .iamsmart-logo {
    height: 28px !important; /* Increased height */
    width: 21px !important; /* Set width for aspect ratio */
    margin-right: 8px !important; /* Matched to button's side padding */
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Button text */
.iamsmart-button .iamsmart-text {
    font-size: 16px !important;
    white-space: nowrap !important;
    color: white !important;
}

/* Loading state */
.iamsmart-button.loading {
    pointer-events: none !important;
    opacity: 0.7 !important; /* Make button dimmer */
}

/* Container */
.iamsmart-container {
    text-align: left;
    max-width: 100% !important; /* Use full available width */
    width: 100% !important;
    margin: 0 auto; /* Center the container like the form */
    padding: 20px !important; /* Match form container padding */
    box-sizing: border-box !important; /* Ensure padding is included in width calculation */
}

/* Override any Elementor or theme positioning for the button container */
.elementor-widget-shortcode .iamsmart-container,
.elementor-shortcode .iamsmart-container,
div.iamsmart-container {
    text-align: left !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Force container to inherit parent width in Elementor columns */
.elementor-column .iamsmart-container,
.elementor-column .iamsmart-form-container {
    max-width: none !important;
    width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

/* Ensure button container matches form container exactly */
.elementor-widget-container .iamsmart-container {
    padding: 20px !important;
    margin: 0 auto !important;
}

/* Additional Elementor compatibility rules */
.elementor-widget-container .iamsmart-container,
.elementor-widget-container .iamsmart-form-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Error message - Proper error styling */
.iamsmart-error {
    color: #d63638 !important;
    background-color: #ffebe9 !important;
    padding: 10px !important;
    border-left: 4px solid #d63638 !important;
    margin-bottom: 15px !important;
    border-radius: 4px !important;
    border: 1px solid #ffcdd2 !important;
    display: block !important;
    font-family: inherit !important;
    font-size: 14px !important;
}

/* Form message styles */
.iamsmart-form-messages {
    margin-top: 15px;
    margin-left: auto;
    margin-right: auto;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    width: fit-content;
    display: block;
}

.iamsmart-form-messages.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.iamsmart-form-messages.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.iamsmart-form-messages p {
    margin: 0;
}

/* IAM Smart Form Styles */
.iamsmart-form-container {
    max-width: 100% !important; /* Use full available width instead of fixed 1800px */
    width: 100% !important;
    margin: 0 auto;
    padding: 20px !important;
    font-family: 'Noto Sans SC', Arial, sans-serif;
    box-sizing: border-box !important;
}

/* Ensure form container inherits parent width properly */
.elementor-widget-shortcode .iamsmart-form-container,
.elementor-shortcode .iamsmart-form-container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 20px !important;
}

.iamsmart-form {
    background: white;
    padding: 0;
}

.iamsmart-field-group {
    margin-bottom: 25px !important; /* Increased from 20px for better spacing */
    position: relative;
    margin-right: 60px !important; /* Increased from 50px to give more room for tags */
    padding-right: 0 !important; /* Ensure no extra padding */
    box-sizing: border-box !important;
}

/* Additional specificity for Elementor forms */
.elementor-widget-shortcode .iamsmart-field-group,
.elementor-shortcode .iamsmart-field-group {
    margin-bottom: 25px !important;
    margin-right: 60px !important;
}

/* Ensure labels have consistent styling */
.iamsmart-label {
    display: block !important;
    margin-bottom: 8px !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    color: #333 !important;
    font-family: 'Noto Sans SC', Arial, sans-serif !important;
    line-height: normal !important;
}

.iamsmart-required {
    color: #ff4444 !important;
    font-weight: normal !important;
}

.iamsmart-input,
.iamsmart-select,
.iamsmart-textarea {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid #e1e5e9 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-family: 'Noto Sans SC', Arial, sans-serif !important;
    background-color: #fff !important;
    transition: border-color 0.2s ease !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    line-height: normal !important;
}

/* Override any theme or Elementor form styling */
.elementor-widget-shortcode .iamsmart-input,
.elementor-shortcode .iamsmart-input,
.elementor-widget-shortcode .iamsmart-select,
.elementor-shortcode .iamsmart-select,
.elementor-widget-shortcode .iamsmart-textarea,
.elementor-shortcode .iamsmart-textarea {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid #e1e5e9 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    background-color: #fff !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.iamsmart-input:focus,
.iamsmart-select:focus,
.iamsmart-textarea:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.iamsmart-input::placeholder,
.iamsmart-textarea::placeholder {
    color: #9aa0a6;
    font-size: 16px;
}

.iamsmart-select {
    cursor: pointer;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23666"><path d="M8 12L3 7h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.iamsmart-select option {
    font-family: 'Noto Sans SC', Arial, sans-serif;
    padding: 8px;
}

.iamsmart-textarea {
    resize: vertical;
    min-height: 100px;
}

.iamsmart-submit-group {
    text-align: center;
    margin-top: 30px;
}

.iamsmart-submit-button {
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Noto Sans SC', Arial, sans-serif;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-width: 120px;
}

.iamsmart-submit-button:hover {
    background-color: #3367d6;
}

.iamsmart-submit-button:active {
    background-color: #2d5aa0;
}

.iamsmart-submit-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.3);
}

.iamsmart-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Smart Tag Styles - Positioned outside fields */
.iamsmart-tag {
    position: absolute !important;
    right: -50px !important; /* Increased from -40px for better positioning */
    top: 32px !important; /* Position relative to the label + margin (8px + 24px for input height) */
    height: 44px !important; /* Fixed height matching input field */
    width: auto !important; /* Let width adjust based on image aspect ratio */
    min-width: 24px !important; /* Minimum width for consistency */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease !important;
    background-color: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
}

.iamsmart-tag img {
    height: 44px !important; /* Fixed height that matches typical field height */
    width: auto !important; /* Width adjusts automatically to maintain aspect ratio */
    display: block !important;
    object-fit: contain !important; /* Maintain aspect ratio */
    margin: 0 !important;
    padding: 0 !important;
}

/* iAM Smart Legend Styles */
.iamsmart-legend {
    display: none;
    margin-top: 20px;
    margin-bottom: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.iamsmart-legend.show {
    display: block;
    opacity: 1;
}

.iamsmart-legend-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.iamsmart-legend-icon {
    height: 44px !important; /* Same size as form field tags */
    width: auto !important;
    object-fit: contain !important;
    margin: 0 !important;
    padding: 0 !important;
}

.iamsmart-legend-text {
    font-size: 16px !important; /* Same as form labels */
    font-weight: 400 !important;
    color: #333 !important;
    font-family: 'Noto Sans SC', Arial, sans-serif !important;
    line-height: normal !important;
    margin: 0 !important;
}

/* Mobile responsive for legend */
@media (max-width: 768px) {
    .iamsmart-legend {
        margin-top: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .iamsmart-legend-icon {
        height: 38px !important; /* Match mobile smart tag size */
    }
    
    .iamsmart-legend-text {
        font-size: 16px !important; /* Keep same size on mobile for readability */
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .iamsmart-container {
        padding: 15px !important; /* Match mobile form padding */
    }
    
    .iamsmart-form-container {
        padding: 15px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .iamsmart-field-group {
        margin-right: 54px !important; /* Adjust margin for mobile */
        margin-bottom: 20px !important; /* Slightly less spacing on mobile */
    }
    
    .iamsmart-tag {
        right: -46px !important; /* Closer on mobile */
        top: 28px !important; /* Adjust for mobile input height */
        height: 38px !important; /* Smaller height on mobile */
        min-width: 20px !important; /* Smaller minimum width on mobile */
    }
    
    .iamsmart-tag img {
        height: 38px !important; /* Slightly smaller height on mobile */
        width: auto !important; /* Width still adjusts automatically */
    }
    
    .iamsmart-input,
    .iamsmart-select,
    .iamsmart-textarea {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
}