/* Notification System Styles */

:root {
    --notification-z-index: 10000;
    --notification-width: 380px;
    --notification-gap: 12px;
}

/* Toast Container */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: var(--notification-width);
    z-index: var(--notification-z-index);
    display: flex;
    flex-direction: column;
    gap: var(--notification-gap);
    pointer-events: none;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Allow clicks through empty areas */
}

body.cart-sidebar-open #notification-container {
    top: 20px;
    right: 440px;
    /* sidebar (400px) + margin (20px) */
}

@media (max-width: 768px) {
    body.cart-sidebar-open #notification-container {
        top: calc(72px + env(safe-area-inset-top, 0px));
        right: 14px;
        width: min(360px, calc(100vw - 28px));
    }
}

/* Toast Item */
.notification-toast {
    position: relative;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    transform-origin: top center;
    animation: notificationSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
    overflow: hidden;
    cursor: default;
    transition: all 0.2s ease;
}

.notification-toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.notification-toast.hiding {
    animation: notificationSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Progress Bar */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor);
    width: 100%;
    opacity: 0.3;
    animation: notificationProgress linear forwards;
}

/* Icon */
.notification-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Content */
.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
}

.notification-message {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.5;
}

/* Close Button */
.notification-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-top: -4px;
    margin-right: -8px;
}

.notification-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Variants */
.notification-success {
    border-left: 4px solid #10b981;
}

.notification-success .notification-icon {
    color: #10b981;
}

.notification-success .notification-progress {
    color: #10b981;
}

.notification-error {
    border-left: 4px solid #ef4444;
}

.notification-error .notification-icon {
    color: #ef4444;
}

.notification-error .notification-progress {
    color: #ef4444;
}

.notification-warning {
    border-left: 4px solid #f59e0b;
}

.notification-warning .notification-icon {
    color: #f59e0b;
}

.notification-warning .notification-progress {
    color: #f59e0b;
}

.notification-info {
    border-left: 4px solid #3b82f6;
}

.notification-info .notification-icon {
    color: #3b82f6;
}

.notification-info .notification-progress {
    color: #3b82f6;
}

/* Light Theme */
:root[data-theme="light"] .notification-toast {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(15, 23, 42, 0.14);
    box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.24);
}

:root[data-theme="light"] .notification-toast:hover {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 16px 32px -10px rgba(15, 23, 42, 0.28);
}

:root[data-theme="light"] .notification-title {
    color: #0f172a;
}

:root[data-theme="light"] .notification-message {
    color: #475569;
}

:root[data-theme="light"] .notification-close {
    color: #64748b;
}

:root[data-theme="light"] .notification-close:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .notification-progress {
    opacity: 0.48;
}

:root[data-theme="light"] .notification-success {
    border-left-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(255, 255, 255, 0.96));
}

:root[data-theme="light"] .notification-error {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(255, 255, 255, 0.96));
}

:root[data-theme="light"] .notification-warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(255, 255, 255, 0.96));
}

:root[data-theme="light"] .notification-info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.96));
}

/* Animations */
@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes notificationSlideOut {
    to {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
        height: 0;
        padding: 0;
        margin: 0;
        border: 0;
    }
}

@keyframes notificationProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* Confirmation Modal */
#confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10001;
    /* Higher than toasts */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.confirm-modal {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 32px;
    width: 440px;
    max-width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    opacity: 0;
    animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.confirm-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    margin-bottom: 24px;
}

.confirm-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.confirm-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.05);
}

.confirm-icon-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.05);
}

.confirm-icon-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.05);
}

.confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.confirm-message {
    font-size: 0.95rem;
    color: #94a3b8;
    line-height: 1.6;
    margin: 0;
}

.confirm-input-wrap {
    width: 100%;
    text-align: left;
    margin-top: 6px;
}

.confirm-input-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
}

.confirm-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.82);
    color: #e2e8f0;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.confirm-input:focus {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.confirm-input.is-error {
    border-color: rgba(239, 68, 68, 0.9);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    flex: 1;
}

.confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.confirm-btn-confirm {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.confirm-btn-confirm:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

:root[data-theme="light"] #confirm-modal-overlay {
    background: rgba(15, 23, 42, 0.32);
}

:root[data-theme="light"] .confirm-modal {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.14);
    box-shadow: 0 22px 44px -14px rgba(15, 23, 42, 0.32);
}

:root[data-theme="light"] .confirm-title {
    color: #0f172a;
}

:root[data-theme="light"] .confirm-message,
:root[data-theme="light"] .confirm-input-label {
    color: #475569;
}

:root[data-theme="light"] .confirm-input {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.2);
    color: #0f172a;
}

:root[data-theme="light"] .confirm-btn-cancel {
    background: rgba(15, 23, 42, 0.06);
    color: #334155;
    border-color: rgba(15, 23, 42, 0.12);
}

:root[data-theme="light"] .confirm-btn-cancel:hover {
    background: rgba(15, 23, 42, 0.1);
    color: #0f172a;
}

/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}
