﻿/*
    ============================================================
    Common Form Styles
    ============================================================

    Used by:
        - Agent Forms
        - Customer Forms
        - Employee Forms
        - Other application forms

    Responsive breakpoints:
        Mobile  : < 576px
        Tablet  : 576px - 767px
        Desktop : >= 768px
*/


/* ============================================================
   FORM CONTAINER
   ============================================================ */

.app-form-container {
    width: 100%;
    margin: auto;
    padding: 25px;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}


/* ============================================================
   FORM HEADER
   ============================================================ */

.app-form-header {
    margin-bottom: 20px;
}

    .app-form-header h2 {
        margin-bottom: 4px;
        font-weight: 600;
        color: #212529;
    }

    .app-form-header p {
        margin-bottom: 0;
        color: #6c757d;
    }


/* ============================================================
   FORM LABELS
   ============================================================ */

.app-form-container .form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #343a40;
}


/* ============================================================
   INPUTS / SELECTS / TEXTAREAS
   ============================================================ */

.app-form-container .form-control,
.app-form-container .form-select {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
}

.app-form-container textarea.form-control {
    min-height: 100px;
    resize: vertical;
}


/* ============================================================
   INPUT FOCUS
   ============================================================ */

.app-form-container .form-control:focus,
.app-form-container .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}


/* ============================================================
   VALIDATION
   ============================================================ */

.app-form-container .field-validation-error {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
    color: #dc3545;
}

.app-form-container .validation-summary-errors {
    margin-bottom: 20px;
}


/* ============================================================
   FORM ACTIONS
   ============================================================ */

.app-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}


/* ============================================================
   MOBILE / TABLET
   ============================================================ */

@media (max-width: 768px) {

    .app-form-container {
        margin: 20px auto;
        padding: 20px;
    }

    .app-form-actions {
        justify-content: stretch;
    }

        .app-form-actions .btn {
            flex: 1;
        }
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 576px) {

    .app-form-container {
        margin: 10px auto;
        padding: 15px;
        border-radius: 6px;
        box-shadow: none;
    }

    .app-form-header h2 {
        font-size: 1.5rem;
    }

    .app-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

        .app-form-actions .btn {
            width: 100%;
        }
}


/* ============================================================
   DATA GRID
   ============================================================ */

.app-data-grid-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}


/* ============================================================
   DATA GRID TABLE
   ============================================================ */

.app-data-grid {
    width: 100%;
    min-width: 850px;
    margin-bottom: 0;
    vertical-align: middle;
}


    /* ============================================================
   TABLE HEADER
   ============================================================ */

    .app-data-grid thead th {
        padding: 12px 15px;
        background-color: #f8f9fa;
        color: #495057;
        font-size: 0.875rem;
        font-weight: 600;
        white-space: nowrap;
        border-bottom: 2px solid #dee2e6;
    }


    /* ============================================================
   TABLE BODY
   ============================================================ */

    .app-data-grid tbody td {
        padding: 14px 15px;
        color: #343a40;
        white-space: nowrap;
    }


    /* ============================================================
   ROW HOVER
   ============================================================ */

    .app-data-grid tbody tr:hover {
        background-color: #f8f9fa;
    }


/* ============================================================
   ACTION BUTTONS
   ============================================================ */

.app-grid-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    white-space: nowrap;
}


/* ============================================================
   STATUS BADGES
   ============================================================ */

.app-data-grid .badge {
    min-width: 70px;
    padding: 6px 10px;
    font-weight: 500;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 576px) {

    .app-data-grid {
        min-width: 800px;
    }

        .app-data-grid thead th,
        .app-data-grid tbody td {
            padding: 10px 12px;
        }
}

/* ============================================================
   COMPACT SEARCH INPUT
   ============================================================ */

.app-grid-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}


/* Search container */

.app-grid-search {
    width: 100%;
    max-width: 400px;
}


/* Input + button wrapper */

.app-search-input {
    position: relative;
    width: 100%;
}


    /* Search textbox */

    .app-search-input .form-control {
        width: 100%;
        min-height: 42px;
        padding-right: 45px;
    }


/* Search icon button */

.app-search-button {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}


    /* Hover */

    .app-search-button:hover {
        background-color: #f1f3f5;
        color: #0d6efd;
    }


    /* Focus */

    .app-search-button:focus {
        outline: none;
        color: #0d6efd;
    }


/* Clear button */

.app-clear-search {
    white-space: nowrap;
}


/* Result count */

.app-grid-count {
    margin-left: auto;
    color: #6c757d;
    font-size: 0.9rem;
    white-space: nowrap;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 576px) {

    .app-grid-toolbar {
        flex-wrap: wrap;
    }

    .app-grid-search {
        max-width: none;
        flex: 1 1 100%;
    }

    .app-clear-search {
        flex: 0 0 auto;
    }

    .app-grid-count {
        margin-left: auto;
    }
}
