/* ------------------------------------------------------------------
   Shared UI: toasts, confirm modal, success panel
   Replaces the browser's alert()/confirm() dialogs.
------------------------------------------------------------------ */

/* ---------- Toasts ---------- */
.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    border-radius: 10px;
    border-left: 4px solid var(--toast-accent, #4a2c7a);
    box-shadow: 0 8px 24px rgba(44, 24, 16, 0.18);
    padding: 14px 16px;
    font-size: 13.5px;
    line-height: 1.5;
    color: #333;
    animation: toast-in 0.28s cubic-bezier(0.21, 1.02, 0.73, 1);
}

.toast.is-leaving {
    animation: toast-out 0.22s ease forwards;
}

.toast .toast-icon {
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1.3;
    color: var(--toast-accent, #4a2c7a);
}

.toast .toast-body { flex: 1; min-width: 0; }

.toast .toast-title {
    font-weight: 700;
    margin-bottom: 3px;
    color: #2c1810;
}

.toast .toast-message {
    color: #555;
    word-wrap: break-word;
}

/* Multi-line details (e.g. a list of invalid fields) */
.toast .toast-message ul {
    margin: 6px 0 0;
    padding-left: 18px;
}
.toast .toast-message li { margin-bottom: 2px; }

.toast .toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1.3;
}
.toast .toast-close:hover { color: #666; }

.toast.toast-success { --toast-accent: #27ae60; }
.toast.toast-error   { --toast-accent: #e74c3c; }
.toast.toast-warning { --toast-accent: #ff9800; }
.toast.toast-info    { --toast-accent: #4a2c7a; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(110%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(110%); }
}

/* ---------- Shared overlay ---------- */
.ui-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 24, 16, 0.55);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: overlay-in 0.18s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.ui-dialog {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(44, 24, 16, 0.3);
    width: 100%;
    max-width: 430px;
    overflow: hidden;
    animation: dialog-in 0.22s cubic-bezier(0.21, 1.02, 0.73, 1);
}
@keyframes dialog-in {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ui-dialog-body {
    padding: 26px 26px 20px;
    text-align: center;
}

.ui-dialog-icon {
    font-size: 34px;
    margin-bottom: 14px;
    color: #4a2c7a;
}
.ui-dialog-icon.is-danger  { color: #e74c3c; }
.ui-dialog-icon.is-warning { color: #ff9800; }
.ui-dialog-icon.is-success { color: #27ae60; }

.ui-dialog-title {
    margin: 0 0 10px;
    font-size: 18px;
    color: #2c1810;
    font-weight: 700;
}

.ui-dialog-message {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.ui-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 0 26px 24px;
    flex-wrap: wrap;
}

.ui-btn {
    padding: 11px 22px;
    border: none;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-width: 110px;
}
.ui-btn-cancel  { background: #eee; color: #555; }
.ui-btn-confirm { background: #4a2c7a; color: #fff; }
.ui-btn-danger  { background: #e74c3c; color: #fff; }
.ui-btn:hover   { opacity: 0.88; }
.ui-btn:focus-visible { outline: 3px solid rgba(74, 44, 122, 0.35); outline-offset: 2px; }

/* ---------- Success panel (application submitted) ---------- */
.success-id-box {
    background: #f8f7ff;
    border: 1px dashed #c9c2e0;
    border-radius: 8px;
    padding: 16px;
    margin: 18px 0 14px;
}
.success-id-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #4a2c7a;
    font-weight: 700;
    margin-bottom: 6px;
}
.success-id-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c1810;
    letter-spacing: 1.5px;
    font-family: 'Courier New', monospace;
}
.success-copy-btn {
    margin-top: 10px;
    background: none;
    border: 1px solid #c9c2e0;
    color: #4a2c7a;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.success-copy-btn:hover { background: #ede9f7; }

.success-note {
    font-size: 12.5px;
    color: #888;
    margin: 0;
}

@media (max-width: 480px) {
    .toast-stack {
        left: 12px;
        right: 12px;
        top: 12px;
        max-width: none;
    }
    .ui-dialog-actions { flex-direction: column-reverse; }
    .ui-btn { width: 100%; }
}

/* ---------- Date of birth (DD/MM/YYYY) ---------- */
.dob-wrap { position: relative; display: block; }

.dob-wrap input.dob-text {
    width: 100%;
    padding-right: 40px;      /* room for the calendar button */
    box-sizing: border-box;
}

/* The native picker must never be visible: it is only a calendar source.
   !important because page-level `.form-group input` rules load after this
   file and would otherwise give it a width, padding and border. */
.dob-wrap input.dob-picker,
input.dob-picker {
    position: absolute !important;
    right: 8px !important;
    top: 50% !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    max-width: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    opacity: 0 !important;
    background: none !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

.dob-wrap button.dob-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #4a2c7a;
    font-size: 15px;
    padding: 6px 8px;
    line-height: 1;
    border-radius: 4px;
}
.dob-wrap button.dob-btn:hover { background: #ede9f7; }
