
/* =========================================================
   LEGAL MANAGEMENT SYSTEM
   File: css/new_entry.css
   Professional Responsive Form Design
   Desktop: Vertical form scrolling
   Mobile: Vertical scrolling + sticky save button
   Primary: #3b527c
   Dark: #283957
   Accent: #f80707
   ========================================================= */

/* =========================
   GLOBAL BOX SIZING
========================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    color: #283957;
    background: #f4f6fa;
}

/* =========================
   HEADER / MENU / REPORT
========================= */
.header,
.menu,
.report {
    flex-shrink: 0;
}

.main-header {
    flex-shrink: 0;
    width: 100%;
    z-index: 100;
}

/* =========================
   PAGE LAYOUT
========================= */
.page-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

/* =========================
   TITLE
========================= */
.menu_item {
    margin: 10px;
    color: #f80707;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.35);
}

.menu_item h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
}

/* =========================
   REPORT TITLE
========================= */
.report {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    font-size: 20px;
    font-weight: 600;
    color: #f80707;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.35);
}

/* =========================
   FORM ROW
   Desktop: Internal vertical
   scrolling without horizontal
   scrollbar
========================= */
.formrow {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #9ba9bd #edf0f5;
}

/* Chrome / Edge / Safari scrollbar */
.formrow::-webkit-scrollbar {
    width: 8px;
}

.formrow::-webkit-scrollbar-track {
    background: #edf0f5;
    border-radius: 10px;
}

.formrow::-webkit-scrollbar-thumb {
    background: #9ba9bd;
    border-radius: 10px;
}

.formrow::-webkit-scrollbar-thumb:hover {
    background: #3b527c;
}

/* =========================
   FORM CARD
========================= */
.form {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #e5eaf1;
    border-radius: 14px;
    box-shadow: 0 5px 20px rgba(40, 57, 87, 0.09);
}

/* =========================
   FIELD GROUP
========================= */
.details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* =========================
   LABEL
========================= */
.details label,
.label {
    display: block;
    margin: 0;
    color: #283957;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* =========================
   STANDARD INPUT
========================= */
.details input:not(.dropdown_search):not(.date_input),
.details select:not(.dropdown_search):not(.date_input) {
    display: block;
    width: 80%;
    max-width: 100%;
    min-width: 0;
    height: 46px;
    padding: 10px 12px;
    color: #283957;
    background: #fcfdff;
    border: 1px solid #cbd3df;
    border-radius: 7px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease,
                background 0.2s ease;
}

/* =========================
   DATE INPUT
========================= */
.details .date_input {
    display: block;
    width: 40%;
    max-width: 100%;
    min-width: 0;
    height: 46px;
    padding: 8px 10px;
    color: #283957;
    background: #fcfdff;
    border: 1px solid #cbd3df;
    border-radius: 7px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease;
}

/* =========================
   DROPDOWN
========================= */
.details .dropdown_search {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 46px;
    padding: 8px 12px;
    color: #283957;
    background: #fcfdff;
    border: 1px solid #cbd3df;
    border-radius: 7px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease;
}

/* =========================
   FOCUS EFFECT
========================= */
.details input:focus,
.details select:focus,
.details textarea:focus,
textarea:focus {
    outline: none;
    border-color: #3b527c;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 82, 124, 0.13);
}

/* =========================
   DISABLED INPUT
========================= */
.details input:disabled,
.details select:disabled,
.details textarea:disabled {
    background: #eef1f5;
    color: #788496;
    cursor: not-allowed;
}

/* =========================
   TEXTAREA
========================= */
textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 120px;
    padding: 12px;
    resize: vertical;
    color: #283957;
    background: #fcfdff;
    border: 1px solid #cbd3df;
    border-radius: 7px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

/* =========================
   BUTTON CONTAINERS
========================= */
.legal_button,
.button {
    margin-top: 18px;
}

/* =========================
   SAVE BUTTON
========================= */
.newlegalsubmit,
.newsubmit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 28px;
    border: 1px solid #3b527c;
    border-radius: 8px;
    background: #3b527c;
    color: #ffffff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease,
                transform 0.1s ease;
}

.newlegalsubmit:hover,
.newsubmit:hover {
    background: #283957;
    border-color: #283957;
    box-shadow: 0 3px 8px rgba(40, 57, 87, 0.18);
}

.newlegalsubmit:active,
.newsubmit:active {
    transform: scale(0.98);
}

.newlegalsubmit:focus-visible,
.newsubmit:focus-visible,
.court-new-button:focus-visible {
    outline: 3px solid rgba(59, 82, 124, 0.3);
    outline-offset: 2px;
}

/* =========================
   COURT ROW
========================= */
.court-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.court-row .dropdown {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.court-new-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 65px;
    min-height: 38px;
    padding: 0 16px;
    border: none;
    border-radius: 6px;
    background: #3b527c;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease,
                transform 0.1s ease;
}

.court-new-button:hover {
    background: #283957;
}

.court-new-button:active {
    transform: scale(0.97);
}

/* =========================
   SIDEBAR OVERLAY
   Compatible with existing menu
========================= */
.sidebar-overlay {
    display: none;
}

/* =========================
   TABLET
========================= */
@media (min-width: 769px) and (max-width: 1024px) {

    .formrow {
        padding: 16px;
    }

    .form {
        max-width: 620px;
        padding: 24px;
    }

    .details input:not(.dropdown_search):not(.date_input),
    .details select:not(.dropdown_search):not(.date_input) {
        width: 90%;
    }

    .details .date_input {
        width: 50%;
    }
}

/* =========================
   MOBILE RESPONSIVE
========================= */
@media (max-width: 768px) {

    html,
    body {
        width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .page-layout {
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        overflow: hidden;
    }

    /* Form area owns vertical scrolling */
    .formrow {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
        min-height: 0;
        height: auto;
        padding: 12px;
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-gutter: auto;
        scrollbar-width: thin;
    }

    .formrow::-webkit-scrollbar {
        width: 5px;
    }

    .form {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 18px 16px 24px;
        border-radius: 10px;
        box-shadow: 0 3px 12px rgba(40, 57, 87, 0.08);
    }

    /* Keep field widths consistent on mobile */
    .details {
        width: 100%;
        gap: 7px;
    }

    .details label,
    .label {
        font-size: 14px;
    }

    .details input:not(.dropdown_search):not(.date_input),
    .details select:not(.dropdown_search):not(.date_input),
    .details .date_input,
    .details .dropdown_search {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: 46px;
        padding: 9px 11px;
        font-size: 14px;
    }

    /* Sticky save area */
    .legal_button {
        position: sticky;
        bottom: -1px;
        z-index: 20;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
        margin-top: 18px;
        padding: 12px 0 4px;
        background: #ffffff;
        border-top: 1px solid #e1e6ee;
    }

    .newlegalsubmit,
    .newsubmit {
        width: 100%;
        min-height: 46px;
        padding: 12px 18px;
        font-size: 16px;
    }

    .button {
        width: 100%;
    }

    textarea {
        width: 100%;
        min-height: 110px;
    }

    .court-row {
        gap: 6px;
    }

    .court-row .dropdown {
        flex: 1 1 auto;
        width: 0;
        min-width: 0;
    }

    .court-new-button {
        min-width: 60px;
        padding: 0 12px;
    }

    .menu_item {
        margin: 8px;
    }

    .menu_item h1 {
        font-size: 18px;
    }

    .report {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        font-size: 17px;
    }
}

/* =========================
   SMALL MOBILE
========================= */
@media (max-width: 380px) {

    .formrow {
        padding: 8px;
    }

    .form {
        padding: 15px 12px 20px;
    }

    .details label,
    .label {
        font-size: 13px;
    }

    .details input:not(.dropdown_search):not(.date_input),
    .details select:not(.dropdown_search):not(.date_input),
    .details .date_input,
    .details .dropdown_search {
        font-size: 13px;
    }

    .newlegalsubmit,
    .newsubmit {
        font-size: 15px;
    }
}

/* =========================
   REDUCED MOTION
========================= */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
