﻿/* ========================================
   Professional Form Styling for Orchard Core
   ======================================== */

/* Form Container */
.form-content {
    max-width: 1200px;
    margin: 0;
    margin-left: 0;
    padding: 2rem;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Form alignment - align content to the left */
.form-form {
    width: 100%;
    margin: 0;
}

    /* Ensure proper clearing for form sections */
    .form-form::after {
        content: "";
        display: table;
        clear: both;
    }

/* Form Title Styling */
.form-content h1,
.form-content h2 {
    color: #2c3e50;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #3498db;
}

/* Widget Layout */
.widget {
    margin-bottom: 1.25rem;
}

.widget-body {
    position: relative;
}

/* Form Labels */
.form-label {
    display: block;
    font-weight: 500;
    color: #34495e;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

    .form-label::after {
        content: '';
        display: inline-block;
    }

    /* Required field indicator (optional - add data-required attribute) */
    [required] + .form-label::after,
    .form-label.required::after {
        content: ' *';
        color: #e74c3c;
        font-weight: 600;
    }

/* Input Fields */
.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .form-control:focus {
        color: #495057;
        background-color: #fff;
        border-color: #3498db;
        outline: 0;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
    }

    .form-control:hover:not(:focus) {
        border-color: #a8b3c0;
    }

/* Select Dropdowns */
.form-select {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;
}

    .form-select:focus {
        border-color: #3498db;
        outline: 0;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
    }

    .form-select:hover:not(:focus) {
        border-color: #a8b3c0;
    }

/* Textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}



/* DateTime Input */
input[type="datetime-local"].form-control {
    padding-right: 0.5rem;
}

/* Button Styling */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 4px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.btn-primary {
    color: #fff;
    background-color: #3498db;
    border-color: #3498db;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

    .btn-primary:hover {
        background-color: #2980b9;
        border-color: #2472a4;
        box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
        transform: translateY(-1px);
    }

    .btn-primary:active {
        background-color: #2472a4;
        border-color: #1f5f8b;
        transform: translateY(0);
    }

    .btn-primary:focus {
        outline: 0;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.25);
    }

/* Widget Size Classes */
.widget-size-100 {
    width: 100%;
    clear: both;
}

.widget-size-50 {
    width: 100%;
    float: left;
    clear: none;
}

@media (min-width: 768px) {
    .widget-size-50 {
        width: 48.5%;
    }

        .widget-size-50:nth-of-type(odd) {
            margin-right: 3%;
            clear: left;
        }

        .widget-size-50:nth-of-type(even) {
            clear: none;
        }
}

/* Ensure Status and Approver fields align properly */
.widget-size-50.widget-select {
    box-sizing: border-box;
}

/* Flow Section */
.flow {
    display: block;
}

    .flow::after {
        content: "";
        display: table;
        clear: both;
    }

/* Disabled State */
.form-control:disabled,
.form-select:disabled {
    background-color: #e9ecef;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error States */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #e74c3c;
}

    .form-control.is-invalid:focus,
    .form-select.is-invalid:focus {
        border-color: #e74c3c;
        box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
    }

.invalid-feedback {
    display: block;
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success States */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #27ae60;
}

    .form-control.is-valid:focus,
    .form-select.is-valid:focus {
        border-color: #27ae60;
        box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.15);
    }

/* Fieldset Groups */
fieldset {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

    fieldset legend {
        font-weight: 600;
        font-size: 1.1rem;
        color: #2c3e50;
        padding: 0 0.5rem;
        width: auto;
        margin-bottom: 0;
    }

/* Button Container */
.widget-button {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

/* Responsive Design */
@media (max-width: 767px) {
    .form-content {
        padding: 1.25rem;
    }

    .widget-size-50 {
        width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        float: none !important;
        clear: both !important;
    }

    .btn {
        width: 100%;
    }
}

/* Loading State */
.form-content.loading {
    opacity: 0.6;
    pointer-events: none;
}

    .form-content.loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 40px;
        height: 40px;
        margin: -20px 0 0 -20px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid #3498db;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Help Text */
.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
}

    .input-group .form-control {
        flex: 1;
    }

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    font-weight: 400;
    color: #495057;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* Accessibility Improvements */
.form-control:focus-visible,
.form-select:focus-visible,
.btn:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .form-content {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .btn {
        display: none;
    }
}
