/* Modal & Interactive Styling for Edenbrook Enrolment Forms */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    background: #0B1B3D !important;
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.toolbar-program-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    padding: 3px 8px;
}

.toolbar-program-select label {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
}

.toolbar-program-select select {
    background: #0f2756;
    color: #ffffff;
    border: 1px solid #3b82f6;
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.toolbar-program-select select:hover,
.toolbar-program-select select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}

.toolbar-program-select select option {
    background: #0B1B3D;
    color: #ffffff;
    padding: 6px;
}

.toolbar button.btn-submit {
    background: #059669 !important;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 22px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(5,150,105,0.4);
    transition: background 0.2s, transform 0.1s;
}
.toolbar button.btn-submit:hover {
    background: #047857 !important;
    transform: translateY(-1px);
}
.toolbar button.btn-submit:disabled {
    background: #6b7280 !important;
    cursor: not-allowed;
    transform: none;
}

.toolbar button.btn-print {
    background: #9a0c0c !important;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}
.toolbar button.btn-print:hover {
    background: #7f0a0a !important;
}

.toolbar .ref-tag {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    color: #f1f5f9;
}

/* Date Field Styling with Dropdown Indicator */
input[type="date"].ebc-date-input,
.field-row input[type="date"] {
    height: 20px;
    padding: 1px 4px;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    color: #111;
    cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    filter: invert(0.2);
    padding: 0 2px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Interactive Signature Pad Box */
.sig-box-wrap {
    position: relative;
    width: 100%;
    min-width: 140px;
    height: 46px;
    border: 1px dashed #4b5563;
    background: #ffffff;
    border-radius: 4px;
    margin-top: 3px;
    margin-bottom: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.sig-box-wrap.is-signed {
    border-style: solid;
    border-color: #059669;
    background: #fcfdfc;
}
.sig-box-wrap canvas.ebc-sig-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    touch-action: none;
}
.sig-box-wrap .ebc-sig-clear {
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
    z-index: 5;
}
.sig-box-wrap .ebc-sig-clear:hover {
    background: #fecaca;
}
.sig-box-wrap .ebc-sig-hint {
    position: absolute;
    left: 8px;
    bottom: 4px;
    font-size: 10px;
    color: #94a3b8;
    pointer-events: none;
    font-style: italic;
    user-select: none;
}
.sig-img-preview {
    max-height: 48px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Student Signature Cell - Signature Placed on Top of the Line */
.sig.sig-student-cell {
    position: relative;
}

.sig.sig-student-cell .sig-box-wrap {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 2px;
    height: 40px;
    min-width: 140px;
    border: 1px dashed #4b5563;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
    z-index: 10;
}

.sig.sig-student-cell .sig-box-wrap.is-signed {
    border-style: solid;
    border-color: #059669;
    background: #fcfdfc;
}

.sig.sig-student-cell .sig-img-preview {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 2px;
    max-height: 40px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Cursive fallback */
input.ebc-sig-input {
    font-family: 'Brush Script MT', 'Dancing Script', cursive, Georgia, serif !important;
    font-size: 18px !important;
    color: #0B1B3D !important;
    font-weight: normal !important;
}

/* Initials Autofill Feedback */
.initials input.autofilled {
    background: #ecfdf5 !important;
    border-color: #059669 !important;
    color: #047857 !important;
}

/* Success Modal */
#ebcSuccessModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
}
.ebc-modal-backdrop {
    background: rgba(11, 27, 61, 0.85);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.ebc-modal-card {
    background: #fff;
    max-width: 520px;
    width: 100%;
    border-radius: 12px;
    padding: 36px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    animation: ebcModalSlide 0.3s ease-out;
}
@keyframes ebcModalSlide {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.ebc-modal-icon {
    width: 64px;
    height: 64px;
    background: #ecfdf5;
    color: #059669;
    font-size: 32px;
    line-height: 64px;
    border-radius: 50%;
    margin: 0 auto 16px;
    border: 2px solid #a7f3d0;
}
.ebc-modal-card h2 {
    font-size: 22px;
    color: #0B1B3D;
    margin: 0 0 12px;
}
.ebc-modal-card p {
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 18px;
}
.ebc-modal-ref {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    margin: 18px 0;
}
.ebc-modal-ref span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
}
.ebc-modal-ref strong {
    font-size: 20px;
    font-family: monospace;
    color: #0B1B3D;
    letter-spacing: 1.5px;
}
.ebc-modal-note {
    font-size: 12px !important;
    color: #64748b !important;
    font-style: italic;
}
.ebc-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}
.ebc-modal-buttons button {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    border: 0;
}
.ebc-modal-buttons .btn-print {
    background: #9a0c0c;
    color: #fff;
}
.ebc-modal-buttons .btn-close {
    background: #e2e8f0;
    color: #334155;
}

@media print {
    #ebcSuccessModal {
        display: none !important;
    }
    .sig-box-wrap {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        height: auto !important;
        margin: 0 !important;
    }
    .sig.sig-student-cell .sig-box-wrap {
        display: none !important;
    }
    .sig.sig-student-cell .sig-img-preview {
        position: absolute !important;
        bottom: 100% !important;
        left: 0 !important;
        margin-bottom: 2px !important;
        max-height: 40px !important;
        display: block !important;
    }
    .ebc-sig-clear, .ebc-sig-hint {
        display: none !important;
    }
    input[type="date"]::-webkit-calendar-picker-indicator {
        display: none !important;
    }
}
