/**
 * SynLawn MyEmma Signup Form Styles
 * BEM Naming Convention with Commented Color Examples
 * Mobile-First Responsive Design
 */

/* ========================================
   Block: .synlawn-signup
   ======================================== */

.synlawn-signup {
    /* Container styles - uncomment colors to customize */
    /* background: #f9fafb; */
    /* border-top: 1px solid #e5e7eb; */

    background: transparent;
    padding: 32px 0;
    width: 100%;
}

.synlawn-signup__container {
    max-width: 500px;
    margin: 0 auto;
    padding: 24px 20px;

    /* Container background - uncomment to use */
    /* background: #ffffff; */
    /* border-radius: 8px; */
    /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); */
}

/* ========================================
   Typography Elements
   ======================================== */

.synlawn-signup__title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;

    /* Title color - uncomment to customize */
    /* color: #111827; */
    color: inherit;
}

.synlawn-signup__subtitle {
    margin: 0 0 24px 0;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;

    /* Subtitle color - uncomment to customize */
    /* color: #6b7280; */
    color: inherit;
    opacity: 0.8;
}

/* ========================================
   Form Elements
   ======================================== */

.synlawn-signup__form {
    display: flex;
    flex-direction: column;
    gap: 0; /* No gap - handled by form-row and messages */
}

.synlawn-signup__form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.synlawn-signup__field-group {
    width: 100%;
}

.synlawn-signup__email-input {
    width: 100% !important;
    height: 52px !important;
    padding: 0 16px !important;
    font-size: 16px !important; /* 16px prevents iOS zoom on focus */
    line-height: 1.5 !important;
    border: 1px solid #cccccc !important;
    border-radius: 4px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    box-sizing: border-box !important; /* CRITICAL: Include padding and border in width */

    /* FORCE white background - override everything */
    color: #272727 !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border-color: #cccccc !important;
    box-shadow: none !important;
    opacity: 1 !important;
    filter: none !important;
}

/* Force on all input states */
input[type="email"].synlawn-signup__email-input,
input.synlawn-signup__email-input {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    opacity: 1 !important;
}

.synlawn-signup__email-input:focus {
    outline: none !important;
    border-color: #77bb1f !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(119, 187, 31, 0.1) !important;
    opacity: 1 !important;
}

.synlawn-signup__email-input::placeholder {
    /* Placeholder color - uncomment to customize */
    /* color: #9ca3af; */
    color: currentColor;
    opacity: 0.5;
}

/* ========================================
   Toggle Button
   ======================================== */

.synlawn-signup__toggle-group {
    width: 100%;
}

.synlawn-signup__toggle-btn {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    font-size: 16px;
    font-weight: 500;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box; /* CRITICAL: Include padding and border in width */

    /* SynLawn branded colors - force override theme */
    color: #272727 !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-color: #cccccc !important;
    box-shadow: none !important;
}

.synlawn-signup__toggle-btn:hover {
    border-color: #77bb1f !important;
    background: #ffffff !important; /* Stay white on hover, no transparency */
    background-color: #ffffff !important;
    box-shadow: none !important;
}

.synlawn-signup__toggle-btn:focus {
    outline: none;
    border-color: #77bb1f !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(119, 187, 31, 0.1) !important;
}

.synlawn-signup__toggle-btn--active {
    border-color: #77bb1f !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
}

.synlawn-signup__toggle-text {
    font-weight: 600;
}

.synlawn-signup__toggle-icon {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.synlawn-signup__toggle-btn--commercial .synlawn-signup__toggle-icon {
    transform: rotate(180deg);
}

/* ========================================
   Submit Button
   ======================================== */

.synlawn-signup__button-group {
    width: 100%;
}

.synlawn-signup__submit-btn {
    width: 100%;
    height: 52px !important;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box; /* CRITICAL: Include padding in width */

    /* SynLawn branded green button - force override theme */
    color: #ffffff !important;
    background: #77bb1f !important;
    background-color: #77bb1f !important;
    border: none !important;
    box-shadow: none !important;
}

.synlawn-signup__submit-btn:hover:not(:disabled) {
    background: #5e9518 !important; /* Darker SynLawn green on hover */
    background-color: #5e9518 !important;
    box-shadow: none !important;
}

.synlawn-signup__submit-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(119, 187, 31, 0.2) !important;
}

.synlawn-signup__submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   Messages
   ======================================== */

.synlawn-signup__message {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 4px;
    text-align: center;
    margin-top: 12px; /* Space above message */
    width: 100%; /* Full width on mobile */
}

.synlawn-signup__message--success {
    /* Success message colors - uncomment to customize */
    /* color: #065f46; */
    /* background: #d1fae5; */
    /* border: 1px solid #10b981; */

    color: #065f46;
    background: #d1fae5;
    border: 1px solid #10b981;
}

.synlawn-signup__message--error {
    /* Error message colors - uncomment to customize */
    /* color: #991b1b; */
    /* background: #fee2e2; */
    /* border: 1px solid #ef4444; */

    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #ef4444;
}

/* ========================================
   Responsive Design - Desktop
   ======================================== */

@media (min-width: 768px) {
    .synlawn-signup {
        padding: 48px 0;
    }

    .synlawn-signup__container {
        max-width: 700px; /* Wider for row layout */
        padding: 32px 40px;
    }

    .synlawn-signup__title {
        font-size: 28px;
    }

    .synlawn-signup__subtitle {
        font-size: 16px;
        margin-bottom: 32px;
    }

    /* Desktop: Change form-row to ROW layout (not the form itself) */
    .synlawn-signup__form-row {
        flex-direction: row;
        gap: 12px;
        align-items: stretch; /* All elements same height */
    }

    /* Remove fixed widths, use flex instead */
    .synlawn-signup__field-group,
    .synlawn-signup__toggle-group,
    .synlawn-signup__button-group {
        width: auto; /* Override 100% width from mobile */
    }

    /* Email input: Takes most space (50%) */
    .synlawn-signup__field-group {
        flex: 3 1 0%;
    }

    .synlawn-signup__email-input {
        height: 56px !important; /* Match all elements on desktop */
    }

    /* Toggle button: Medium space (33%) - fits "Residential" and "Commercial" */
    .synlawn-signup__toggle-group {
        flex: 2 1 0%;
    }

    .synlawn-signup__toggle-btn {
        height: 56px !important; /* Match all elements on desktop */
        font-size: 15px; /* Slightly smaller on desktop */
        padding: 0 12px; /* Tighter padding */
    }

    .synlawn-signup__toggle-text {
        white-space: nowrap; /* Prevent "Residential" from wrapping */
        overflow: hidden;
        text-overflow: ellipsis; /* Show ... if too long (safety) */
    }

    /* Submit button: Takes remaining space (~25%) */
    .synlawn-signup__button-group {
        flex: 1.5 1 0%;
    }

    .synlawn-signup__submit-btn {
        height: 56px !important; /* Match all elements on desktop */
    }
}

/* Large desktop: More space for better readability */
@media (min-width: 1024px) {
    .synlawn-signup__container {
        max-width: 800px;
    }

    .synlawn-signup__form-row {
        gap: 16px;
    }

    .synlawn-signup__toggle-btn {
        font-size: 16px; /* Back to normal size on large screens */
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus visible for keyboard navigation */
.synlawn-signup__email-input:focus-visible,
.synlawn-signup__toggle-btn:focus-visible,
.synlawn-signup__submit-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .synlawn-signup__email-input,
    .synlawn-signup__toggle-btn,
    .synlawn-signup__submit-btn {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .synlawn-signup__email-input,
    .synlawn-signup__toggle-btn,
    .synlawn-signup__submit-btn,
    .synlawn-signup__toggle-icon {
        transition: none;
    }
}

/* ========================================
   Loading Spinner (for submit button)
   ======================================== */

.synlawn-signup__spinner {
    display: inline-block;
    width: 12px; /* Smaller spinner */
    height: 12px; /* Smaller spinner */
    margin-left: 6px; /* Less margin */
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: synlawn-spin 0.6s linear infinite;
    vertical-align: middle; /* Align with text */
}

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