/* ============================================================
   🎨 UI HELPERS — Toast, Modal, Skeleton, Empty States
   ============================================================ */

/* --- Toast Container --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    width: 100%;
    pointer-events: none;
}

.toast {
    background: #fff;
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    border-left: 4px solid #3b82f6;
    pointer-events: auto;
    transition: 0.3s;
}

.toast-success { border-left-color: #22c55e; }
.toast-error { border-left-color: #dc2626; }
.toast-warning { border-left-color: #f59e0b; }
.toast-info { border-left-color: #3b82f6; }

.toast-icon { font-size: 20px; line-height: 1; }
.toast-message { font-size: 14px; color: #0f172a; font-weight: 500; flex: 1; }
.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #94a3b8;
    padding: 0 4px;
    line-height: 1;
}
.toast-close:hover { color: #dc2626; }

.toast-hide {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
    transition: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

/* --- Custom Modal --- */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: modalFadeIn 0.3s ease;
    padding: 20px;
}

.custom-modal {
    background: #fff;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.custom-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.custom-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: #94a3b8;
    transition: 0.3s;
    line-height: 1;
    padding: 0 4px;
}
.custom-modal-close:hover { color: #dc2626; transform: rotate(90deg); }

.custom-modal-body {
    padding: 24px;
}

.custom-modal-body p {
    font-size: 15px;
    color: #334155;
    margin: 0;
    line-height: 1.6;
}

.modal-prompt-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: 0.3s;
    font-family: inherit;
}
.modal-prompt-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.custom-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 24px;
    border-top: 1px solid #f1f5f9;
}

.custom-modal-footer .btn {
    padding: 10px 24px;
    font-size: 14px;
    border-radius: 10px;
    min-width: 80px;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Skeleton Loader --- */
.skeleton-card,
.skeleton-list-item,
.skeleton-grid-item {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 16px;
    margin-bottom: 12px;
}

.skeleton-line {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-grid-item {
    display: inline-block;
    width: 100%;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}
.empty-state .icon { font-size: 48px; color: #94a3b8; margin-bottom: 12px; }
.empty-state h4 { font-size: 18px; color: #0f172a; margin-bottom: 4px; }
.empty-state p { font-size: 14px; margin: 0; }

/* --- Responsive --- */
@media (max-width: 600px) {
    .toast-container { top: 10px; right: 10px; max-width: calc(100% - 20px); }
    .custom-modal { max-width: 95%; }
    .custom-modal-header { padding: 16px 18px; }
    .custom-modal-body { padding: 18px; }
    .custom-modal-footer { padding: 12px 18px 18px; flex-wrap: wrap; }
    .custom-modal-footer .btn { flex: 1; min-width: 60px; }
}