/* ============================================================
   ZP Toast Notification System v1.0
   Modern slide-in toasts with stack, auto-dismiss, RTL support
   Loaded after zp-tokens.css for variable access
   ============================================================ */

#zp-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: var(--zp-z-toast, 500);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 48px);
}

[dir="rtl"] #zp-toast-container {
    right: auto;
    left: 24px;
}

.zp-toast {
    pointer-events: auto;
    background: #fff;
    border-radius: var(--zp-r-lg, 14px);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.15), 0 2px 8px rgba(15, 23, 42, 0.08);
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border-inline-start: 4px solid;
    overflow: hidden;
    position: relative;
    animation: zpToastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
    min-height: 64px;
    font-family: inherit;
}

.zp-toast.zp-toast-leaving {
    animation: zpToastOut 0.25s ease-in forwards;
}

[dir="rtl"] .zp-toast {
    animation-name: zpToastInRtl;
}

[dir="rtl"] .zp-toast.zp-toast-leaving {
    animation-name: zpToastOutRtl;
}

@keyframes zpToastIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes zpToastOut {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}
@keyframes zpToastInRtl {
    from { transform: translateX(-120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes zpToastOutRtl {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(-120%); opacity: 0; }
}

.zp-toast-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.zp-toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zp-toast-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}

.zp-toast-message {
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
    word-break: break-word;
}

.zp-toast-action {
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    align-self: flex-start;
}

.zp-toast-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.zp-toast-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.zp-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    animation: zpToastProgress linear forwards;
    opacity: 0.5;
}

[dir="rtl"] .zp-toast-progress {
    left: auto;
    right: 0;
    transform-origin: right;
}

@keyframes zpToastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Variants */
.zp-toast-success { border-inline-start-color: #10b981; }
.zp-toast-success .zp-toast-icon { background: linear-gradient(135deg, #10b981, #059669); }
.zp-toast-success .zp-toast-action { color: #059669; }
.zp-toast-success .zp-toast-progress { background: #10b981; }

.zp-toast-error { border-inline-start-color: #ef4444; }
.zp-toast-error .zp-toast-icon { background: linear-gradient(135deg, #ef4444, #dc2626); }
.zp-toast-error .zp-toast-action { color: #dc2626; }
.zp-toast-error .zp-toast-progress { background: #ef4444; }

.zp-toast-warning { border-inline-start-color: #f59e0b; }
.zp-toast-warning .zp-toast-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.zp-toast-warning .zp-toast-action { color: #d97706; }
.zp-toast-warning .zp-toast-progress { background: #f59e0b; }

.zp-toast-info { border-inline-start-color: #3b82f6; }
.zp-toast-info .zp-toast-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.zp-toast-info .zp-toast-action { color: #2563eb; }
.zp-toast-info .zp-toast-progress { background: #3b82f6; }

/* Dark surfaces */
[data-theme="dark"] .zp-toast {
    background: #1e293b;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .zp-toast-title { color: #f1f5f9; }
[data-theme="dark"] .zp-toast-message { color: #cbd5e1; }
[data-theme="dark"] .zp-toast-close { color: #64748b; }
[data-theme="dark"] .zp-toast-close:hover { background: #334155; color: #f1f5f9; }

/* Mobile responsive */
@media (max-width: 576px) {
    #zp-toast-container {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
        width: auto;
    }
    [dir="rtl"] #zp-toast-container { left: 12px; right: 12px; }
    .zp-toast { padding: 14px 14px; }
    .zp-toast-icon { width: 32px; height: 32px; font-size: 16px; }
}

/* ============================================================
   ZP Empty State System
   Used wherever we'd otherwise show "no data" placeholders
   ============================================================ */

.zp-empty-state {
    padding: 56px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    color: #475569;
}

.zp-empty-state-icon {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(99, 102, 241, 0.12));
    color: #6366f1;
    position: relative;
    overflow: hidden;
}

.zp-empty-state-icon::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px dashed currentColor;
    opacity: 0.18;
    animation: zpEmptyRotate 18s linear infinite;
}

@keyframes zpEmptyRotate {
    to { transform: rotate(360deg); }
}

.zp-empty-state-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.4;
}

.zp-empty-state-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    max-width: 460px;
    line-height: 1.6;
}

.zp-empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 6px;
}

.zp-empty-state-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff !important;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    border: 0;
    cursor: pointer;
}

.zp-empty-state-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
    color: #fff !important;
}

.zp-empty-state-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    color: #475569 !important;
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.zp-empty-state-link:hover {
    background: #f1f5f9;
    color: #0f172a !important;
}

/* Variant: inside table */
tr.zp-empty-row td {
    padding: 0 !important;
}

tr.zp-empty-row .zp-empty-state {
    padding: 40px 16px;
}

/* Variant: compact (for sidebar/card slots) */
.zp-empty-state.zp-empty-compact {
    padding: 24px 16px;
    gap: 12px;
}
.zp-empty-state.zp-empty-compact .zp-empty-state-icon {
    width: 60px;
    height: 60px;
    font-size: 26px;
}
.zp-empty-state.zp-empty-compact .zp-empty-state-title { font-size: 15px; }
.zp-empty-state.zp-empty-compact .zp-empty-state-desc { font-size: 13px; }

[data-theme="dark"] .zp-empty-state-title { color: #f1f5f9; }
[data-theme="dark"] .zp-empty-state-desc { color: #94a3b8; }
[data-theme="dark"] .zp-empty-state-link { color: #cbd5e1 !important; }
[data-theme="dark"] .zp-empty-state-link:hover { background: #1e293b; color: #f1f5f9 !important; }
