/* ========================================
   ATSK TRANSPORT WEB - LEGACY MODAL SYSTEM
   Uses CSS custom properties from _design-tokens.css
   Note: For new modals, use Modal.razor component
   ======================================== */

.custom-modal-layout {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    box-shadow: var(--shadow-2xl);
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.modal-s {
    width: 500px;
}

.modal-m {
    width: 800px;
}

.modal-l {
    width: 1100px;
}

.modal-dialog {
    margin-top: 0px;
    margin-bottom: 0px;
}

.custom-modal-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-primary) 100%);
    font-family: var(--font-family-base);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xl);
    border-top-left-radius: var(--radius-2xl);
    border-top-right-radius: var(--radius-2xl);
    height: 89px;
    border-bottom: 1px solid var(--color-border-primary);
    padding-left: var(--space-8);
    position: relative;
}

.custom-modal-header h5 {
    margin-bottom: 0;
    color: var(--color-text-primary);
}

.custom-modal-header button {
    margin: var(--space-8);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-primary);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: var(--transition-normal);
}

.custom-modal-header button:hover {
    background: var(--color-bg-primary);
    border-color: var(--color-border-secondary);
    color: var(--color-text-primary);
}

.custom-modal-body {
    display: flex;
    background-color: var(--color-bg-primary);
    font-family: var(--font-family-base);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-md);
    height: 100%;
    padding: var(--space-8);
    color: var(--color-text-primary);
}

.custom-modal-body-matrix {
    display: flex;
    background-color: var(--color-bg-primary);
    font-family: var(--font-family-base);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-md);
    height: 100%;
    padding: var(--space-8);
}

.modal-s .custom-modal-body {
    display: flex;
    background-color: var(--color-bg-primary);
    font-family: var(--font-family-base);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-md);
    height: 100%;
    padding: var(--space-12) var(--space-8);
}

.modal-s .custom-modal-body form {
    width: 100%;
}

.modal-s .custom-modal-body form > .row {
    --bs-gutter-x: 10px;
    margin-right: -10px;
    margin-left: -10px;
}

.modal-s .custom-modal-body form > .row > * {
    padding-right: 10px;
    padding-left: 10px;
}

.modal-s .custom-modal-body form > .row:last-child > div:last-child .input-wrapper {
    margin-bottom: 0;
}

.modal-m .custom-modal-body form,
.modal-l .custom-modal-body form {
    width: 100%;
}

.custom-modal-body-padding {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
}

.yes-no-modal-body {
    justify-content: left;
    align-items: center;
}

.yes-no-modal-body label {
    padding: var(--space-4) 0;
    color: var(--color-text-primary);
}

.deleteLabel {
    width: 436px;
    color: var(--color-text-primary);
}

.custom-modal-footer {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-4);
    background: var(--color-bg-secondary);
    border-bottom-left-radius: var(--radius-2xl);
    border-bottom-right-radius: var(--radius-2xl);
    border-top: 1px solid var(--color-border-primary);
    height: 89px;
    padding: 0 var(--space-8);
}

.custom-modal-footer button {
    margin: 0;
}

.modal-header {
    display: none;
}

.modal-content {
    background-color: transparent;
    border: none;
    flex-wrap: wrap;
    align-content: center;
}

/* ========================================
   RESPONSIVE - Mobile (< 768px)
   ======================================== */

@media screen and (max-width: 768px) {
    .custom-modal-layout.modal-s {
        margin: var(--space-5) 0;
        width: 100%;
        display: inline-flex;
    }

    .custom-modal-layout.full-screen-mobile.modal-s {
        margin: 0;
        width: 100%;
        display: inline-flex;
    }

    .custom-modal-layout.modal-s .deleteLabel {
        width: auto;
    }

    .custom-modal-layout.modal-s .yes-no-modal-body {
        justify-content: left;
        padding: var(--space-8) var(--space-5);
    }

    .yes-no-modal-body label {
        padding: 0;
    }

    .custom-modal-layout.modal-s .custom-modal-header {
        height: auto;
        padding-left: var(--space-5);
    }

    .custom-modal-layout.modal-s .custom-modal-header button {
        width: 40px;
        height: 40px;
    }

    .custom-modal-layout.modal-s .custom-modal-header h5 {
        margin-bottom: 0;
    }

    .custom-modal-layout.modal-s .custom-modal-header button {
        margin: var(--space-4);
    }

    .modal-content {
        width: 100%;
        height: 100%;
        top: 0;
        position: fixed;
    }

    .modal {
        --bs-modal-margin: 0.5rem;
        --bs-modal-width: 100%;
    }

    .custom-modal-header label {
        margin: var(--space-4) var(--space-5);
        font-size: var(--font-size-md);
        line-height: var(--line-height-tight);
    }

    .custom-modal-header button {
        margin: var(--space-4) var(--space-5);
        width: 40px;
        height: 40px;
    }

    .custom-modal-layout .gridContainers {
        margin: 0px var(--space-5);
    }

    .custom-modal-layout {
        width: 100%
    }

    #custom-modal-body-id {
        justify-content: flex-start;
    }

    .modal-dialog .modal-dialog-centered {
        margin: 0;
    }

    .modal-dialog.modal-dialog-centered:has(.modal-s),
    .modal-dialog.modal-dialog-centered:has(.modal-l) {
        margin: 0;
    }

    .modal-body:has(.modal-s) {
        padding: 0;
        width: 320px;
        align-content: center;
    }
}

/* ========================================
   RESPONSIVE - Tablet (< 800px)
   ======================================== */

@media screen and (max-width: 800px) {
    .modal-content:has(.modal-m),
    .modal-content:has(.full-screen-mobile) {
        width: 100%;
        height: 100%;
        top: 0;
        position: fixed;
    }

    .modal:has(.modal-m),
    .modal:has(.full-screen-mobile) {
        --bs-modal-margin: 0.5rem;
        --bs-modal-width: 100%;
    }

    .modal-m .custom-modal-header,
    .full-screen-mobile .custom-modal-header {
        height: 68px;
    }

    .modal-m .modalContainer,
    .full-screen-mobile .modalContainer {
        height: calc(100vh - 156px);
        overflow-y: auto;
        overflow-x: hidden;
    }

    .modal-m .custom-modal-header label,
    .full-screen-mobile .custom-modal-header label {
        margin: var(--space-4) var(--space-5);
        font-size: var(--font-size-md);
        line-height: var(--line-height-tight);
    }

    .modal-m .custom-modal-header button,
    .full-screen-mobile .custom-modal-header button {
        margin: var(--space-4) var(--space-5);
        width: 40px;
        height: 40px;
    }

    .modal-s .custom-modal-header button {
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 13px;
    }

    .modal-s .custom-modal-footer button {
        line-height: var(--line-height-tight);
    }

    .modal-m.custom-modal-layout .gridContainers .full-screen-mobile.custom-modal-layout .gridContainers {
        margin: 0px var(--space-5);
    }

    .modal-m.custom-modal-layout,
    .full-screen-mobile.custom-modal-layout {
        width: 100%
    }

    .modal-m #custom-modal-body-id,
    .full-screen-mobile #custom-modal-body-id {
        justify-content: flex-start;
        min-height: calc(100vh - 156px);
        padding: var(--space-5);
        padding-top: var(--space-8);
    }

    .modal-m #custom-modal-body-id form,
    .full-screen-mobile #custom-modal-body-id form {
        align-content: flex-start;
        width: 100%;
        gap: var(--space-5);
    }

    .modal-m #custom-modal-body-id form .user-update-row,
    .full-screen-mobile #custom-modal-body-id form .user-update-row {
        margin-bottom: var(--space-5);
    }

    .custom-modal-layout.modal-m .gridContainers,
    .custom-modal-layout.full-screen-mobile .gridContainers {
        padding: var(--space-4);
        width: auto;
    }

    .modal-dialog:has(.modal-m),
    .modal-dialog:has(.full-screen-mobile) {
        margin: 0;
    }

    .modal-dialog:has(.full-screen-mobile) {
        margin: 0;
        height: 100%;
    }

    .modal-body:has(.modal-m),
    .modal-body:has(.full-screen-mobile) {
        padding: 0;
        width: 100%;
    }

    .modal-m .custom-modal-header,
    .modal-m .custom-modal-footer,
    .modal-content:has(.custom-modal-layout.modal-m),
    .full-screen-mobile .custom-modal-header,
    .full-screen-mobile .custom-modal-footer,
    .modal-content:has(.custom-modal-layout.full-screen-mobile) {
        border-radius: 0;
    }

    .modal-m .desktop-hide,
    .full-screen-mobile .desktop-hide {
        display: block;
    }

    .modal-m .mobile-hide,
    .full-screen-mobile .mobile-hide {
        display: none;
    }
}

/* ========================================
   RESPONSIVE - Large (< 1100px)
   ======================================== */

@media screen and (max-width: 1100px) {
    .modal-content:has(.modal-l) {
        width: 100%;
        height: 100%;
        top: 0;
        position: fixed;
    }

    .modal:has(.modal-l) {
        --bs-modal-margin: 0.5rem;
        --bs-modal-width: 100%;
    }

    .modal-l .custom-modal-header {
        height: 69px;
    }

    .modal-l .modalContainer {
        height: calc(100vh - 156px);
        overflow-y: auto;
        overflow-x: hidden;
        padding: var(--space-5);
    }

    .modal-l .custom-modal-header label {
        margin: var(--space-4) var(--space-5);
        font-size: var(--font-size-md);
        line-height: var(--line-height-tight);
    }

    .modal-l .custom-modal-header button {
        margin: var(--space-4) var(--space-5);
        width: 40px;
        height: 40px;
    }

    .modal-l.custom-modal-layout .gridContainers {
        margin: 0px var(--space-5);
    }

    .modal-l.custom-modal-layout {
        width: 100%
    }

    .modal-l #custom-modal-body-id {
        justify-content: flex-start;
    }

    .custom-modal-layout.modal-l .gridContainers {
        padding: var(--space-4);
        width: auto;
    }

    .modal-dialog .modal-dialog-centered:has(.modal-l) {
        margin: 0;
    }

    .modal-body:has(.modal-l) {
        padding: 0;
        width: 100%;
    }

    .modal-l .custom-modal-header,
    .modal-l .custom-modal-footer,
    .modal-content:has(.custom-modal-layout.modal-l) {
        border-radius: 0;
    }

    .modal-l .desktop-hide {
        display: block;
    }

    .modal-l .mobile-hide {
        display: none;
    }

    .modal-l .grid-with-top-buttons-layout {
        padding: 0;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .custom-modal-header button {
        transition: none;
    }
}
