/* =====================================================
   CARBON UPDATES - CUSTOM NOTIFICATION SYSTEM
   Professional toast notifications and confirmation modals
   Future-proof, mobile-responsive, accessible
   ===================================================== */

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */

/* Toast Container - Holds all active toasts */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
    max-width: 400px;
}

/* Individual Toast */
.toast {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    padding: 16px 20px;
    margin-bottom: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    pointer-events: all;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid #ccc;
    overflow: hidden;
}

/* Toast hover effect */
.toast:hover {
    transform: translateX(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* Toast being dismissed */
.toast.removing {
    animation: slideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateX(100%);
}

/* Toast icon */
.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
}

/* Toast content */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    color: #333;
}

.toast-message {
    font-size: 14px;
    line-height: 1.4;
    color: #666;
    word-wrap: break-word;
}

/* Toast close button */
.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.toast:hover .toast-close {
    opacity: 1;
}

.toast-close:hover {
    color: #333;
}

/* Progress bar for auto-dismiss */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    animation: progressBar linear;
    transform-origin: left;
}

/* Toast Types - Color Themes */
.toast.success {
    border-left-color: #4caf50;
}

.toast.success .toast-icon {
    color: #4caf50;
}

.toast.success .toast-progress {
    background: #4caf50;
}

.toast.error {
    border-left-color: #f44336;
}

.toast.error .toast-icon {
    color: #f44336;
}

.toast.error .toast-progress {
    background: #f44336;
}

.toast.warning {
    border-left-color: #ff9800;
}

.toast.warning .toast-icon {
    color: #ff9800;
}

.toast.warning .toast-progress {
    background: #ff9800;
}

.toast.info {
    border-left-color: #2196f3;
}

.toast.info .toast-icon {
    color: #2196f3;
}

.toast.info .toast-progress {
    background: #2196f3;
}

/* =====================================================
   CONFIRMATION MODALS
   ===================================================== */

/* Modal Overlay */
.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.notification-overlay.removing {
    animation: fadeOut 0.2s ease-out;
}

/* Modal Container */
.notification-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-overlay.removing .notification-modal {
    animation: modalSlideOut 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal Header */
.notification-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.notification-modal-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.notification-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

/* Modal Body */
.notification-modal-body {
    padding: 24px;
}

.notification-modal-message {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 0;
}

/* Modal Footer */
.notification-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px 24px;
}

.notification-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.notification-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.notification-btn:active {
    transform: translateY(0);
}

.notification-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.notification-btn-cancel:hover {
    background: #e0e0e0;
    color: #333;
}

.notification-btn-confirm {
    background: #4caf50;
    color: white;
}

.notification-btn-confirm:hover {
    background: #45a049;
}

.notification-btn-danger {
    background: #f44336;
    color: white;
}

.notification-btn-danger:hover {
    background: #e53935;
}

.notification-btn-primary {
    background: #2196f3;
    color: white;
}

.notification-btn-primary:hover {
    background: #1e88e5;
}

/* Modal Type Styling */
.notification-modal.success .notification-modal-icon {
    color: #4caf50;
}

.notification-modal.error .notification-modal-icon,
.notification-modal.danger .notification-modal-icon {
    color: #f44336;
}

.notification-modal.warning .notification-modal-icon {
    color: #ff9800;
}

.notification-modal.info .notification-modal-icon {
    color: #2196f3;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
}

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

/* =====================================================
   MOBILE RESPONSIVE
   ===================================================== */

@media (max-width: 768px) {
    #toast-container {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        max-width: 100%;
        padding: 0;
    }

    .toast {
        min-width: 100%;
        max-width: 100%;
        margin-bottom: 0;
        border-radius: 0;
        border-left: none;
        border-top: 4px solid #ccc;
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .toast.success {
        border-top-color: #4caf50;
    }

    .toast.error {
        border-top-color: #f44336;
    }

    .toast.warning {
        border-top-color: #ff9800;
    }

    .toast.info {
        border-top-color: #2196f3;
    }

    .toast.removing {
        animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateY(100%);
    }

    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes slideDown {
        from {
            opacity: 1;
            transform: translateY(0);
        }
        to {
            opacity: 0;
            transform: translateY(100%);
        }
    }

    .notification-modal {
        max-width: 100%;
        margin: 0;
        border-radius: 12px 12px 0 0;
        align-self: flex-end;
    }

    .notification-modal-footer {
        flex-direction: column-reverse;
    }

    .notification-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .toast {
        padding: 14px 16px;
        font-size: 14px;
    }

    .toast-icon {
        font-size: 20px;
        width: 24px;
    }

    .notification-modal-header {
        padding: 20px 20px 12px;
    }

    .notification-modal-body {
        padding: 20px;
    }

    .notification-modal-footer {
        padding: 12px 20px 20px;
    }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */

/* Focus styles for keyboard navigation */
.notification-btn:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.toast:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .notification-overlay,
    .notification-modal,
    .notification-btn {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .toast {
        border: 2px solid currentColor;
    }

    .notification-modal {
        border: 2px solid #000;
    }
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
