/**
 * Toast Manager Styles
 * Modern, accessible toast notification system with site theme colors
 */

/* ============================================
   Toast Container
   ============================================ */
.toast-container {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 420px;
}

/* Position variants */
.toast-top-right {
    top: 20px;
    right: 20px;
}

.toast-top-left {
    top: 20px;
    left: 20px;
}

.toast-bottom-right {
    bottom: 20px;
    right: 20px;
}

.toast-bottom-left {
    bottom: 20px;
    left: 20px;
}

.toast-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.toast-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 640px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: none !important;
    }
}

/* ============================================
   Toast Element - Site Theme
   ============================================ */
.toast {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 14px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.toast:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.toast-show {
    opacity: 1;
    transform: translateX(0) !important;
}

.toast-hide {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
}

/* Toast Types - Site Theme Colors */
.toast-success {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #166534;
}

.toast-success svg {
    color: #22c55e;
}

.toast-success a {
    color: #166534;
    font-weight: 500;
}

.toast-success a:hover {
    color: #14532d;
}

.toast-success .text-current\/30 {
    color: rgba(22, 101, 52, 0.3);
}

.toast-success .text-current\/40 {
    color: rgba(22, 101, 52, 0.4);
}

.toast-success .border-current\/10 {
    border-color: rgba(22, 101, 52, 0.1);
}

.toast-error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.toast-error svg {
    color: #ef4444;
}

.toast-error a {
    color: #991b1b;
    font-weight: 500;
}

.toast-error a:hover {
    color: #7f1d1d;
}

.toast-error .text-current\/30 {
    color: rgba(153, 27, 27, 0.3);
}

.toast-error .text-current\/40 {
    color: rgba(153, 27, 27, 0.4);
}

.toast-error .border-current\/10 {
    border-color: rgba(153, 27, 27, 0.1);
}

.toast-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

.toast-warning svg {
    color: #f59e0b;
}

.toast-warning a {
    color: #92400e;
    font-weight: 500;
}

.toast-warning a:hover {
    color: #78350f;
}

.toast-warning .text-current\/30 {
    color: rgba(146, 64, 14, 0.3);
}

.toast-warning .text-current\/40 {
    color: rgba(146, 64, 14, 0.4);
}

.toast-warning .border-current\/10 {
    border-color: rgba(146, 64, 14, 0.1);
}

.toast-info {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.toast-info svg {
    color: #3b82f6;
}

.toast-info a {
    color: #1e40af;
    font-weight: 500;
}

.toast-info a:hover {
    color: #1e3a8a;
}

.toast-info .text-current\/30 {
    color: rgba(30, 64, 175, 0.3);
}

.toast-info .text-current\/40 {
    color: rgba(30, 64, 175, 0.4);
}

.toast-info .border-current\/10 {
    border-color: rgba(30, 64, 175, 0.1);
}

/* ============================================
   Progress Bar
   ============================================ */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border-radius: 0 0 12px 12px;
}

.toast-progress-bar {
    height: 100%;
    background: currentColor;
    opacity: 0.6;
    animation: toast-progress-animation linear forwards;
    transform-origin: left;
}

@keyframes toast-progress-animation {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* ============================================
   Modal (Confirm/Prompt) - Site Theme
   ============================================ */
.toast-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toast-modal-show {
    opacity: 1;
    visibility: visible;
}

.toast-modal-show .toast-modal-content {
    transform: scale(1);
    opacity: 1;
}

.toast-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.toast-modal-content {
    position: relative;
    width: 90%;
    max-width: 420px;
    padding: 28px 22px 22px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.toast-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 18px;
    border-radius: 50%;
}

.toast-modal-icon svg {
    width: 28px;
    height: 28px;
}

.toast-modal-icon-warning {
    background: #fef3c7;
    color: #ea580c;
}

.toast-modal-icon-info {
    background: #dbeafe;
    color: #2563eb;
}

.toast-modal-icon-error {
    background: #fee2e2;
    color: #dc2626;
}

.toast-modal-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.toast-modal-message {
    margin: 0 0 22px;
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

.toast-modal-input {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
}

.toast-modal-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

.toast-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.toast-modal-btn {
    flex: 1;
    max-width: 160px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.toast-modal-btn:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.toast-modal-btn-cancel {
    background: white;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.toast-modal-btn-cancel:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.toast-modal-btn-confirm {
    background: #3b82f6;
    color: white;
}

.toast-modal-btn-confirm:hover {
    background: #2563eb;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.toast-modal-btn-danger {
    background: #dc2626;
    color: white;
}

.toast-modal-btn-danger:hover {
    background: #b91c1c;
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

/* ============================================
   Responsive - Mobile Optimization
   ============================================ */
@media (max-width: 640px) {
    .toast {
        padding: 12px 14px;
        border-radius: 10px;
        font-size: 13px;
    }

    .toast .text-sm {
        font-size: 13px;
    }

    .toast .w-5 {
        width: 18px;
        height: 18px;
    }

    .toast .w-4 {
        width: 16px;
        height: 16px;
    }

    .toast .gap-3 {
        gap: 8px;
    }

    .toast .mt-3 {
        margin-top: 8px;
    }

    .toast .pt-3 {
        padding-top: 8px;
    }

    .toast-progress {
        height: 2px;
    }

    .toast-modal-content {
        width: 95%;
        max-width: calc(100vw - 32px);
        padding: 22px 18px 18px;
        border-radius: 16px;
    }

    .toast-modal-icon {
        width: 42px;
        height: 42px;
        margin-bottom: 14px;
    }

    .toast-modal-icon svg {
        width: 24px;
        height: 24px;
    }

    .toast-modal-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .toast-modal-message {
        font-size: 13px;
        margin-bottom: 18px;
    }

    .toast-modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .toast-modal-btn {
        max-width: none;
        width: 100%;
        padding: 9px 18px;
        font-size: 13px;
    }
}

/* ============================================
   Utility Classes for Toast Content - SCOPED
   ============================================ */
.toast .text-sm,
.toast-modal .text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.toast .font-semibold,
.toast-modal .font-semibold {
    font-weight: 600;
}

.toast .font-medium,
.toast-modal .font-medium {
    font-weight: 500;
}

.toast .leading-snug,
.toast-modal .leading-snug {
    line-height: 1.375;
}

.toast .flex,
.toast-modal .flex {
    display: flex;
}

.toast .items-start,
.toast-modal .items-start {
    align-items: flex-start;
}

.toast .gap-3,
.toast-modal .gap-3 {
    gap: 0.75rem;
}

.toast .flex-1,
.toast-modal .flex-1 {
    flex: 1 1 0%;
}

.toast .min-w-0,
.toast-modal .min-w-0 {
    min-width: 0px;
}

.toast .flex-shrink-0,
.toast-modal .flex-shrink-0 {
    flex-shrink: 0;
}

.toast .mt-3,
.toast-modal .mt-3 {
    margin-top: 0.75rem;
}

.toast .pt-3,
.toast-modal .pt-3 {
    padding-top: 0.75rem;
}

.toast .border-t,
.toast-modal .border-t {
    border-top-width: 1px;
}

.toast .w-5,
.toast-modal .w-5 {
    width: 1.25rem;
}

.toast .h-5,
.toast-modal .h-5 {
    height: 1.25rem;
}

.toast .w-4,
.toast-modal .w-4 {
    width: 1rem;
}

.toast .h-4,
.toast-modal .h-4 {
    height: 1rem;
}

.toast .underline,
.toast-modal .underline {
    text-decoration: underline;
}

.toast .hover\:no-underline:hover,
.toast-modal .hover\:no-underline:hover {
    text-decoration: none;
}

.toast .transition,
.toast .transition-colors,
.toast-modal .transition,
.toast-modal .transition-colors {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* ============================================
   Accessibility
   ============================================ */
.toast:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.toast-modal-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .toast-container,
    .toast-modal {
        display: none !important;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-enter {
    animation: toastSlideIn 0.3s ease-out;
}

.toast-exit {
    animation: toastSlideOut 0.2s ease-in;
}
