﻿/* =====================================================
   PRIME PRESS LMS - FORMS (OLD DESIGN RESTORED)
   Classic form styling matching old layout
   ===================================================== */

/* ===== OLD STYLE FORMS ===== */
.form-group {
    margin-bottom: 15px;
    position: relative;
}

.form-label,
.col-form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

    .form-label.required::after {
        content: '*';
        color: #dc2626;
        margin-left: 4px;
    }

.form-input,
.form-control,
.form-select,
.form-textarea {
    width: 100%;
    height: 30px;
    padding: 2px 10px;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    background: linear-gradient(to bottom, beige, white);
    border: 1px dotted rgba(0, 0, 0, 0.2);
    border-radius: 0;
    transition: all 0.3s ease;
    margin-bottom: 2px;
    outline: none;
}

    .form-input:hover,
    .form-control:hover,
    .form-select:hover {
        border-color: rgba(0, 0, 0, 0.3);
    }

    .form-input:focus,
    .form-control:focus,
    .form-select:focus,
    .form-textarea:focus {
        border-color: beige;
        border-bottom: 2px solid #a97e5b;
        background: linear-gradient(to top, #d2b48c, #f5f5dc);
        outline: none;
    }

    .form-input::placeholder,
    .form-control::placeholder {
        color: #999;
    }

    .form-input[readonly],
    .form-control[readonly],
    input[readonly] {
        background-color: #f0f0f0;
        color: #999;
        border: 1px solid #ccc;
        cursor: not-allowed;
    }

.form-textarea {
    min-height: 80px;
    height: auto;
    resize: vertical;
    padding: 8px 10px;
}

/* Select styling */
.form-select,
select.form-control {
    cursor: pointer;
    background: linear-gradient(to bottom, beige, white);
    appearance: auto;
    padding-right: 30px;
}

/* =====================================================
   BUTTONS — UNIFIED GOLDEN + NAVY SLIDE ANIMATION

   METHOD: background-size + background-position
   ─────────────────────────────────────────────
   A gradient 200% wide: navy on the left, gold on the right.

   Default → background-position: right  (gold visible)
   Hover   → background-position: left   (navy slides in)

   Text is just color:#fff on the element itself.
   No ::before, no z-index, no overflow conflict — ever.
   ===================================================== */

body .btn,
body .btn-primary,
body .btn-secondary,
body .dt-button,
body a.btn,
body a.btn-primary,
body a.btn-secondary,
body button.btn,
body button.btn-primary,
body button.btn-secondary,
body input.btn,
body input.btn-primary {
    display: inline-block;
    text-align: center;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    vertical-align: middle;
    border: 1px solid #c3a177;
    border-radius: 5px;
    cursor: pointer;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    /* Slide animation via background */
    background: linear-gradient(to right, #022c53, #c3a177);
    background-size: 200% 100%;
    background-position: right center;
    transition: background-position 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease, transform 0.15s ease;
    box-shadow: 0 2px 6px rgba(195, 161, 119, 0.35);
}

    /* ─── HOVER ─── */
    body .btn:hover,
    body .btn-primary:hover,
    body .btn-secondary:hover,
    body .dt-button:hover,
    body a.btn:hover,
    body a.btn-primary:hover,
    body a.btn-secondary:hover,
    body button.btn:hover,
    body button.btn-primary:hover,
    body button.btn-secondary:hover,
    body input.btn:hover,
    body input.btn-primary:hover {
        background-position: left center;
        border-color: #022c53;
        color: #ffffff;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(2, 44, 83, 0.4);
    }

    /* ─── ACTIVE ─── */
    body .btn:active,
    body .btn-primary:active,
    body .btn-secondary:active,
    body .dt-button:active,
    body a.btn:active,
    body a.btn-primary:active,
    body a.btn-secondary:active,
    body button.btn:active,
    body button.btn-primary:active,
    body button.btn-secondary:active {
        transform: translateY(1px);
        box-shadow: 0 1px 3px rgba(2, 44, 83, 0.3);
    }

    /* ─── FOCUS ─── */
    body .btn:focus,
    body .btn-primary:focus,
    body .btn-secondary:focus,
    body .dt-button:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(195, 161, 119, 0.4);
    }

    /* ─── DISABLED ─── */
    body .btn:disabled,
    body .btn-primary:disabled,
    body .btn-secondary:disabled,
    body .dt-button:disabled,
    body .btn.disabled,
    body .btn-primary.disabled,
    body .btn-secondary.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
        box-shadow: none;
    }

/* ===== BUTTON CONTAINER ===== */
.button-container {
    width: auto;
    max-width: 80%;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
}

/* ===== FORM ROWS ===== */
.form-row,
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

    .form-row > [class*="col"],
    .row > [class*="col"] {
        padding: 0 8px;
    }

/* ===== FILTER FORM ===== */
.form-group.mb-3 .row,
.form-group.row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

    .form-group .row .p-0 {
        padding: 0 8px !important;
    }

    .form-group.mb-3 .row .col-md-2,
    .form-group.row .col-md-2 {
        flex: 0 0 150px;
        max-width: 150px;
        padding-right: 10px !important;
    }

        .form-group.mb-3 .row .col-md-2:nth-child(2),
        .form-group.row .col-md-2:nth-child(2) {
            flex: 0 0 150px;
            max-width: 150px;
        }

    .form-group.mb-3 .row .col-md-3,
    .form-group.row .col-md-3 {
        flex: 1;
        max-width: 300px;
    }

    .form-group.row .col-md-4 {
        flex: 0 0 auto;
        padding-right: 10px !important;
    }

    .form-group.mb-3 .row .col-md-3 .form-control.mb-2,
    .form-group.row .col-md-3 .form-control:first-child {
        margin-bottom: 8px !important;
    }

    .form-group.mb-3 .row .col-md-3,
    .form-group.row .col-md-3 {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

        .form-group.row .col-md-3:has(input:only-of-type) {
            display: block;
        }

/* ===== CHECKBOX STYLING ===== */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.form-check-label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
    margin: 0;
}

/* ===== INPUT GROUPS ===== */
.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

    .input-group .form-input,
    .input-group .form-control {
        flex: 1;
        border-radius: 0;
    }

.input-group-text {
    padding: 2px 10px;
    background: #f0f0f0;
    border: 1px dotted rgba(0, 0, 0, 0.2);
    color: #666;
    font-size: 14px;
    display: flex;
    align-items: center;
}

/* ===== FORM VALIDATION ===== */
.form-error,
.text-danger,
.field-validation-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.field-validation-valid {
    display: none;
}

.is-invalid {
    border-color: #dc2626 !important;
}

.is-valid {
    border-color: #16a34a !important;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.card-header {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #022c53;
    margin: 0;
}

.card-body {
    padding: 12px 0;
}

.card-footer {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
}

.alert-success {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #78350f;
}

.alert-error,
.alert-danger {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    white-space: nowrap;
}

.badge-primary {
    background: #022c53;
    color: white;
}

.badge-gold {
    background: #c3a177;
    color: white;
}

.badge-success {
    background: #16a34a;
    color: white;
}

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-error {
    background: #dc2626;
    color: white;
}

/* ===== COLLAPSE SECTION ===== */
#collapseSection .card {
    background: #fafafa;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ===== SELECT2 STYLING ===== */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    height: 30px;
    border: 1px dotted rgba(0, 0, 0, 0.2);
    background: linear-gradient(to bottom, beige, white);
    border-radius: 0;
}

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 28px;
        padding-left: 10px;
        font-size: 14px;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 28px;
    }

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: beige;
    border-bottom: 2px solid #a97e5b;
    background: linear-gradient(to top, #d2b48c, #f5f5dc);
}

.select2-container--default .select2-selection--multiple {
    min-height: 30px;
    padding: 2px 5px;
}

    .select2-container--default .select2-selection--multiple .select2-selection__choice {
        background: #c3a177;
        border: none;
        color: white;
        border-radius: 3px;
        padding: 2px 8px;
        margin: 2px;
        font-size: 12px;
    }

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
    .form-group.mb-3 .row,
    .form-group.row {
        flex-wrap: wrap;
    }

        .form-group.mb-3 .row .col-md-2,
        .form-group.mb-3 .row .col-md-3,
        .form-group.row .col-md-2,
        .form-group.row .col-md-3,
        .form-group.row .col-md-4 {
            flex: 1 1 100%;
            max-width: 100%;
        }

    .button-container {
        max-width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .card {
        padding: 15px;
    }

    body .btn,
    body .btn-primary,
    body .btn-secondary,
    body .dt-button {
        padding: 6px 14px;
        font-size: 13px;
    }
}

/* =====================================================
   COMPACT FILTER FORM
   ===================================================== */

#filterForm {
    margin: 0;
    padding: 0;
}

    #filterForm .form-group {
        margin-bottom: 0 !important;
        padding: 0;
    }

        #filterForm .form-group.row {
            margin-bottom: 0 !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
            gap: 5px;
            align-items: center;
        }

    #filterForm .row {
        row-gap: 0 !important;
        margin-bottom: 0 !important;
    }

    #filterForm label,
    #filterForm .col-form-label {
        margin-bottom: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        font-size: 13px;
        font-weight: 600;
        color: #333;
        line-height: 28px;
    }

    #filterForm .form-control,
    #filterForm .form-select,
    #filterForm .form-control-sm,
    #filterForm .form-select-sm {
        margin-bottom: 0 !important;
        padding: 2px 8px;
        font-size: 13px;
        height: 28px;
    }

        #filterForm .form-control.mb-2 {
            margin-bottom: 0 !important;
        }

    #filterForm .col-md-2,
    #filterForm .col-md-3,
    #filterForm .col-md-4 {
        padding-left: 3px !important;
        padding-right: 3px !important;
        margin-bottom: 0 !important;
    }

    #filterForm .p-0 {
        padding-left: 3px !important;
        padding-right: 3px !important;
    }

    #filterForm .col-md-3 {
        display: flex;
        flex-direction: column;
        gap: 0 !important;
    }

    #filterForm .form-group.row:last-child {
        margin-top: 8px !important;
        padding-top: 8px !important;
        border-top: 1px solid #e5e7eb;
    }

    #filterForm button {
        padding: 5px 14px;
        font-size: 13px;
        height: 28px;
        line-height: 1.2;
    }

#collapseSection {
    margin-bottom: 5px;
}

    #collapseSection .card {
        padding: 10px !important;
        margin-bottom: 0;
    }

    #collapseSection .card-body {
        padding: 8px !important;
    }

#filterForm .mb-3 {
    margin-bottom: 0 !important;
}

#filterForm .select2-container--default .select2-selection--single {
    height: 28px !important;
}

    #filterForm .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 26px !important;
        font-size: 13px !important;
    }

    #filterForm .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 26px !important;
    }

#filterForm .form-group + .form-group {
    margin-top: 0 !important;
}

#filterForm > .form-group.row {
    border-bottom: 1px solid transparent;
}

@media (max-width: 968px) {
    #filterForm .form-group.row {
        flex-wrap: wrap;
        gap: 3px;
    }

    #filterForm .col-md-2,
    #filterForm .col-md-3,
    #filterForm .col-md-4 {
        flex: 1 1 100%;
        max-width: 100%;
        margin-bottom: 3px !important;
    }
}
