/**
 * CDT Alerts & Toasts — Styles
 * 
 * Sistema centralizado de alertas con diseño premium.
 * Incluye estilos para alertas estáticas y notificaciones (toasts).
 */

:root {
    --cdt-alert-success: #10b981; /* Teal */
    --cdt-alert-error: #ef4444;   /* Red */
    --cdt-alert-info: #3b82f6;    /* Blue */
    --cdt-alert-warning: #f59e0b; /* Orange */
}

/* ─── Estilos Base de Alerta ────────────────────────────────────────────── */

.cdt-alert {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Glassmorphism subtle effect */
.cdt-alert::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.cdt-alert__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.cdt-alert__content {
    flex: 1;
}

.cdt-alert__content a {
    font-weight: 700;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cdt-alert__close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    font-size: 18px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.cdt-alert__close:hover {
    color: #4b5563;
}

/* ─── Variantes de Color ────────────────────────────────────────────────── */

/* Success */
.cdt-alert--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}
.cdt-alert--success .cdt-alert__icon {
    color: var(--cdt-alert-success);
}

/* Error */
.cdt-alert--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.cdt-alert--error .cdt-alert__icon {
    color: var(--cdt-alert-error);
}

/* Info / Notice */
.cdt-alert--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.cdt-alert--info .cdt-alert__icon {
    color: var(--cdt-alert-info);
}

/* ─── WooCommerce Compatibility ─────────────────────────────────────────── */

/* Pisamos los estilos por defecto de WC para que sean consistentes */
.woocommerce-message, 
.woocommerce-error, 
.woocommerce-info {
    margin: 0 0 24px !important;
    padding: 16px 20px !important;
    border-radius: 12px !important;
    border: 1px solid #e0e0e0 !important;
    background: #ffffff !important;
    color: #374151 !important;
    list-style: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.woocommerce-error {
    border-color: #ef4444 !important;
}

.woocommerce-error li {
    margin: 0 !important;
    padding: 0 !important;
}

/* Ocultar iconos de WC */
.woocommerce-message::before, 
.woocommerce-error::before, .woocommerce-info::before {
    display: none !important;
}


/* ─── TOAST SYSTEM ───────────────────────────────────────────────────────── */

#cdt-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.cdt-toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border-radius: 16px;
    transform: translateX(120%);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
}

.cdt-toast.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.cdt-toast.is-leaving {
    transform: translateX(120%);
    opacity: 0;
}

@media (max-width: 600px) {
    #cdt-toast-container {
        top: auto;
        bottom: 24px;
        right: 12px;
        left: 12px;
        width: calc(100% - 24px);
    }
    
    .cdt-toast {
        transform: translateY(120%);
    }
    
    .cdt-toast.is-visible {
        transform: translateY(0);
    }
    
    .cdt-toast.is-leaving {
        transform: translateY(120%);
    }
}

/* ─── WooCommerce Links in Alerts/Toasts ───────────────────────────────── */

.cdt-alert .button.wc-forward,
.cdt-toast .button.wc-forward {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 0 10px !important;
    color: inherit !important;
    font-weight: 700 !important;
    font-size: inherit !important;
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
    box-shadow: none !important;
    cursor: pointer !important;
    display: inline-block !important;
    height: auto !important;
    line-height: inherit !important;
    vertical-align: baseline !important;
}

.cdt-alert .button.wc-forward:hover,
.cdt-toast .button.wc-forward:hover {
    background: transparent !important;
    color: var(--tdr-color-primary) !important;
}
