/* ============================================
   TOAST NOTIFICATIONS - DealGram
   Turquoise Design System
   ============================================ */

/* ============================================
   TOAST CONTAINER
   ============================================ */
.toast-container {
    position: fixed;
    /* Pozycja zsynchronizowana z navbar-tab */
    top: var(--toast-top-offset, 92px);
    right: var(--navbar-margin, 20px);
    bottom: auto !important; /* WAŻNE: wyłącz bottom */
    left: auto !important;   /* WAŻNE: wyłącz left */
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    pointer-events: none;
}

/* ============================================
   TOAST BASE
   ============================================ */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    max-width: 400px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 14px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.12),
        0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.removing {
    transform: translateX(120%);
    opacity: 0;
}

/* Dark mode */
.dark-mode .toast {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================
   TOAST ICON
   ============================================ */
.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

/* Success - Green */
.toast-success .toast-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.1));
    color: #10b981;
}

.toast-success {
    border-left: 4px solid #10b981;
}

/* Error/Danger - Red */
.toast-error .toast-icon,
.toast-danger .toast-icon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
    color: #ef4444;
}

.toast-error,
.toast-danger {
    border-left: 4px solid #ef4444;
}

/* Warning - Amber */
.toast-warning .toast-icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.1));
    color: #f59e0b;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

/* Info - Turquoise */
.toast-info .toast-icon {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(6, 182, 212, 0.1));
    color: #14b8a6;
}

.toast-info {
    border-left: 4px solid #14b8a6;
}

/* ============================================
   TOAST CONTENT
   ============================================ */
.toast-content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 2px;
    line-height: 1.3;
}

.dark-mode .toast-title {
    color: #f1f5f9;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary, #64748b);
    line-height: 1.4;
    word-break: break-word;
}

.dark-mode .toast-message {
    color: #94a3b8;
}

/* ============================================
   TOAST CLOSE BUTTON
   ============================================ */
.toast-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-tertiary, #94a3b8);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    margin: -4px -4px -4px 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #1e293b);
}

.dark-mode .toast-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.toast-close i {
    font-size: 12px;
}

/* ============================================
   TOAST PROGRESS BAR
   ============================================ */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.dark-mode .toast-progress {
    background: rgba(255, 255, 255, 0.05);
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    transition: transform linear;
}

.toast-success .toast-progress-bar {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast-error .toast-progress-bar,
.toast-danger .toast-progress-bar {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-warning .toast-progress-bar {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast-info .toast-progress-bar {
    background: linear-gradient(135deg, #14b8a6, #0891b2);
}

/* ============================================
   TOAST HOVER EFFECTS
   ============================================ */
.toast:hover {
    transform: translateX(-4px);
    box-shadow:
        0 14px 50px rgba(0, 0, 0, 0.15),
        0 6px 16px rgba(0, 0, 0, 0.1);
}

.toast:hover .toast-progress-bar {
    animation-play-state: paused;
}

/* ============================================
   TOAST ACTION BUTTON (dla powiadomień z akcją)
   ============================================ */
.toast-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(6, 182, 212, 0.05));
    color: #14b8a6;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.toast-action:hover {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(6, 182, 212, 0.1));
    transform: translateX(2px);
}

.dark-mode .toast-action {
    color: #2dd4bf;
    background: rgba(20, 184, 166, 0.15);
}

.dark-mode .toast-action:hover {
    background: rgba(20, 184, 166, 0.25);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .toast-container {
        top: calc(12px + 52px + 12px) !important; /* mobile navbar offset */
        right: 12px !important;
        left: 12px !important;
        bottom: auto !important;
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .toast-container {
        top: calc(8px + 48px + 8px) !important; /* small mobile navbar offset */
        right: 8px !important;
        left: 8px !important;
        bottom: auto !important;
    }
    
    .toast {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .toast-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .toast-title {
        font-size: 13px;
    }
    
    .toast-message {
        font-size: 12px;
    }
}

/* ============================================
   STACKED TOASTS ANIMATION
   ============================================ */
.toast-container .toast:nth-child(2) {
    opacity: 0.95;
    transform: translateX(0) scale(0.98);
}

.toast-container .toast:nth-child(3) {
    opacity: 0.9;
    transform: translateX(0) scale(0.96);
}

.toast-container .toast:nth-child(n+4) {
    opacity: 0.85;
    transform: translateX(0) scale(0.94);
}

/* Pokazane toasty zachowują opacity podczas hover */
.toast-container .toast.show:nth-child(2):hover,
.toast-container .toast.show:nth-child(3):hover,
.toast-container .toast.show:nth-child(n+4):hover {
    opacity: 1;
    transform: translateX(-4px) scale(1);
}