/* The Close Button */
.close {
    color: #060606;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.signature-canvas {
    border: 1px solid gray;
    border-radius: 5px;
}

.container-section {
    width: 100%;
}

.container-border {
    width: 64px;
    background-color: #3d90ff;
}

.signarute-title {
    font-family: "Roboto";
    font-weight: 800;
    font-size: 30px;
    text-align: center;
}

.container-img {
    text-align: center;
}

#clear_signature_button,
#save_signature_button {
    width: 88px;
    height: 40px;
    font-weight: 800;
    margin-top: 15px;
    margin-left: 8px;
    text-align: center;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    background-color: #ffffff;
    border: #111111 1px solid;
    color: #111111;
    font-size: 16px;
}

#clear_signature_button:hover,
#save_signature_button:hover {
    background-color: #111111;
    color: #ffffff;
}

/* 
Make bootstrap modal appear on top of the back-drop
https://stackoverflow.com/questions/10636667/bootstrap-modal-appearing-under-background/13834819#13834819
*/
.modal-backdrop {
    z-index: 1050;
}
.modal {
    z-index: 1060;
}
.modal-content {
    padding: 0;
}

.modal-body {
    padding: 0;
}

.p-2 {
    padding: 16px;
}

.pl-2 {
    padding: 16px;
}

.flex-row {
    display: flex;
}
.flex-row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}
.flex-row.row:after,
.flex-row.row:before {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-end {
    justify-content: flex-end;
}

.signature-container {
    width: 100%;
}

/* --- redesigned signature modal --- */
.signature-modal .modal-content.ns-card {
    display: flex;
    flex-direction: row;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.ns-card__side {
    width: 80px;
    background: #0a0a0a;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 16px;
    position: relative;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.ns-card__icon {
    width: 32px;
    height: 32px;
    opacity: 0.95;
}

.ns-card__body {
    flex: 1 1 auto;
    background: #ffffff;
    padding: 20px 24px 16px 24px;
}

.ns-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ns-card__title {
    margin: 0;
    font-weight: 600;
    font-size: 20px;
    color: #2a2a2a;
}

.ns-card__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.ns-card__close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ns-card__hint {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 13px;
}

.signature-area {
    padding: 8px 0 16px 0;
}

.signature-frame {
    background: #fbfbfb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 12px;
    display: inline-block;
}

.signature-frame .signature-canvas {
    border: 0;
    border-radius: 4px;
    background: #ffffff;
}

.ns-card__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-primary,
.btn-outline {
    width: 96px;
    height: 40px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    border-radius: 6px;
    border: 1px solid transparent;
}

.btn-primary {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}

.btn-primary:hover {
    filter: none;
    background: #000000;
    border-color: #000000;
}

.btn-outline {
    background: #ffffff;
    color: #111111;
    border-color: #111111;
}

.btn-outline:hover {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}

@media (max-width: 768px) {
    .signature-modal .modal-content.ns-card {
        flex-direction: column;
    }
    .ns-card__side {
        width: 100%;
        height: 8px;
        padding: 0;
    }
    .ns-card__icon {
        display: none;
    }
}

/* Decorative accents for the dark sidebar without extra markup */
.ns-card__side::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.ns-card__side::after {
    content: "";
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    filter: blur(0.2px);
    pointer-events: none;
}

@media (max-width: 576px) {
    /* Make dialog use most of the viewport width */
    .signature-modal {
        margin: 12px;
    }
    .signature-modal .modal-content.ns-card {
        border-radius: 10px;
    }
    .ns-card__body {
        padding: 16px;
    }
    /* Reduce side bar height placeholder on stacked layout */
    .ns-card__side {
        width: 100%;
        height: 6px;
        padding-top: 0;
    }
    /* Fit signature area to screen width */
    .signature-frame {
        padding: 8px;
        width: 100%;
    }
    .signature-frame .signature-canvas {
        width: 100%;
        height: auto;
        max-height: 220px;
    }
    /* Buttons: increase touch area */
    .ns-card__footer {
        gap: 10px;
    }
    .btn-primary,
    .btn-outline,
    #clear_signature_button,
    #save_signature_button {
        height: 44px;
    }
}

@media (max-width: 360px) {
    /* Stack buttons vertically on very small screens */
    .ns-card__footer {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-primary,
    .btn-outline,
    #clear_signature_button,
    #save_signature_button {
        width: 100%;
    }
}
