/* ─────────────────────────────────────────────────────────────────
   BloodHelp — Global UI CSS
   Handles centralized Toasts and HTMX Progress Bar.
   ───────────────────────────────────────────────────────────────── */

/* 1. HTMX Global Progress Bar */
#bh-global-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background-color: #ef4444; /* Tailwind red-500 */
    z-index: 9999;
    transition: width 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
}
#bh-global-progress.htmx-request {
    opacity: 1;
    width: 80%;
    transition: width 2s cubic-bezier(0.1, 0.7, 1.0, 0.1);
}

/* 2. Unified Toast Container */
#bh-toast-container {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none; /* Let clicks pass through container */
}

/* Toast Cards */
.bh-toast-card {
    pointer-events: auto; /* Catch clicks on the toast itself */
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    transform: translateX(100%);
    animation: slideInRight 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(100%); }
    100% { opacity: 1; transform: translateX(0); }
}

.bh-toast-card.hide {
    opacity: 0;
    transform: translateX(100%);
}

.bh-toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}
.bh-toast-icon.success { color: #10b981; } /* Emerald-500 */
.bh-toast-icon.error { color: #ef4444; }   /* Red-500 */
.bh-toast-icon.warning { color: #f59e0b; } /* Amber-500 */
.bh-toast-icon.info { color: #3b82f6; }    /* Blue-500 */

.bh-toast-content {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.4;
}

.bh-toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    margin: -0.25rem;
    transition: color 0.2s;
}
.bh-toast-close:hover {
    color: #4b5563;
}

/* Premium Success Toast Styling */
.bh-toast-success {
    background: linear-gradient(135deg, #059669, #10b981); /* Emerald 600 to 500 */
    border: 1px solid #047857; /* Emerald 700 */
    color: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4), 0 4px 6px -2px rgba(16, 185, 129, 0.2);
}
.bh-toast-success .bh-toast-content {
    color: #ffffff;
    font-weight: 600;
}
.bh-toast-success .bh-toast-icon.success {
    color: #ffffff;
}
.bh-toast-success .bh-toast-close {
    color: rgba(255, 255, 255, 0.7);
}
.bh-toast-success .bh-toast-close:hover {
    color: #ffffff;
}

@media (max-width: 640px) {
    #bh-toast-container {
        top: 4.5rem;
        right: 1rem;
        left: 1rem;
    }
    .bh-toast-card {
        max-width: 100%;
        width: 100%;
    }
}
