/* Aqara Warranty Form — scoped under .aqara-warranty to avoid leaking into WP theme */

.aqara-warranty {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2.5rem;
    font-family: 'Source Sans Pro', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #333;
    background: #fff;
    line-height: 1.5;
    box-sizing: border-box;
}

.aqara-warranty *,
.aqara-warranty *::before,
.aqara-warranty *::after {
    box-sizing: border-box;
}

.aqara-warranty-section {
    margin-bottom: 2.5rem;
}

.aqara-warranty-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 1.5rem;
    line-height: 1.3;
}

/* Grid */
.aqara-warranty-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.aqara-warranty-grid-2 {
    grid-template-columns: 1fr;
}

.aqara-warranty-grid-3 {
    grid-template-columns: 1fr;
}

.aqara-warranty-grid-name {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .aqara-warranty-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    .aqara-warranty-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    /* Prefix is optional; give it ~1/8 of the row, first/last name take the rest */
    .aqara-warranty-grid-name {
        grid-template-columns: 110px 1fr 1fr;
    }
}

/* Material-style floating-label input */
.aqara-warranty-input-group {
    position: relative;
    margin-bottom: 1.25rem;
}

/* !important is needed to beat WP themes that style input[type=text]/select with
   their own border, background, padding, border-radius, and box-shadow. */
.aqara-warranty .aqara-warranty-input,
.aqara-warranty .aqara-warranty-select {
    width: 100% !important;
    padding: 0.625rem 0 !important;
    font-size: 1rem !important;
    color: #333 !important;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid #777771 !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color 0.1s ease-in-out;
    font-weight: 400;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    line-height: 1.5;
    height: auto;
}

.aqara-warranty .aqara-warranty-select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23777771' d='M6 8L0 0h12z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.25rem center !important;
    padding-right: 1.5rem !important;
}

.aqara-warranty .aqara-warranty-input:focus,
.aqara-warranty .aqara-warranty-input:focus-visible,
.aqara-warranty .aqara-warranty-select:focus,
.aqara-warranty .aqara-warranty-select:focus-visible {
    border-bottom-color: #720eec !important;
    outline: none !important;
    box-shadow: none !important;
}

.aqara-warranty .aqara-warranty-label {
    position: absolute;
    left: 0;
    top: 0.625rem;
    font-size: 1rem;
    color: #777771;
    pointer-events: none;
    transition: transform 0.1s ease-in-out, font-size 0.1s ease-in-out, color 0.1s ease-in-out;
    transform-origin: top left;
    background: #fff;
    padding: 0 0.125rem;
    font-weight: 500;
}

/* Float label up when input has content or is focused */
.aqara-warranty .aqara-warranty-input:focus ~ .aqara-warranty-label,
.aqara-warranty .aqara-warranty-input:not(:placeholder-shown) ~ .aqara-warranty-label,
.aqara-warranty .aqara-warranty-label-floating {
    transform: translateY(-1.75rem);
    font-size: 0.75rem;
    color: #720eec;
    font-weight: 600;
}

.aqara-warranty .aqara-warranty-input:not(:focus):not(:placeholder-shown) ~ .aqara-warranty-label,
.aqara-warranty .aqara-warranty-select:not(:focus) ~ .aqara-warranty-label-floating {
    color: #777771;
}

.aqara-warranty-error {
    font-size: 0.75rem;
    color: #e04562;
    margin: 0.25rem 0 0;
    font-weight: 400;
}

.aqara-warranty-autofill-indicator {
    font-size: 0.75rem;
    color: #58695e;
    margin: 0.25rem 0 0;
    font-weight: 500;
    transition: opacity 0.4s ease-in-out;
}

.aqara-warranty-autofill-indicator.is-fading {
    opacity: 0;
}

.aqara-warranty-error-center {
    text-align: center;
}

/* Consent block (T&C + marketing) */
.aqara-warranty-consent {
    margin-top: 1.5rem;
}

.aqara-warranty-consent .aqara-warranty-checkbox-group {
    margin-bottom: 0.75rem;
}

.aqara-warranty-consent a {
    color: #720eec;
    text-decoration: underline;
}

.aqara-warranty-consent a:hover {
    color: #58695e;
}

/* "No unit number" checkbox */
.aqara-warranty-checkbox-group {
    margin: -0.5rem 0 1.25rem;
}

.aqara-warranty-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #333;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}

.aqara-warranty .aqara-warranty-checkbox {
    width: 1rem !important;
    height: 1rem !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    accent-color: #720eec;
    flex-shrink: 0;
}

/* Platform toggle buttons */
.aqara-warranty-platform-prompt {
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.75rem;
}

.aqara-warranty-platform-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.aqara-warranty-platform-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid #777771;
    border-radius: 0.25rem;
    background: #fff;
    color: #777771;
    cursor: pointer;
    transition: all 0.1s ease-in-out;
}

.aqara-warranty-platform-btn:hover {
    border-color: #333;
}

.aqara-warranty-platform-btn.is-active {
    background: #b58159;
    border-color: #b58159;
    color: #fff;
}

/* File upload */
.aqara-warranty-file {
    margin-top: 1.5rem;
}

.aqara-warranty-file-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
}

.aqara-warranty-file input[type="file"] {
    display: block;
    width: 100%;
    font-size: 0.875rem;
    font-family: inherit;
    color: #333;
    cursor: pointer;
}

.aqara-warranty-file-hint {
    font-size: 0.875rem;
    color: #777771;
    margin: 0.5rem 0 0;
}

.aqara-warranty-file-selected {
    font-size: 0.875rem;
    color: #58695e;
    margin: 0.5rem 0 0;
}

/* Turnstile */
.aqara-warranty-turnstile {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
}

/* Submit button + row */
.aqara-warranty-submit-row {
    text-align: center;
    padding-top: 1rem;
}

.aqara-warranty-button {
    padding: 0.625rem 2.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: #fff;
    background: #b58159;
    border: 0;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.1s ease-in-out;
}

.aqara-warranty-button:hover:not(:disabled) {
    background: #58695e;
}

.aqara-warranty-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Submit error banner */
.aqara-warranty-submit-error {
    background: #fef2f2;
    border: 1px solid #e04562;
    color: #e04562;
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Success state */
.aqara-warranty-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.25rem;
    padding: 2rem;
    text-align: center;
}

.aqara-warranty-success h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #15803d;
    margin: 0 0 1rem;
}

.aqara-warranty-success p {
    font-size: 1.125rem;
    color: #16a34a;
    margin: 0 0 1.5rem;
}

.aqara-warranty-success-number {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1rem !important;
}

.aqara-warranty-success-link {
    display: inline-block;
    text-decoration: none;
    background: #b58159 !important;
    color: #fff !important;
}

.aqara-warranty-success-link:hover {
    background: #58695e !important;
    color: #fff !important;
}
