/* ============================================================================
   Forms Override Styles
   Neutralizes old form styles and ensures modern UI consistency
   ============================================================================ */

/* Legacy Form Overrides
   ========================================================================== */
form[name="searchform"] {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

/* Override any old form container styles */
.esim-container form {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Ensure inline forms don't have borders */
form[style*="display: inline"] {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    box-shadow: none !important;
}

/* Modern Form Input Styles
   ========================================================================== */
.esim-form-input {
    border: 1px solid var(--color-border, #e5e7eb) !important;
    background: var(--color-bg-primary, #ffffff) !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.esim-form-input:focus {
    border-color: var(--color-primary, #dbfa5e) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(219, 250, 94, 0.1) !important;
}

.esim-form-input:disabled {
    background: var(--color-bg-secondary, #f9fafb) !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Form Select Overrides
   ========================================================================== */
.esim-form-select {
    border: 1px solid var(--color-border, #e5e7eb) !important;
    background: var(--color-bg-primary, #ffffff) !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.esim-form-select:focus {
    border-color: var(--color-primary, #dbfa5e) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(219, 250, 94, 0.1) !important;
}

/* Textarea Overrides
   ========================================================================== */
textarea.esim-form-input {
    resize: vertical !important;
    min-height: 100px !important;
}

/* Checkbox and Radio Overrides
   ========================================================================== */
input[type="checkbox"],
input[type="radio"] {
    margin: 0 !important;
    vertical-align: middle !important;
}

/* Hidden Submit Button Override
   ========================================================================== */
input[type="submit"][style*="visibility:hidden"],
input[type="submit"][style*="visibility: hidden"] {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
}

/* Filter Grid Layout
   ========================================================================== */
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }
}

/* Form Group Spacing
   ========================================================================== */
.esim-form-group {
    margin-bottom: 1rem;
}

.esim-form-group:last-child {
    margin-bottom: 0;
}

.esim-form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text);
}

/* Button Group Alignment
   ========================================================================== */
.esim-button-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.esim-button-group > * {
    margin: 0 !important;
}

/* Error and Success States
   ========================================================================== */
.esim-form-input.error {
    border-color: var(--color-error, #ef4444) !important;
}

.esim-form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.esim-form-input.success {
    border-color: var(--color-success, #16a34a) !important;
}

.esim-form-input.success:focus {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
}

/* Form Help Text
   ========================================================================== */
.form-help-text {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* Responsive Form Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    .esim-form-input,
    .esim-form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    .esim-button-group {
        flex-direction: column;
        align-items: stretch;
    }

    .esim-button-group > * {
        width: 100%;
    }
}