﻿/* ===== ENTERPRISE TOAST NOTIFICATIONS - PROFESSIONAL UX/UI DESIGN ===== */

/* CSS Custom Properties for Design System */
:root {
    --toast-container-max-width: 336px;
    --toast-spacing: 12.8px;
    --toast-border-radius: 9.6px;
    --toast-backdrop-blur: 16px;
    --toast-shadow-color: rgba(0, 0, 0, 0.15);
    --toast-shadow-hover: rgba(0, 0, 0, 0.25);
    
    /* Colors - Professional Corporate Palette */
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.08);
    --color-success-border: rgba(16, 185, 129, 0.2);
    --color-success-text: #065f46;
    
    --color-error: #ef4444;
    --color-error-bg: rgba(239, 68, 68, 0.08);
    --color-error-border: rgba(239, 68, 68, 0.2);
    --color-error-text: #7f1d1d;
    
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.08);
    --color-warning-border: rgba(245, 158, 11, 0.2);
    --color-warning-text: #78350f;
    
    --color-info: #3b82f6;
    --color-info-bg: rgba(59, 130, 246, 0.08);
    --color-info-border: rgba(59, 130, 246, 0.2);
    --color-info-text: #1e3a8a;
    
    /* Neutral Colors */
    --color-neutral-50: #f9fafb;
    --color-neutral-100: #f3f4f6;
    --color-neutral-200: #e5e7eb;
    --color-neutral-300: #d1d5db;
    --color-neutral-400: #9ca3af;
    --color-neutral-500: #6b7280;
    --color-neutral-600: #4b5563;
    --color-neutral-700: #374151;
    --color-neutral-800: #1f2937;
    --color-neutral-900: #111827;
    
    /* Typography */
    --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Animation Variables */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index Scale */
    --z-toast-container: 9999;
    --z-toast-overlay: 10000;
}

/* ===== CONTAINER & LAYOUT ===== */

.terravix-notifications {
    position: fixed;
    top: 19.2px;
    right: 19.2px;
    z-index: var(--z-toast-container);
    display: flex;
    flex-direction: column;
    gap: var(--toast-spacing);
    max-width: var(--toast-container-max-width);
    width: 100%;
    pointer-events: none;
    font-family: var(--font-family-primary);
}

@media (max-width: 640px) {
    .terravix-notifications {
        top: 12.8px;
        right: 12.8px;
        left: 12.8px;
        max-width: none;
    }
}

/* ===== TOAST NOTIFICATION ===== */

.toast-notification {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(var(--toast-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--toast-backdrop-blur));
    border-radius: var(--toast-border-radius);
    border: 1px solid var(--color-neutral-200);
    box-shadow: 
        0 3.2px 4.8px -1px var(--toast-shadow-color),
        0 1.6px 3.2px -1px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(320px);
    opacity: 0;
    animation: slideInToast var(--transition-slow) var(--transition-fast) forwards;
    transition: 
        transform var(--transition-normal),
        opacity var(--transition-normal),
        box-shadow var(--transition-normal);
    min-height: 64px;
}

.toast-notification:hover {
    transform: translateY(-1.6px);
    box-shadow: 
        0 6.4px 20px -4px var(--toast-shadow-hover),
        0 3.2px 4.8px -1.6px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Toast Animation Keyframes */
@keyframes slideInToast {
    0% {
        transform: translateX(320px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOutToast {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(320px) scale(0.9);
        opacity: 0;
    }
}

/* ===== PROGRESS INDICATOR ===== */

.toast-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2.4px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    z-index: 10;
}

.progress-bar {
    height: 100%;
    width: 100%;
    transform: translateX(-100%);
    animation: progressAnimation linear forwards;
    border-radius: 0 0 1.6px 0;
}

@keyframes progressAnimation {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(0);
    }
}

/* ===== TOAST CONTENT ===== */

.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 9.6px;
    padding: 16px;
    padding-top: 18.4px; /* Account for progress bar */
}

/* ===== ICON STYLING ===== */

.toast-icon {
    flex-shrink: 0;
    width: 19.2px;
    height: 19.2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.6px;
    position: relative;
}

.toast-icon::before {
    content: '';
    position: absolute;
    inset: -3.2px;
    border-radius: 50%;
    opacity: 0.1;
    transition: opacity var(--transition-fast);
}

.icon-svg {
    width: 12.8px;
    height: 12.8px;
    stroke-width: 2.5;
    transition: transform var(--transition-fast);
}

.toast-notification:hover .icon-svg {
    transform: scale(1.1);
}

/* ===== TOAST BODY ===== */

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-header {
    margin-bottom: 6.4px;
}

.toast-title {
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-neutral-900);
    margin: 0 0 3.2px 0;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.toast-meta {
    display: flex;
    align-items: center;
    gap: 6.4px;
    font-size: 11px;
    color: var(--color-neutral-500);
    font-weight: var(--font-weight-medium);
}

.toast-time {
    display: flex;
    align-items: center;
    gap: 3.2px;
}

.toast-time::before {
    content: '•';
    color: var(--color-neutral-300);
}

.time-icon {
    width: 9.6px;
    height: 9.6px;
    margin-right: 1.6px;
}

.toast-category {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 11px;
    padding: 1.6px 4.8px;
    border-radius: 3.2px;
    font-weight: var(--font-weight-semibold);
}

.toast-message {
    margin: 0;
}

.toast-message p {
    font-size: 11.2px;
    color: var(--color-neutral-700);
    margin: 0;
    line-height: 1.5;
    word-wrap: break-word;
}

/* ===== CLOSE BUTTON ===== */

.toast-close {
    position: absolute;
    top: 12.8px;
    right: 12.8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 3.2px;
    border-radius: 4.8px;
    color: var(--color-neutral-400);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22.4px;
    height: 22.4px;
}

.toast-close:hover {
    background: var(--color-neutral-100);
    color: var(--color-neutral-600);
    transform: scale(1.1);
}

.toast-close:active {
    transform: scale(0.95);
}

.close-icon {
    width: 11.2px;
    height: 11.2px;
    stroke-width: 2.5;
}

/* ===== ACTION BUTTONS ===== */

.toast-actions {
    margin-top: 9.6px;
    display: flex;
    gap: 6.4px;
}

.btn-action {
    padding: 6.4px 12.8px;
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    border-radius: 4.8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4.8px;
    min-height: 25.6px;
    letter-spacing: -0.01em;
}

.btn-action:hover {
    transform: translateY(-1px);
}

.btn-action:active {
    transform: translateY(0);
}

.action-icon {
    width: 11.2px;
    height: 11.2px;
}

/* ===== TYPE-SPECIFIC STYLING ===== */

/* Success Toast */
.toast-success {
    border-left: 3.2px solid var(--color-success);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(16, 185, 129, 0.02) 100%);
}

.toast-success .toast-icon {
    color: var(--color-success);
    background: var(--color-success-bg);
}

.toast-success .toast-icon::before {
    background: var(--color-success);
}

.toast-success .progress-bar {
    background: linear-gradient(90deg, var(--color-success) 0%, rgba(16, 185, 129, 0.6) 100%);
}

.toast-success .toast-category {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success-border);
}

.toast-success .btn-action-success {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

.toast-success .btn-action-success:hover {
    background: #059669;
    border-color: #059669;
}

/* Error Toast */
.toast-error {
    border-left: 3.2px solid var(--color-error);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 68, 68, 0.02) 100%);
}

.toast-error .toast-icon {
    color: var(--color-error);
    background: var(--color-error-bg);
}

.toast-error .toast-icon::before {
    background: var(--color-error);
}

.toast-error .progress-bar {
    background: linear-gradient(90deg, var(--color-error) 0%, rgba(239, 68, 68, 0.6) 100%);
}

.toast-error .toast-category {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
}

.toast-error .btn-action-error {
    background: var(--color-error);
    color: white;
    border-color: var(--color-error);
}

.toast-error .btn-action-error:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* Warning Toast */
.toast-warning {
    border-left: 3.2px solid var(--color-warning);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 158, 11, 0.02) 100%);
}

.toast-warning .toast-icon {
    color: var(--color-warning);
    background: var(--color-warning-bg);
}

.toast-warning .toast-icon::before {
    background: var(--color-warning);
}

.toast-warning .progress-bar {
    background: linear-gradient(90deg, var(--color-warning) 0%, rgba(245, 158, 11, 0.6) 100%);
}

.toast-warning .toast-category {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.toast-warning .btn-action-warning {
    background: var(--color-warning);
    color: white;
    border-color: var(--color-warning);
}

.toast-warning .btn-action-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

/* Info Toast */
.toast-info {
    border-left: 3.2px solid var(--color-info);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(59, 130, 246, 0.02) 100%);
}

.toast-info .toast-icon {
    color: var(--color-info);
    background: var(--color-info-bg);
}

.toast-info .toast-icon::before {
    background: var(--color-info);
}

.toast-info .progress-bar {
    background: linear-gradient(90deg, var(--color-info) 0%, rgba(59, 130, 246, 0.6) 100%);
}

.toast-info .toast-category {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border: 1px solid var(--color-info-border);
}

.toast-info .btn-action-info {
    background: var(--color-info);
    color: white;
    border-color: var(--color-info);
}

.toast-info .btn-action-info:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) and (max-width: 0px) { /* Tema oscuro deshabilitado: la app siempre usa tema claro */
    .toast-notification {
        background: rgba(31, 41, 55, 0.95);
        border-color: var(--color-neutral-700);
        color: var(--color-neutral-100);
    }
    
    .toast-title {
        color: var(--color-neutral-100);
    }
    
    .toast-message p {
        color: var(--color-neutral-300);
    }
    
    .toast-close {
        color: var(--color-neutral-500);
    }
    
    .toast-close:hover {
        background: var(--color-neutral-800);
        color: var(--color-neutral-300);
    }
    
    .progress-bar {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

@media (prefers-reduced-motion: reduce) {
    .toast-notification,
    .progress-bar,
    .icon-svg,
    .btn-action,
    .toast-close {
        animation: none;
        transition: none;
    }
    
    .toast-notification:hover {
        transform: none;
    }
}

/* Focus styles for accessibility */
.toast-close:focus-visible {
    outline: 1.6px solid var(--color-info);
    outline-offset: 1.6px;
}

.btn-action:focus-visible {
    outline: 1.6px solid var(--color-info);
    outline-offset: 1.6px;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 480px) {
    .toast-content {
        padding: 12.8px;
        padding-top: 15.2px;
        gap: 8px;
    }
    
    .toast-title {
        font-size: 11.2px;
    }
    
    .toast-message p {
        font-size: 11px;
    }
    
    .toast-close {
        top: 9.6px;
        right: 9.6px;
        width: 19.2px;
        height: 19.2px;
    }
    
    .close-icon {
        width: 9.6px;
        height: 9.6px;
    }
}

/* ===== HIGH CONTRAST MODE ===== */

@media (prefers-contrast: high) {
    .toast-notification {
        border-width: 1.6px;
        box-shadow: none;
    }
    
    .toast-close:hover {
        outline: 1.6px solid currentColor;
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    .terravix-notifications {
        display: none;
    }
}

/* ===== ADDITIONAL ENHANCEMENTS ===== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.toast-hovered {
    z-index: 10001;
}

.reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}
