/**
 * Elementor Klaviyo Widget Styles
 */

/* Form Container */
.klaviyo-form-wrapper {
    width: 100%;
    max-width: 100%;
}

.klaviyo-form {
    width: 100%;
}

/* Form Fields */
.klaviyo-form-field {
    margin-bottom: 15px;
}

.klaviyo-form-field:last-of-type {
    margin-bottom: 0;
}

/* Labels */
.klaviyo-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.klaviyo-form-label .required {
    color: #e74c3c;
    margin-left: 2px;
}

/* Input Fields */
.klaviyo-form-input {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.klaviyo-form-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.klaviyo-form-input::placeholder {
    color: #999;
    opacity: 1;
}

/* Consent Field */
.klaviyo-consent-field {
    margin-bottom: 20px;
}

.klaviyo-consent-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
}

/* Consent Mode: Implied with text (no checkbox) */
.klaviyo-consent-mode-implied_with_text .klaviyo-consent-label {
    cursor: default;
}

/* Consent Mode: Implied no text (completely hidden) */
.klaviyo-consent-mode-implied_no_text {
    display: none;
}

.klaviyo-form-checkbox {
    width: 18px;
    height: 18px;
    margin: 2px 10px 0 0;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #0066cc;
}

.klaviyo-consent-text {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    flex: 1;
}

.klaviyo-consent-text p {
    display: inline;
    margin: 0;
    padding: 0;
}

.klaviyo-consent-text .required {
    color: #e74c3c;
    margin-left: 2px;
    display: inline;
}

/* Submit Button */
.klaviyo-form-button-wrapper {
    margin-top: 20px;
}

.klaviyo-form-submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: 600;
    text-align: center;
    color: #fff;
    background-color: #0066cc;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
}

.klaviyo-form-submit:hover {
    background-color: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
}

.klaviyo-form-submit:active {
    transform: translateY(0);
}

.klaviyo-form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Button Loading State */
.klaviyo-form-submit .button-loading {
    display: inline-block;
}

.klaviyo-form-submit .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: klaviyo-spin 0.6s linear infinite;
}

@keyframes klaviyo-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Messages */
.klaviyo-form-message {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    animation: klaviyo-fade-in 0.3s ease;
}

@keyframes klaviyo-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* Remove bottom margin/padding from last child in messages */
.klaviyo-form-message.success *:last-child,
.klaviyo-form-message.error *:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* ===================================
   FORM LAYOUTS
   =================================== */

/* Default: Inputs container */
.klaviyo-form-inputs {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

/* LAYOUT 1: Stacked - Everything Vertical */
.klaviyo-form.klaviyo-layout-stacked .klaviyo-form-inputs {
    flex-direction: column;
}

.klaviyo-form.klaviyo-layout-stacked .klaviyo-form-field {
    width: 100%;
}

.klaviyo-form.klaviyo-layout-stacked .klaviyo-form-field-button {
    margin-top: 5px;
}

/* LAYOUT 2: Inline Inputs - Inputs horizontal, button below */
.klaviyo-form.klaviyo-layout-inline-inputs .klaviyo-form-inputs {
    flex-direction: row;
    flex-wrap: wrap;
}

.klaviyo-form.klaviyo-layout-inline-inputs .klaviyo-form-field-first-name,
.klaviyo-form.klaviyo-layout-inline-inputs .klaviyo-form-field-email {
    flex: 1 1 200px;
    min-width: 200px;
}

.klaviyo-form.klaviyo-layout-inline-inputs .klaviyo-form-field-button {
    flex: 1 1 100%;
    width: 100%;
}

/* LAYOUT 3: Full Inline - Everything in one row, consent below */
.klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-inputs {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
}

.klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-field-first-name,
.klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-field-email {
    flex: 1 1 auto;
    min-width: 150px;
}

.klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-field-button {
    flex: 0 0 auto;
}

.klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-submit {
    white-space: nowrap;
}

/* Force stacked on very small screens for full-inline layout */
@media (max-width: 640px) {
    .klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-inputs {
        flex-direction: column;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-field-first-name,
    .klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-field-email,
    .klaviyo-form.klaviyo-layout-full-inline .klaviyo-form-field-button {
        width: 100%;
        min-width: 100%;
    }
}

/* ===================================
   RESPONSIVE LAYOUTS - TABLET
   =================================== */
@media (max-width: 1024px) and (min-width: 767px) {
    /* Tablet Stacked */
    .klaviyo-form.klaviyo-layout-tablet-stacked .klaviyo-form-inputs {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
    }

    .klaviyo-form.klaviyo-layout-tablet-stacked .klaviyo-form-field {
        width: 100% !important;
        flex: 1 1 100% !important;
        min-width: 100% !important;
    }

    .klaviyo-form.klaviyo-layout-tablet-stacked .klaviyo-form-field-button {
        margin-top: 5px;
    }

    /* Tablet Inline Inputs */
    .klaviyo-form.klaviyo-layout-tablet-inline-inputs .klaviyo-form-inputs {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
    }

    .klaviyo-form.klaviyo-layout-tablet-inline-inputs .klaviyo-form-field-first-name,
    .klaviyo-form.klaviyo-layout-tablet-inline-inputs .klaviyo-form-field-email {
        flex: 1 1 200px !important;
        min-width: 200px !important;
    }

    .klaviyo-form.klaviyo-layout-tablet-inline-inputs .klaviyo-form-field-button {
        flex: 1 1 100% !important;
        width: 100% !important;
    }

    /* Tablet Full Inline */
    .klaviyo-form.klaviyo-layout-tablet-full-inline .klaviyo-form-inputs {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: flex-end !important;
    }

    .klaviyo-form.klaviyo-layout-tablet-full-inline .klaviyo-form-field-first-name,
    .klaviyo-form.klaviyo-layout-tablet-full-inline .klaviyo-form-field-email {
        flex: 1 1 auto !important;
        min-width: 150px !important;
    }

    .klaviyo-form.klaviyo-layout-tablet-full-inline .klaviyo-form-field-button {
        flex: 0 0 auto !important;
        width: auto !important;
    }
}

/* ===================================
   RESPONSIVE LAYOUTS - MOBILE
   =================================== */
@media (max-width: 766px) {
    .klaviyo-form-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Mobile - Always Stacked (force all layouts to stack) */
    .klaviyo-form .klaviyo-form-inputs {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
    }

    .klaviyo-form .klaviyo-form-field {
        width: 100% !important;
        flex: 1 1 100% !important;
        min-width: 100% !important;
    }

    .klaviyo-form .klaviyo-form-field-button {
        margin-top: 5px;
    }

    .klaviyo-form .klaviyo-form-submit {
        width: 100%;
    }
}

/* Accessibility */
.klaviyo-form-input:focus,
.klaviyo-form-checkbox:focus,
.klaviyo-form-submit:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* RTL Support */
[dir="rtl"] .klaviyo-form-checkbox {
    margin: 2px 0 0 10px;
}

[dir="rtl"] .klaviyo-form-label .required {
    margin-left: 0;
    margin-right: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .klaviyo-form-input,
    .klaviyo-form-submit {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .klaviyo-form-submit,
    .klaviyo-form-input,
    .klaviyo-form-message {
        transition: none;
        animation: none;
    }
}

/* Print Styles */
@media print {
    .klaviyo-form-submit {
        display: none;
    }
}
