/* ============================================================================
   Create-project / create-system modal (.pjx-modal)
   ----------------------------------------------------------------------------
   Used by the home pages of RPA / FTA / FMEA / MSG3 / FRACAS (create project)
   and FTA (create system). The header uses the Robin brand orange (#e84a16,
   fixed across themes on purpose); everything else is built on the theme
   variables so it adapts to every theme. The var() fallbacks cover the light
   themes, which only define a subset of the variables.
   ========================================================================== */

.pjx-modal .modal-dialog {
    max-width: 640px;
}

.pjx-modal .modal-content {
    border: 0;
    border-radius: 14px;
    background-color: var(--bg-color, #fff);
    color: var(--text-nodes, #2c3345);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .28), 0 6px 18px rgba(0, 0, 0, .12);
}

/* ---- Header: Robin orange bar, white text ---- */
.pjx-modal .modal-header {
    align-items: center;
    padding: 1rem 1.5rem;
    border: 0;
    border-radius: 14px 14px 0 0;
    background-color: var(--noactive-bg-color, #233878);
    color: #fff;
}

.pjx-modal .modal-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: .015em;
    color: #fff;
}

.pjx-modal .modal-title .fas,
.pjx-modal .modal-title .far {
    opacity: .9;
}

/* Close: a white disc on the dark header, so it reads even if the Font Awesome
   kit (loaded from a remote script) never arrives and the glyph inside renders
   as nothing. The colour is forced past Bootstrap's `.close { color: #000 }`
   and any inline colour the markup may carry. */
.pjx-modal .modal-header .close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    margin: -0.25rem -0.5rem -0.25rem auto;
    padding: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .18);
    color: #fff !important;
    opacity: 1;
    text-shadow: none;
    line-height: 1;
    transition: background-color .12s ease-in-out;
}

.pjx-modal .modal-header .close > * {
    color: #fff !important;
}

.pjx-modal .modal-header .close:hover,
.pjx-modal .modal-header .close:focus {
    background-color: rgba(255, 255, 255, .34);
    color: #fff !important;
    opacity: 1;
    outline: 0;
}

.pjx-modal .modal-header .fa-times {
    font-size: 16px; /* calmer than the global 24px */
}

/* ---- Body ---- */
.pjx-modal .modal-body {
    padding: 1.5rem 1.75rem 1.75rem;
}

/* ---- Fields ---- */
.pjx-modal form .form-group {
    margin-bottom: 1.05rem;
}

.pjx-modal form label {
    display: inline-block;
    margin-bottom: .3rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-nodes, #3a4256);
    opacity: .72;
}

.pjx-modal form .asteriskField {
    margin-left: 2px;
    color: #e84a16;
}

/* The resting border has to be visible on its own: the field background is the
 * same colour as the modal body, so the border is the only thing outlining it.
 * It uses --border-color ("Border and disabled fields"), not --forms-color,
 * which is the *background* of the fields (#fff on the light themes, #af988e on
 * the dark ones) and therefore drew a border the same colour as the field. The
 * dark themes never define --border-color, so there the fallback applies: a
 * translucent white, which is the light-on-dark border they already show
 * elsewhere (their .form-control falls back to the white currentColor). */
.pjx-modal form .form-control,
.pjx-modal form select.form-control {
    padding: .6rem .85rem;
    height: auto;
    border: 1.5px solid var(--border-color, rgba(255, 255, 255, .35));
    border-radius: 9px;
    background-color: var(--bg-color, #fff);
    color: var(--text-nodes, #2c3345);
    font-size: .92rem;
    box-shadow: none;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.pjx-modal form .form-control::placeholder {
    color: var(--text-nodes, #2c3345);
    opacity: .38;
}

.pjx-modal form .form-control:focus {
    border-color: #e84a16;
    box-shadow: 0 0 0 3px rgba(232, 74, 22, .15);
    outline: 0;
}

.pjx-modal form textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ---- File input: quiet drop-area look ---- */
.pjx-modal form input[type="file"] {
    display: block;
    width: 100%;
    padding: .6rem .7rem;
    border: 1.5px dashed var(--border-color, rgba(255, 255, 255, .35));
    border-radius: 9px;
    background-color: var(--bg-secondary-color, #f4f6f9);
    color: var(--text-nodes, #2c3345);
    font-size: .84rem;
    cursor: pointer;
    transition: border-color .15s ease-in-out;
}

.pjx-modal form input[type="file"]:hover {
    border-color: #e84a16;
}

.pjx-modal form input[type="file"]::file-selector-button {
    margin-right: .8rem;
    padding: .38rem .8rem;
    border: 0;
    border-radius: 6px;
    background-color: var(--noactive-bg-color, #233878);
    color: #fff;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}

/* ---- Submit: full-width solid brand button ---- */
.pjx-modal form .btn,
.pjx-modal form input[type="submit"] {
    display: block;
    width: 100%;
    margin-top: .5rem;
    padding: .65rem 1rem;
    border: 0;
    border-radius: 9px;
    background: var(--noactive-bg-color, #233878);
    color: #fff;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
    transition: filter .12s ease-in-out, transform .12s ease-in-out, box-shadow .12s ease-in-out;
}

.pjx-modal form .btn:hover,
.pjx-modal form input[type="submit"]:hover {
    background: var(--noactive-bg-color, #233878);
    color: #fff;
    filter: brightness(1.12);
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(0, 0, 0, .18);
}

.pjx-modal form .btn:not(:disabled):active,
.pjx-modal form input[type="submit"]:not(:disabled):active {
    background: var(--noactive-bg-color, #233878);
    color: #fff;
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
}

.pjx-modal form .btn:focus,
.pjx-modal form input[type="submit"]:focus {
    background: var(--noactive-bg-color, #233878);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(232, 74, 22, .25);
}

/* ---- Footer actions (FMEA's system modals keep Save/Close down here) ----
   Only the alignment is corrected here; each button keeps its own look. */
.pjx-modal .modal-footer {
    align-items: center;
}

.pjx-modal .modal-footer .btn {
    /* .btn-primary ships a 10px bottom margin (control_panel.css); the flex
       footer centres every item on its own box, so that margin lifted Save off
       the Close button's baseline. */
    width: auto;
    margin: 0 0 0 .5rem;
}

/* ---- Save stays disabled until the form is complete (pjx_form_validation.js).
   Last in the file so it wins over the :hover rules above. ---- */
.pjx-modal form .btn:disabled,
.pjx-modal form input[type="submit"]:disabled,
.pjx-modal .modal-footer .btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    filter: none;
    transform: none;
    box-shadow: none;
}
