﻿/* =========================================================
       New Lead Modal
       Global stylesheet required for Blazor Bootstrap modal
========================================================= */

/* =========================================================
       Modal dialog and centering
========================================================= */

.new-lead-modal-dialog {
    display: flex;
    width: 700px;
    max-width: calc(100vw - 2rem);
    min-height: calc(100dvh - 2rem);
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
}

.new-lead-modal-dialog.modal-dialog-centered {
    min-height: calc(100dvh - 2rem);
}

/* =========================================================
       Modal container
       Reduced another 5% from 756px to approximately 718px
========================================================= */

.new-lead-modal-content {
    display: flex;
    width: 100%;
    height: min(718px, calc(100dvh - 2rem));
    max-height: calc(100dvh - 2rem);
    flex-direction: column;
    overflow: hidden;
    border: none;
    border-radius: 14px;
    background: #f8f9fd;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
}

/* =========================================================
       Header
========================================================= */

.new-lead-modal-header {
    display: block;
    flex: 0 0 auto;
    padding: 18px 22px 16px;
    border: 0;
    background: #34445f;
    color: #ffffff;
}

.new-lead-header-layout {
    display: flex;
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.leads-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}

    .leads-modal-title i {
        flex: 0 0 auto;
        font-size: 15px;
    }

.leads-modal-subtitle {
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 10px;
    line-height: 1.4;
}

.leads-close-btn {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #ffffff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, opacity 0.15s ease-in-out;
}

    .leads-close-btn:hover:not(:disabled) {
        background: rgba(255, 255, 255, 0.12);
    }

    .leads-close-btn:focus-visible {
        outline: 2px solid rgba(255, 255, 255, 0.85);
        outline-offset: 2px;
    }

    .leads-close-btn:disabled {
        cursor: default;
        opacity: 0.55;
    }

/* =========================================================
       Scrollable body
========================================================= */

.new-lead-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 22px;
    background: #f8f9fd;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.leads-form-inner {
    width: 100%;
}

/* =========================================================
       Section headings
========================================================= */

.leads-section-heading,
.section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid #dcd7ff;
    color: #172033;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

    .leads-section-heading i,
    .section-title i {
        flex: 0 0 auto;
        color: #5a4ff0;
        font-size: 13px;
    }

.leads-section-gap {
    margin-top: 24px;
}

.section-divider {
    margin: 22px 0 16px;
    border-top: 1px solid #e2e5eb;
}

.leads-section-help,
.select-all-label {
    margin: -2px 0 12px;
    color: #747d8d;
    font-size: 11px;
    line-height: 1.4;
}

/* =========================================================
       Labels and owner controls
========================================================= */

.leads-label,
.list-label {
    display: block;
    margin-bottom: 6px;
    color: #4c5565;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.035em;
    line-height: 1.2;
    text-transform: uppercase;
}

.leads-required-star,
.text-danger {
    color: #e04b5a !important;
}

.leads-owner-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    background: #ebe8ff;
    color: #5848e9;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

/* =========================================================
       Form controls
========================================================= */

.leads-input,
.leads-select,
.leads-textarea,
.new-lead-modal-body .form-control,
.new-lead-modal-body .form-select {
    display: block;
    width: 100%;
    border: 1px solid #d4d9e3;
    border-radius: 6px;
    background-color: #ffffff;
    color: #293142;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.leads-input,
.leads-select,
.new-lead-modal-body .form-control,
.new-lead-modal-body .form-select {
    height: 35px;
    padding: 7px 10px;
}

.leads-select,
.new-lead-modal-body .form-select {
    appearance: auto;
}

.leads-textarea,
.new-lead-modal-body textarea.form-control {
    min-height: 78px;
    height: auto;
    padding: 9px 10px;
    line-height: 1.45;
    resize: vertical;
}

    .leads-input::placeholder,
    .leads-textarea::placeholder,
    .new-lead-modal-body .form-control::placeholder {
        color: #9299a6;
        opacity: 1;
    }

    .leads-input:hover:not(:disabled),
    .leads-select:hover:not(:disabled),
    .leads-textarea:hover:not(:disabled),
    .new-lead-modal-body .form-control:hover:not(:disabled),
    .new-lead-modal-body .form-select:hover:not(:disabled) {
        border-color: #bcc3cf;
    }

    .leads-input:focus,
    .leads-select:focus,
    .leads-textarea:focus,
    .new-lead-modal-body .form-control:focus,
    .new-lead-modal-body .form-select:focus {
        border-color: #6457ef;
        box-shadow: 0 0 0 3px rgba(100, 87, 239, 0.13);
    }

    .leads-input:disabled,
    .leads-select:disabled,
    .leads-textarea:disabled,
    .new-lead-modal-body .form-control:disabled,
    .new-lead-modal-body .form-select:disabled {
        cursor: not-allowed;
        background: #eef1f5;
        color: #8b94a3;
        opacity: 1;
    }

.new-lead-modal-body .form-text {
    margin-top: 6px;
    color: #98a2b5;
    font-size: 10px;
    line-height: 1.4;
}

/* =========================================================
       Bootstrap input groups
========================================================= */

.new-lead-modal-body .input-group {
    width: 100%;
}

.new-lead-modal-body .input-group-text {
    display: flex;
    height: 35px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #d4d9e3;
    border-right: 0;
    border-radius: 6px 0 0 6px;
    background: #ffffff;
    color: #aab1bf;
    font-size: 12px;
}

.new-lead-modal-body .input-group > .form-control {
    border-left: 0;
    border-radius: 0 6px 6px 0;
}

.new-lead-modal-body .input-group:focus-within .input-group-text {
    border-color: #6457ef;
}

.new-lead-modal-body .input-group:focus-within .form-control {
    border-color: #6457ef;
    box-shadow: none;
}

.new-lead-modal-body .input-group:focus-within {
    border-radius: 6px;
    box-shadow: 0 0 0 3px rgba(100, 87, 239, 0.13);
}

/* =========================================================
       Input icons
========================================================= */

.leads-input-wrap {
    position: relative;
    width: 100%;
}

    .leads-input-wrap .leads-input {
        padding-left: 32px;
    }

.leads-field-icon {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 10px;
    color: #aab1bf;
    font-size: 12px;
    transform: translateY(-50%);
    pointer-events: none;
}

/* =========================================================
       Validation
========================================================= */

.new-lead-modal-body .validation-message,
.leads-invalid-msg {
    display: block;
    margin-top: 4px;
    color: #dc3545;
    font-size: 10px;
    line-height: 1.35;
}

.new-lead-modal-body .is-invalid {
    border-color: #dc3545 !important;
}

    .new-lead-modal-body .is-invalid:focus {
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
    }

.new-lead-modal-body .is-valid {
    border-color: #198754 !important;
}

    .new-lead-modal-body .is-valid:focus {
        box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.12);
    }

/* =========================================================
       Scope of Work dual list
========================================================= */

.dual-listbox,
.dual-listbox-container .dual-listbox {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.listbox-panel {
    min-width: 0;
}

.listbox-header,
.dual-listbox .list-label {
    margin-bottom: 6px;
    color: #596273;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    text-transform: none;
}

.listbox,
.dual-list {
    display: block;
    width: 100%;
    height: 130px;
    padding: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid #d4d9e3;
    border-radius: 5px;
    background: #ffffff;
    color: #273142;
    font-family: inherit;
    font-size: 11px;
    outline: none;
}

    .listbox:focus,
    .dual-list:focus {
        border-color: #6457ef;
        box-shadow: 0 0 0 3px rgba(100, 87, 239, 0.13);
    }

    .listbox option {
        padding: 5px 6px;
        border-radius: 3px;
    }

        .listbox option:checked {
            background: #5b4cf2 linear-gradient(0deg, #5b4cf2 0%, #5b4cf2 100%);
            color: #ffffff;
        }

.list-item {
    padding: 5px 6px;
    border-radius: 3px;
    cursor: pointer;
}

    .list-item:hover {
        background: #f2f1ff;
    }

    .list-item.selected {
        background: #5b4cf2;
        color: #ffffff;
    }

.listbox-controls,
.transfer-btns {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-top: 18px;
}

    .listbox-btn,
    .transfer-btns .btn {
        display: inline-flex;
        width: 34px;
        height: 34px;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 1px solid #d4d9e3;
        border-radius: 5px;
        background: #ffffff;
        color: #4f5868;
        cursor: pointer;
        transition: border-color 0.15s ease-in-out, color 0.15s ease-in-out, background-color 0.15s ease-in-out;
    }

        .listbox-btn:hover:not(:disabled),
        .transfer-btns .btn:hover:not(:disabled) {
            border-color: #5b4cf2;
            background: #f7f5ff;
            color: #5b4cf2;
        }

        .listbox-btn:focus-visible,
        .transfer-btns .btn:focus-visible {
            outline: 2px solid #6457ef;
            outline-offset: 2px;
        }

        .listbox-btn:disabled,
        .transfer-btns .btn:disabled {
            cursor: not-allowed;
            opacity: 0.4;
        }

/* =========================================================
       Footer
========================================================= */

.new-lead-modal-footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 22px;
    border-top: 1px solid #e2e5eb;
    background: #ffffff;
}

.leads-btn-cancel,
.leads-btn-save-new,
.leads-btn-save,
.btn-cancel,
.btn-save-new,
.btn-save {
    display: inline-flex;
    min-height: 35px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 14px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, color 0.15s ease-in-out, opacity 0.15s ease-in-out;
}

.leads-btn-cancel,
.btn-cancel {
    border: 1px solid #d1d6df;
    background: #ffffff;
    color: #555e6e;
}

.leads-btn-save-new,
.btn-save-new {
    border: 1px solid #5b4cf2;
    background: #ffffff;
    color: #5748e8;
}

.leads-btn-save,
.btn-save {
    border: 1px solid #5041e7;
    background: #5041e7;
    color: #ffffff;
}

.leads-btn-cancel:hover:not(:disabled),
.btn-cancel:hover:not(:disabled) {
    background: #f4f5f7;
}

.leads-btn-save-new:hover:not(:disabled),
.btn-save-new:hover:not(:disabled) {
    background: #f3f1ff;
}

.leads-btn-save:hover:not(:disabled),
.btn-save:hover:not(:disabled) {
    border-color: #4133ce;
    background: #4133ce;
}

.leads-btn-cancel:focus-visible,
.leads-btn-save-new:focus-visible,
.leads-btn-save:focus-visible,
.btn-cancel:focus-visible,
.btn-save-new:focus-visible,
.btn-save:focus-visible {
    outline: 2px solid #6457ef;
    outline-offset: 2px;
}

.leads-btn-cancel:disabled,
.leads-btn-save-new:disabled,
.leads-btn-save:disabled,
.btn-cancel:disabled,
.btn-save-new:disabled,
.btn-save:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* =========================================================
       Tablet and smaller screens
========================================================= */

@media (max-width: 767.98px) {
    .new-lead-modal-dialog {
        width: calc(100vw - 16px);
        max-width: none;
        min-height: calc(100dvh - 16px);
        margin: 8px auto;
    }

        .new-lead-modal-dialog.modal-dialog-centered {
            min-height: calc(100dvh - 16px);
        }

    .new-lead-modal-content {
        height: calc(100dvh - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 10px;
    }

    .new-lead-modal-header {
        padding: 16px 18px;
    }

    .new-lead-modal-body {
        padding: 18px;
    }

    .new-lead-modal-footer {
        padding: 12px 18px;
    }

    .leads-section-gap {
        margin-top: 20px;
    }

    .section-divider {
        margin: 18px 0 14px;
    }

    .dual-listbox,
    .dual-listbox-container .dual-listbox {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .listbox-controls,
    .transfer-btns {
        flex-direction: row;
        justify-content: center;
        padding-top: 0;
    }

        .listbox-controls .listbox-btn:first-child i,
        .transfer-btns .btn:first-child i {
            transform: rotate(90deg);
        }

        .listbox-controls .listbox-btn:last-child i,
        .transfer-btns .btn:last-child i {
            transform: rotate(90deg);
        }

    .new-lead-modal-footer {
        flex-wrap: wrap;
    }
}

/* =========================================================
       Phones
========================================================= */

@media (max-width: 575.98px) {
    .new-lead-modal-header {
        padding: 14px 16px;
    }

    .new-lead-modal-body {
        padding: 16px;
    }

    .new-lead-modal-footer {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px 16px;
    }

    .new-lead-header-layout {
        gap: 12px;
    }

    .leads-modal-title {
        font-size: 15px;
    }

    .leads-modal-subtitle {
        font-size: 9px;
    }

    .leads-section-heading,
    .section-title {
        margin-bottom: 12px;
        font-size: 12px;
    }

    .leads-btn-cancel,
    .leads-btn-save-new,
    .leads-btn-save,
    .btn-cancel,
    .btn-save-new,
    .btn-save {
        width: 100%;
        min-height: 38px;
    }

    .listbox,
    .dual-list {
        height: 120px;
    }
}

/* =========================================================
       Very narrow phones
========================================================= */

@media (max-width: 359.98px) {
    .new-lead-modal-dialog {
        width: calc(100vw - 8px);
        min-height: calc(100dvh - 8px);
        margin: 4px auto;
    }

        .new-lead-modal-dialog.modal-dialog-centered {
            min-height: calc(100dvh - 8px);
        }

    .new-lead-modal-content {
        height: calc(100dvh - 8px);
        max-height: calc(100dvh - 8px);
        border-radius: 8px;
    }

    .new-lead-modal-header,
    .new-lead-modal-body,
    .new-lead-modal-footer {
        padding-right: 12px;
        padding-left: 12px;
    }
}

/* =========================================================
       Short screens and smaller laptops
========================================================= */

@media (max-height: 700px) and (min-width: 768px) {
    .new-lead-modal-dialog {
        min-height: calc(100dvh - 1rem);
        margin: 0.5rem auto;
    }

        .new-lead-modal-dialog.modal-dialog-centered {
            min-height: calc(100dvh - 1rem);
        }

    .new-lead-modal-content {
        height: calc(100dvh - 1rem);
        max-height: calc(100dvh - 1rem);
    }

    .new-lead-modal-header {
        padding-top: 13px;
        padding-bottom: 12px;
    }

    .new-lead-modal-body {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .new-lead-modal-footer {
        padding-top: 9px;
        padding-bottom: 9px;
    }
}

/* =========================================================
       Fallback for browsers without dvh support
========================================================= */

@supports not (height: 100dvh) {
    .new-lead-modal-dialog {
        min-height: calc(100vh - 2rem);
    }

        .new-lead-modal-dialog.modal-dialog-centered {
            min-height: calc(100vh - 2rem);
        }

    .new-lead-modal-content {
        height: min(718px, calc(100vh - 2rem));
        max-height: calc(100vh - 2rem);
    }

    @media (max-width: 767.98px) {
        .new-lead-modal-dialog,
        .new-lead-modal-dialog.modal-dialog-centered {
            min-height: calc(100vh - 16px);
        }

        .new-lead-modal-content {
            height: calc(100vh - 16px);
            max-height: calc(100vh - 16px);
        }
    }

    @media (max-width: 359.98px) {
        .new-lead-modal-dialog,
        .new-lead-modal-dialog.modal-dialog-centered {
            min-height: calc(100vh - 8px);
        }

        .new-lead-modal-content {
            height: calc(100vh - 8px);
            max-height: calc(100vh - 8px);
        }
    }

    @media (max-height: 700px) and (min-width: 768px) {
        .new-lead-modal-dialog,
        .new-lead-modal-dialog.modal-dialog-centered {
            min-height: calc(100vh - 1rem);
        }

        .new-lead-modal-content {
            height: calc(100vh - 1rem);
            max-height: calc(100vh - 1rem);
        }
    }
}

/* =========================================================
       Reduced motion accessibility
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .leads-close-btn,
    .leads-input,
    .leads-select,
    .leads-textarea,
    .new-lead-modal-body .form-control,
    .new-lead-modal-body .form-select,
    .listbox-btn,
    .transfer-btns .btn,
    .leads-btn-cancel,
    .leads-btn-save-new,
    .leads-btn-save,
    .btn-cancel,
    .btn-save-new,
    .btn-save {
        transition: none;
    }
}
