/**
 * StaySTRA Forms Styles
 * Uses theme CSS custom properties for consistent design.
 *
 * Theme variables are hex values (e.g. --primary: #5BA4D9),
 * so use var() directly — never wrap in hsl().
 *
 * @package StaySTRA_Members
 * @since   0.6.0
 */

/* ========================================
   Base Form Container
   ======================================== */

.staystra-form {
    max-width: 640px;
    margin: 0 auto;
    font-family: var(--font-sans, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--foreground, #333333);
}

.staystra-form--sell-bnb {
    max-width: 720px;
}

/* ========================================
   Header
   ======================================== */

.staystra-form__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.staystra-form__title {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 0.375rem;
    color: var(--foreground, #333333);
}

.staystra-form__subtitle {
    font-size: 0.9375rem;
    color: var(--muted-foreground, #5d6369);
    margin: 0;
}

.staystra-form--insider .staystra-form__header {
    margin-bottom: 1rem;
}

/* ========================================
   Fields — match theme .form-input styles
   ======================================== */

.staystra-form__field {
    margin-bottom: 1.25rem;
}

.staystra-form__field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--foreground, #333333);
}

.staystra-form__field label .required {
    color: var(--destructive, #f14444);
}

.staystra-form__field input,
.staystra-form__field select,
.staystra-form__field textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--input, #e4e8ef);
    border-radius: var(--radius-md, 0.4rem);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--foreground, #333333);
    background: var(--background, #ffffff);
    transition: border-color var(--transition-fast, 150ms ease), box-shadow var(--transition-fast, 150ms ease);
    box-sizing: border-box;
}

.staystra-form__field input:focus,
.staystra-form__field select:focus,
.staystra-form__field textarea:focus {
    outline: none;
    border-color: var(--ring, #5BA4D9);
    box-shadow: 0 0 0 3px rgba(91, 164, 217, 0.15);
}

.staystra-form__field input::placeholder,
.staystra-form__field textarea::placeholder {
    color: var(--muted-foreground, #5d6369);
    opacity: 0.7;
}

.staystra-form__field textarea {
    resize: vertical;
    min-height: 120px;
}

.staystra-form__field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Error state on fields */
.staystra-form__field--error input,
.staystra-form__field--error select,
.staystra-form__field--error textarea {
    border-color: var(--destructive, #f14444) !important;
    box-shadow: 0 0 0 3px rgba(241, 68, 68, 0.15) !important;
}

/* ========================================
   Layout: Rows
   ======================================== */

.staystra-form__row {
    display: flex;
    gap: 0.75rem;
}

.staystra-form__row > .staystra-form__field {
    flex: 1;
}

.staystra-form__row--three {
    display: flex;
    gap: 0.75rem;
}

.staystra-form__row--three > .staystra-form__field {
    flex: 1;
}

@media (max-width: 600px) {
    .staystra-form__row,
    .staystra-form__row--three {
        flex-direction: column;
        gap: 0;
    }
}

/* ========================================
   Fieldsets (Sell BNB sections)
   ======================================== */

.staystra-form__section {
    border: 1px solid var(--border, #e4e8ef);
    border-radius: var(--radius-lg, 0.6rem);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.staystra-form__section legend {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--primary, #5BA4D9);
    padding: 0 0.5rem;
}

/* ========================================
   Submit Button — match theme .btn-primary
   ======================================== */

.staystra-form__submit {
    display: block;
    width: 100%;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--primary-foreground, #ffffff);
    background: var(--primary, #5BA4D9);
    border: 1px solid transparent;
    border-radius: var(--radius-md, 0.4rem);
    cursor: pointer;
    transition: background var(--transition-fast, 150ms ease), box-shadow var(--transition-fast, 150ms ease);
    margin-top: 0.5rem;
}

.staystra-form__submit:hover {
    background: #4a93c8;
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

.staystra-form__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.staystra-form--insider .staystra-form__submit {
    margin-top: 0.25rem;
}

/* ========================================
   Messages — match theme .alert styles
   ======================================== */

.staystra-form__success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
    padding: 1rem;
    border-radius: var(--radius-lg, 0.6rem);
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
}

.staystra-form__success p {
    margin: 0;
    font-weight: 500;
}

.staystra-form__error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f14444;
    padding: 1rem;
    border-radius: var(--radius-lg, 0.6rem);
    margin-top: 0.75rem;
}

.staystra-form__error p {
    margin: 0;
    font-size: 0.8125rem;
}

/* ========================================
   Disclaimer
   ======================================== */

.staystra-form__disclaimer {
    font-size: 0.75rem;
    color: var(--muted-foreground, #5d6369);
    text-align: center;
    margin-top: 0.75rem;
}

/* ========================================
   Honeypot (always hidden)
   ======================================== */

.staystra-form__hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

/* ========================================
   Dark mode support
   ======================================== */

.dark .staystra-form__field input,
.dark .staystra-form__field select,
.dark .staystra-form__field textarea {
    background: var(--background, #161616);
    border-color: var(--border, #404040);
    color: var(--foreground, #e4e4e4);
}

.dark .staystra-form__section {
    border-color: var(--border, #404040);
}

.dark .staystra-form__success {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #6ee7b7;
}

.dark .staystra-form__error {
    background: rgba(241, 68, 68, 0.15);
    border-color: #f14444;
    color: #fca5a5;
}
