/* ============================================
   WREN DESIGN SYSTEM - TOASTS
   Toast notifications with semantic colors
   ============================================ */

/* TOAST CONTAINER */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
    max-width: 400px;
    width: 100%;
}

/* TOAST */
.toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--white);
    border: var(--border-width) solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    opacity: 0;
    transform: translateX(400px);
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-sans);
    min-width: 320px;
    max-width: 100%;
}

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

.toast.hide {
    opacity: 0;
    transform: translateX(400px);
}

/* TOAST ICON */
.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    border-radius: var(--radius-full);
}

.toast-icon i {
    font-size: 18px;
}

/* TOAST CONTENT */
.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--black);
    margin-bottom: var(--space-1);
    line-height: 1.4;
}

.toast-message {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-600);
    line-height: 1.5;
}

/* TOAST CLOSE BUTTON */
.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    color: var(--gray-400);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    transition: all var(--transition);
    font-size: 14px;
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.toast-close:active {
    transform: scale(0.9);
}

/* TOAST VARIANTS - Success */
.toast-success {
    border-left: 4px solid var(--success);
}

.toast-success .toast-icon {
    background: var(--success-light);
    color: var(--success);
}

/* TOAST VARIANTS - Error */
.toast-error {
    border-left: 4px solid var(--error);
}

.toast-error .toast-icon {
    background: var(--error-light);
    color: var(--error);
}

/* TOAST VARIANTS - Warning */
.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-warning .toast-icon {
    background: var(--warning-light);
    color: var(--warning);
}

/* TOAST VARIANTS - Info */
.toast-info {
    border-left: 4px solid var(--info);
}

.toast-info .toast-icon {
    background: var(--info-light);
    color: var(--info);
}

/* TOAST WITH ACTION BUTTON */
.toast-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: var(--border-width) solid var(--gray-200);
}

.toast-action-btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: var(--border-width) solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-display); /* Space Grotesk for uniformity */
}

.toast-action-btn-primary {
    background: var(--gray-900);
    color: var(--white);
    border-color: var(--gray-900);
}

.toast-action-btn-primary:hover {
    background: var(--black);
    border-color: var(--black);
}

.toast-action-btn-secondary {
    background: transparent;
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.toast-action-btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .toast-container {
        top: var(--space-4);
        right: var(--space-4);
        left: var(--space-4);
        max-width: none;
    }

    .toast {
        min-width: 0;
        width: 100%;
        transform: translateY(-100px);
    }

    .toast.show {
        transform: translateY(0);
    }

    .toast.hide {
        transform: translateY(-100px);
    }
}


/* ============================================
   WARNING BANNERS (Top of page alerts)
   ============================================ */

.warning-banners-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
}

.warning-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 500;
    animation: slideDown 300ms ease-out;
}

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

.warning-banner.hiding {
    animation: slideUp 300ms ease-out forwards;
}

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

.warning-banner-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    justify-content: center;
}

.warning-banner-icon {
    font-size: var(--text-base);
    opacity: 0.8;
}

.warning-banner-message {
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 100%;
}

.warning-banner-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Upgrade link with arrow */
.warning-banner-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    opacity: 0.9;
    transition: all var(--transition);
    white-space: nowrap;
}

.warning-banner-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.warning-banner-link::after {
    content: '\2192';
    font-size: var(--text-base);
    transition: transform var(--transition);
}

.warning-banner-link:hover::after {
    transform: translateX(3px);
}

/* Count badge for multiple warnings */
.warning-banner-count {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    margin-left: 12px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.15) !important;
    color: inherit !important;
    flex-shrink: 0;
    position: relative;
}

/* Custom tooltip for count badge */
.warning-banner-count::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: pre-line;
    min-width: 150px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.warning-banner-count:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Banner Severity Variants - Lighter colors */
.warning-banner-info {
    background: #E0F2FE;
    color: #0369A1;
}

.warning-banner-warning {
    background: #FEF3C7;
    color: #92400E;
}

.warning-banner-warning .warning-banner-count {
    background: rgba(146, 64, 14, 0.15);
    color: #92400E;
}

.warning-banner-error {
    background: #FEE2E2;
    color: #B91C1C;
}

.warning-banner-error .warning-banner-count {
    background: rgba(185, 28, 28, 0.15);
    color: #B91C1C;
}

.warning-banner-critical {
    background: var(--gray-100);
    color: var(--gray-900);
}

.warning-banner-critical .warning-banner-count {
    background: rgba(0, 0, 0, 0.1);
}

/* ============================================
   WARNING BANNER - LAYOUT COORDINATION
   Uses CSS custom property for dynamic offset
   ============================================ */

/* Set default banner height */
:root {
    --warning-banner-height: 0px;
}

/* When banner is present, set the height variable */
body.has-warning-banners {
    --warning-banner-height: 44px;
    padding-top: var(--warning-banner-height);
}

/* Navbar should offset by banner height */
body.has-warning-banners .navbar {
    top: var(--warning-banner-height);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .warning-banner {
        padding: var(--space-2) var(--space-4);
        flex-direction: row;
        align-items: center;
        gap: var(--space-2);
        font-size: var(--text-xs);
        min-height: 40px;
    }

    .warning-banner-content {
        flex: 1;
        justify-content: flex-start;
        gap: var(--space-2);
        min-width: 0;
    }

    .warning-banner-icon {
        font-size: var(--text-sm);
        flex-shrink: 0;
    }

    .warning-banner-message {
        flex: 1;
        min-width: 0;
        -webkit-line-clamp: 1;
        font-size: var(--text-xs);
        line-height: 1.3;
    }

    .warning-banner-actions {
        flex-shrink: 0;
        gap: var(--space-2);
    }

    .warning-banner-link {
        font-size: var(--text-xs);
        padding: var(--space-1) var(--space-2);
    }

    /* Count badge - clickable on mobile */
    .warning-banner-count {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
        padding: 0 8px;
        margin-left: var(--space-2);
    }

    /* Hide tooltip on mobile - use tap instead */
    .warning-banner-count::after {
        display: none !important;
    }

    body.has-warning-banners {
        --warning-banner-height: 40px;
        padding-top: var(--warning-banner-height);
    }
}

@media (max-width: 480px) {
    .warning-banner {
        padding: var(--space-2) var(--space-3);
        min-height: 36px;
    }

    .warning-banner-message {
        font-size: 11px;
    }

    .warning-banner-link {
        font-size: 11px;
    }

    body.has-warning-banners {
        --warning-banner-height: 36px;
        padding-top: var(--warning-banner-height);
    }
}

/* ============================================
   MOBILE WARNINGS MODAL
   Consistent with standard modal design system
   ============================================ */

.warnings-mobile-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) + 10);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.warnings-mobile-modal.active {
    display: flex;
}

.warnings-mobile-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: warningsFadeIn 0.2s ease;
}

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

.warnings-mobile-sheet {
    position: relative;
    width: 100%;
    max-height: 70vh;
    background: var(--white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border: var(--border-width) solid var(--black);
    border-bottom: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: warningsSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

@keyframes warningsSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.warnings-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: var(--border-width) solid var(--black);
    background: var(--white);
    flex-shrink: 0;
}

.warnings-mobile-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--black);
    margin: 0;
    letter-spacing: -0.02em;
}

.warnings-mobile-close {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: var(--border-width) solid var(--gray-300);
    border-radius: var(--radius-full);
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
}

.warnings-mobile-close:active {
    background: var(--gray-100);
    transform: scale(0.95);
}

.warnings-mobile-list {
    padding: var(--space-4);
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.warnings-mobile-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--gray-100);
}

.warnings-mobile-item:last-child {
    border-bottom: none;
}

.warnings-mobile-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    font-size: 12px;
}

.warnings-mobile-item-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.warnings-mobile-item-icon.error {
    background: var(--error-light);
    color: var(--error);
}

.warnings-mobile-item-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.warnings-mobile-item-icon.critical {
    background: var(--error-light);
    color: var(--error);
}

.warnings-mobile-item-content {
    flex: 1;
    min-width: 0;
}

.warnings-mobile-item-title {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--black);
    margin: 0;
    line-height: 1.3;
}

.warnings-mobile-item-message {
    font-size: var(--text-xs);
    color: var(--gray-600);
    line-height: 1.4;
    margin: var(--space-1) 0 0 0;
}

/* Single footer with one action button */
.warnings-mobile-footer {
    padding: var(--space-4);
    border-top: var(--border-width) solid var(--black);
    background: var(--white);
    flex-shrink: 0;
}

.warnings-mobile-footer .btn {
    width: 100%;
    justify-content: center;
}


/* ============================================
   BILLING WARNING MODAL
   Dismissable modal for billing/payment warnings
   ============================================ */

.billing-warning-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) + 20);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.billing-warning-modal.active {
    display: flex;
}

.billing-warning-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: billingFadeIn 0.2s ease;
}

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

.billing-warning-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius-2xl);
    border: var(--border-width-thick) solid var(--black);
    padding: var(--space-8);
    text-align: center;
    animation: billingSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-2xl);
}

@keyframes billingSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.billing-warning-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 28px;
}

/* Severity-based icon colors */
.billing-warning-content.severity-error .billing-warning-icon {
    background: var(--error-light);
    color: var(--error);
}

.billing-warning-content.severity-warning .billing-warning-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.billing-warning-content.severity-critical .billing-warning-icon {
    background: var(--error-light);
    color: var(--error);
}

.billing-warning-content.severity-info .billing-warning-icon {
    background: var(--info-light);
    color: var(--info);
}

.billing-warning-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--black);
    margin: 0 0 var(--space-3) 0;
    letter-spacing: -0.02em;
}

.billing-warning-message {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--gray-600);
    line-height: 1.6;
    margin: 0 0 var(--space-6) 0;
}

.billing-warning-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.billing-warning-action {
    width: 100%;
    justify-content: center;
}

.billing-warning-dismiss {
    width: 100%;
    justify-content: center;
    background: transparent;
    color: var(--gray-500);
    border: none;
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-2);
    transition: color var(--transition);
}

.billing-warning-dismiss:hover {
    color: var(--gray-700);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .billing-warning-modal {
        padding: var(--space-4);
        align-items: flex-end;
    }

    .billing-warning-content {
        max-width: none;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        padding: var(--space-6);
        animation: billingSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

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

    .billing-warning-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .billing-warning-title {
        font-size: var(--text-lg);
    }

    .billing-warning-message {
        font-size: var(--text-sm);
    }
}
