/* ========================================
   FORMS RESPONSIVE - ADMIN & SELLER
   ======================================== */

/* Base form styles */
.form-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Form layouts */
.form-horizontal {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.form-horizontal .form-label {
    flex: 0 0 200px;
    margin-bottom: 0;
    margin-right: 1rem;
}

.form-horizontal .form-control,
.form-horizontal .form-select {
    flex: 1;
}

/* Responsive form layouts */
@media (max-width: 767px) {
    .form-horizontal {
        flex-direction: column;
        align-items: stretch;
    }

    .form-horizontal .form-label {
        flex: 0 0 auto;
        margin-bottom: 0.5rem;
        margin-right: 0;
    }

    .form-horizontal .form-control,
    .form-horizontal .form-select {
        width: 100%;
    }
}

/* Form groups */
.form-group {
    margin-bottom: 1.5rem;
}

@media (max-width: 767px) {
    .form-group {
        margin-bottom: 1rem;
    }
}

/* Labels */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

.form-label.required::after {
    content: ' *';
    color: #dc3545;
}

@media (max-width: 575px) {
    .form-label {
        font-size: 0.875rem;
    }
}

/* Input fields */
.form-control,
.form-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color, #f27a1a);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(242, 122, 26, 0.25);
}

@media (max-width: 767px) {
    .form-control,
    .form-select {
        font-size: 1rem;
        padding: 0.75rem;
    }
}

@media (max-width: 575px) {
    .form-control,
    .form-select {
        padding: 0.625rem 0.75rem;
    }
}

/* Textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

@media (max-width: 767px) {
    textarea.form-control {
        min-height: 80px;
    }
}

/* Input groups */
.input-group {
    display: flex;
    width: 100%;
}

.input-group-text {
    padding: 0.625rem 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .input-group {
        flex-wrap: wrap;
    }

    .input-group-text {
        flex: 0 0 100%;
        margin-bottom: 0.5rem;
        border-radius: 0.375rem;
        text-align: center;
    }

    .input-group .form-control {
        border-radius: 0.375rem !important;
    }
}

/* Checkboxes et radio buttons */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-left: 0;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.form-check-label {
    margin-bottom: 0;
    cursor: pointer;
}

.form-check-inline {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}

@media (max-width: 575px) {
    .form-check-inline {
        display: flex;
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* Switch toggles */
.form-switch {
    padding-left: 2.5rem;
}

.form-switch .form-check-input {
    width: 2rem;
    margin-left: -2.5rem;
}

@media (max-width: 575px) {
    .form-switch {
        padding-left: 3rem;
    }

    .form-switch .form-check-input {
        width: 2.5rem;
        height: 1.5rem;
        margin-left: -3rem;
    }
}

/* File uploads */
.form-file-input {
    padding: 0.5rem;
    cursor: pointer;
}

.file-upload-preview {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.file-preview-item {
    position: relative;
    width: 150px;
    height: 150px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
}

@media (max-width: 767px) {
    .file-preview-item {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 575px) {
    .file-preview-item {
        width: calc(50% - 0.5rem);
        height: 100px;
    }
}

/* Form validation */
.invalid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.valid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #28a745;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #28a745;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Form actions/buttons */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

@media (max-width: 767px) {
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 575px) {
    .form-actions {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
}

/* Multi-column forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row.three-columns {
    grid-template-columns: repeat(3, 1fr);
}

.form-row.four-columns {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 991px) {
    .form-row.three-columns,
    .form-row.four-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .form-row,
    .form-row.three-columns,
    .form-row.four-columns {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* Form sections */
.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
    color: #212529;
}

@media (max-width: 767px) {
    .form-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .form-section-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
}

@media (max-width: 575px) {
    .form-section {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    .form-section-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
}

/* Wizard/Multi-step forms */
.form-wizard {
    width: 100%;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0;
    list-style: none;
}

.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 1rem 0.5rem;
}

.wizard-step::after {
    content: '';
    position: absolute;
    top: 2rem;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #dee2e6;
    z-index: 0;
}

.wizard-step:last-child::after {
    display: none;
}

.wizard-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.wizard-step.active .wizard-step-number {
    background: var(--primary-color, #f27a1a);
    color: white;
}

.wizard-step.completed .wizard-step-number {
    background: #28a745;
    color: white;
}

.wizard-step-label {
    display: block;
    font-size: 0.875rem;
    color: #6c757d;
}

.wizard-step.active .wizard-step-label {
    color: var(--primary-color, #f27a1a);
    font-weight: 600;
}

@media (max-width: 767px) {
    .wizard-steps {
        flex-wrap: wrap;
        margin-bottom: 1.5rem;
    }

    .wizard-step {
        flex-basis: 50%;
        padding: 0.75rem 0.25rem;
    }

    .wizard-step-number {
        width: 35px;
        height: 35px;
        font-size: 0.875rem;
    }

    .wizard-step-label {
        font-size: 0.75rem;
    }

    .wizard-step::after {
        top: 1.5rem;
    }
}

@media (max-width: 575px) {
    .wizard-steps {
        flex-direction: column;
    }

    .wizard-step {
        flex-basis: 100%;
        text-align: left;
        padding-left: 1rem;
    }

    .wizard-step::after {
        top: 50%;
        left: 1.25rem;
        width: 2px;
        height: 100%;
    }

    .wizard-step-number {
        margin-right: 1rem;
    }

    .wizard-step-label {
        display: inline-block;
        vertical-align: middle;
    }
}

/* Search and filter forms */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-form .form-control {
    flex: 1;
}

.search-form .btn {
    flex-shrink: 0;
}

@media (max-width: 575px) {
    .search-form {
        flex-direction: column;
    }

    .search-form .btn {
        width: 100%;
    }
}

/* Filter groups */
.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.375rem;
}

@media (max-width: 767px) {
    .filter-form {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.75rem;
    }
}

/* Inline forms */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.form-inline .form-group {
    margin-bottom: 0;
}

.form-inline .form-label {
    margin-bottom: 0;
    margin-right: 0.5rem;
}

@media (max-width: 767px) {
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .form-group {
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .form-inline .form-label {
        margin-bottom: 0.25rem;
    }
}

/* Range inputs */
.range-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.range-input-group .form-control {
    flex: 1;
}

.range-input-group .range-separator {
    flex-shrink: 0;
    color: #6c757d;
}

@media (max-width: 575px) {
    .range-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .range-input-group .range-separator {
        text-align: center;
        padding: 0.25rem 0;
    }
}

/* Color picker */
input[type="color"] {
    height: 40px;
    width: 80px;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    cursor: pointer;
}

@media (max-width: 575px) {
    input[type="color"] {
        width: 100%;
    }
}

/* Date and time pickers */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    padding: 0.625rem 0.75rem;
}

@media (max-width: 767px) {
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"] {
        font-size: 1rem;
    }
}

/* Help text */
.form-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

@media (max-width: 575px) {
    .form-text {
        font-size: 0.8rem;
    }
}

/* Floating labels */
.form-floating {
    position: relative;
}

.form-floating > .form-control {
    height: calc(3.5rem + 2px);
    padding: 1rem 0.75rem;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 1rem 0.75rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

@media (max-width: 575px) {
    .form-floating > .form-control {
        height: calc(3rem + 2px);
    }
}

/* Number inputs with steppers */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-input-group {
    display: flex;
    align-items: stretch;
}

.number-input-group .form-control {
    flex: 1;
    text-align: center;
    border-radius: 0;
}

.number-input-group .btn-stepper {
    width: 40px;
    padding: 0;
    font-size: 1.25rem;
    border: 1px solid #ced4da;
}

.number-input-group .btn-stepper:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.number-input-group .btn-stepper:last-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

@media (max-width: 575px) {
    .number-input-group .btn-stepper {
        width: 45px;
        font-size: 1.5rem;
    }
}
