:root {
    --notif-success: #22c55e;
    --notif-error: #ef4444;
    --notif-warning: #f59e0b;
    --notif-info: #3b82f6;
    --notif-success-bg: rgba(34, 197, 94, 0.1);
    --notif-error-bg: rgba(239, 68, 68, 0.1);
    --notif-warning-bg: rgba(245, 158, 11, 0.1);
    --notif-info-bg: rgba(59, 130, 246, 0.1);
}

/* ── TOAST ──────────────────────────────────────── */
.ty-toast-region {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 380px;
    width: calc(100vw - 2.5rem);
    pointer-events: none;
}

.ty-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.9rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.875rem;
    line-height: 1.45;
    pointer-events: all;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    animation: ty-toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    cursor: default;
    background: #1a1206;
    color: #e8d5b5;
}

.ty-toast.ty-removing {
    animation: ty-toast-out 0.3s ease forwards;
}

.ty-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2.5px;
    width: 100%;
    transform-origin: left;
    animation: ty-toast-progress linear forwards;
    border-radius: 0 0 0 10px;
}

.ty-toast.success { border-left: 3px solid var(--notif-success); }
.ty-toast.error { border-left: 3px solid var(--notif-error); }
.ty-toast.warning { border-left: 3px solid var(--notif-warning); }
.ty-toast.info { border-left: 3px solid var(--notif-info); }

.ty-toast.success .ty-toast-progress { background: var(--notif-success); }
.ty-toast.error .ty-toast-progress { background: var(--notif-error); }
.ty-toast.warning .ty-toast-progress { background: var(--notif-warning); }
.ty-toast.info .ty-toast-progress { background: var(--notif-info); }

.ty-toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: 0.05rem;
}

.ty-toast.success .ty-toast-icon { color: var(--notif-success); }
.ty-toast.error .ty-toast-icon { color: var(--notif-error); }
.ty-toast.warning .ty-toast-icon { color: var(--notif-warning); }
.ty-toast.info .ty-toast-icon { color: var(--notif-info); }

.ty-toast-body { flex: 1; min-width: 0; }
.ty-toast-title {
    font-weight: 700;
    font-size: 0.83rem;
    margin-bottom: 0.15rem;
    letter-spacing: 0.01em;
}

.ty-toast.success .ty-toast-title { color: var(--notif-success); }
.ty-toast.error .ty-toast-title { color: var(--notif-error); }
.ty-toast.warning .ty-toast-title { color: var(--notif-warning); }
.ty-toast.info .ty-toast-title { color: var(--notif-info); }

.ty-toast-msg { color: rgba(232, 213, 181, 0.8); font-size: 0.855rem; }

.ty-toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(232, 213, 181, 0.4);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    margin-top: 0.05rem;
}

.ty-toast-close:hover {
    color: rgba(232, 213, 181, 0.9);
    background: rgba(255, 255, 255, 0.06);
}

@keyframes ty-toast-in {
    from { opacity: 0; transform: translateX(120%) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes ty-toast-out {
    from { opacity: 1; transform: translateX(0) scale(1); max-height: 120px; margin-bottom: 0; }
    to { opacity: 0; transform: translateX(120%) scale(0.9); max-height: 0; margin-bottom: -0.6rem; }
}

@keyframes ty-toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* ── MODAL / DIALOG ──────────────────────────────── */
.ty-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(3px);
}

.ty-modal-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.ty-modal {
    background: #1a1206;
    border: 1px solid rgba(201, 162, 52, 0.18);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.3);
    max-width: 460px;
    width: 100%;
    transform: scale(0.94) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.ty-modal-backdrop.open .ty-modal {
    transform: scale(1) translateY(0);
}

.ty-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 1.5rem 0;
}

.ty-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ty-modal-icon.danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.ty-modal-icon.warning { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.ty-modal-icon.info { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.ty-modal-icon.success { background: rgba(34, 197, 94, 0.12); color: #22c55e; }

.ty-modal-titles { flex: 1; min-width: 0; }

.ty-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e8d5b5;
    margin: 0 0 0.3rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.ty-modal-subtitle {
    font-size: 0.855rem;
    color: rgba(181, 151, 106, 0.7);
    margin: 0;
    line-height: 1.45;
}

.ty-modal-body {
    padding: 1rem 1.5rem 0;
    font-size: 0.875rem;
    color: rgba(232, 213, 181, 0.75);
    line-height: 1.55;
}

.ty-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 1.25rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(201, 162, 52, 0.1);
    margin-top: 1.25rem;
}

.ty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.18s ease;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.ty-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(181, 151, 106, 0.8);
    border-color: rgba(201, 162, 52, 0.15);
}

.ty-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(201, 162, 52, 0.3);
    color: #e8d5b5;
}

.ty-btn-danger {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.ty-btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.ty-btn-primary {
    background: #C9A234;
    color: #fff;
    border-color: #C9A234;
}

.ty-btn-primary:hover {
    background: #b08c2a;
    border-color: #b08c2a;
    box-shadow: 0 4px 14px rgba(201, 162, 52, 0.35);
}

/* ── FORM VALIDATION INLINE ─────────────────────── */
.ty-field-error {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: #ef4444;
    animation: ty-fade-in 0.2s ease;
}

.ty-form-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    font-size: 0.855rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    border: 1px solid;
}

.ty-form-alert.error {
    background: rgba(239, 68, 68, 0.07);
    border-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.ty-form-alert.warning {
    background: rgba(245, 158, 11, 0.07);
    border-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.ty-form-alert.success {
    background: rgba(34, 197, 94, 0.07);
    border-color: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.ty-form-alert-icon { flex-shrink: 0; margin-top: 0.1rem; }

@keyframes ty-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Admin panel overrides (lighter background) */
.admin-context .ty-toast {
    background: #ffffff;
    color: #1a1206;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.admin-context .ty-toast-msg { color: #6b6050; }
.admin-context .ty-toast-title { }
.admin-context .ty-toast-close { color: rgba(0, 0, 0, 0.3); }
.admin-context .ty-toast-close:hover { color: rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.05); }

.admin-context .ty-modal {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.admin-context .ty-modal-title { color: #1a1206; }
.admin-context .ty-modal-subtitle { color: #a09080; }
.admin-context .ty-modal-body { color: #6b6050; }
.admin-context .ty-modal-footer { border-color: rgba(0, 0, 0, 0.08); }
.admin-context .ty-btn-cancel { background: #f9f7f3; color: #6b6050; border-color: rgba(0, 0, 0, 0.1); }
.admin-context .ty-btn-cancel:hover { background: #f0ede8; color: #1a1206; }

@media (max-width: 480px) {
    .ty-toast-region { top: auto; bottom: 5rem; left: 0.75rem; right: 0.75rem; max-width: none; }
    .ty-modal { border-radius: 12px 12px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; margin: 0; transform: translateY(20px); }
    .ty-modal-backdrop.open .ty-modal { transform: translateY(0); }
    .ty-modal-backdrop { align-items: flex-end; padding: 0; }
}
