/* Enhanced UI/UX Improvements for FUNO Project */

/* ===== MODERN DESIGN TOKENS ===== */
:root {
    /* Enhanced Color Palette */
    --color-primary-50: #fff7ed;
    --color-primary-100: #ffedd5;
    --color-primary-200: #fed7aa;
    --color-primary-300: #fdba74;
    --color-primary-400: #fb923c;
    --color-primary-500: #f97316;
    --color-primary-600: #ea580c;
    --color-primary-700: #c2410c;
    --color-primary-800: #9a3412;
    --color-primary-900: #7c2d12;

    /* Neutral Palette */
    --color-neutral-50: #fafafa;
    --color-neutral-100: #f5f5f5;
    --color-neutral-200: #e5e5e5;
    --color-neutral-300: #d4d4d4;
    --color-neutral-400: #a3a3a3;
    --color-neutral-500: #737373;
    --color-neutral-600: #525252;
    --color-neutral-700: #404040;
    --color-neutral-800: #262626;
    --color-neutral-900: #171717;

    /* Semantic Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Enhanced Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

    /* Enhanced Gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary-600) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--color-neutral-700) 0%, var(--color-neutral-800) 100%);
    --gradient-surface: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    --gradient-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* Enhanced Border Radius */
    --radius-xs: 0.125rem;
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-3xl: 1.5rem;
    --radius-full: 9999px;

    /* Enhanced Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Enhanced Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    /* Enhanced Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ===== ENHANCED GLASS MORPHISM EFFECTS ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-xl);
}

.glass-dark {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== ENHANCED BUTTON SYSTEM ===== */
.btn-enhanced {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
    border: none;
    outline: none;
    user-select: none;
}

.btn-enhanced::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.btn-enhanced:hover::before {
    left: 100%;
}

.btn-enhanced:focus-visible {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
}

.btn-enhanced:active {
    transform: translateY(1px);
}

/* Button Variants */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--color-neutral-700);
    border: 1px solid var(--color-neutral-300);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--color-neutral-50);
    border-color: var(--color-neutral-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--color-neutral-600);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: var(--color-neutral-100);
    color: var(--color-neutral-800);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
}

.btn-lg {
    padding: 1rem 2rem;
}

.btn-xl {
    padding: 1.25rem 2.5rem;
}

/* ===== ENHANCED FORM SYSTEM ===== */
.form-group-enhanced {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-label-enhanced {
    display: block;
    font-weight: 600;
    color: var(--color-neutral-700);
    margin-bottom: 0.5rem;
    transition: color var(--transition-fast);
}

.form-input-enhanced {
    width: 100%;
    padding: 0.875rem 1rem;
    color: var(--color-neutral-900);
    background: white;
    border: 2px solid var(--color-neutral-200);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    outline: none;
    box-shadow: var(--shadow-xs);
}

.form-input-enhanced::placeholder {
    color: var(--color-neutral-400);
    font-weight: 400;
}

.form-input-enhanced:focus {
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1), var(--shadow-sm);
    transform: translateY(-1px);
}

.form-input-enhanced:hover:not(:focus) {
    border-color: var(--color-neutral-300);
    box-shadow: var(--shadow-sm);
}

/* Input States */
.form-input-enhanced.is-valid {
    border-color: var(--color-success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2310b981'%3e%3cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    padding-right: 2.5rem;
}

.form-input-enhanced.is-invalid {
    border-color: var(--color-error);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23ef4444'%3e%3cpath fill-rule='evenodd' d='M18 10a8 8 0 11-16 0 8 8 0 0116 0zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    padding-right: 2.5rem;
}

/* Floating Label Effect */
.form-floating {
    position: relative;
}

.form-floating .form-input-enhanced {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
}

.form-floating .form-label-enhanced {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 1rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: all var(--transition-normal);
    margin-bottom: 0;
}

.form-floating .form-input-enhanced:focus~.form-label-enhanced,
.form-floating .form-input-enhanced:not(:placeholder-shown)~.form-label-enhanced {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* ===== ENHANCED CARD SYSTEM ===== */
.card-enhanced {
    background: var(--gradient-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-normal);
    overflow: hidden;
    position: relative;
}

.card-enhanced::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.3), transparent);
}

.card-enhanced:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-2xl);
    border-color: rgba(249, 115, 22, 0.2);
}

.card-header-enhanced {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--color-neutral-100);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.8) 100%);
}

.card-body-enhanced {
    padding: 1.5rem;
}

.card-footer-enhanced {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--color-neutral-100);
    background: rgba(248, 250, 252, 0.5);
}

/* ===== ENHANCED PROGRESS INDICATORS ===== */
.progress-enhanced {
    position: relative;
    width: 100%;
    height: 0.5rem;
    background: var(--color-neutral-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: var(--shadow-inner);
}

.progress-bar-enhanced {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.progress-bar-enhanced::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(-45deg,
            rgba(255, 255, 255, 0.2) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0.2) 75%,
            transparent 75%,
            transparent);
    background-size: 1rem 1rem;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% {
        background-position: 1rem 0;
    }

    100% {
        background-position: 0 0;
    }
}

/* Step Progress */
.step-progress-enhanced {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 1rem 0;
}

.step-progress-enhanced::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-neutral-200);
    transform: translateY(-50%);
    z-index: 1;
}

.step-progress-line {
    position: absolute;
    top: 50%;
    left: 0;
    height: 2px;
    background: var(--gradient-primary);
    transform: translateY(-50%);
    transition: width var(--transition-slow);
    z-index: 2;
}

.step-item-enhanced {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.step-circle-enhanced {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all var(--transition-normal);
    border: 2px solid var(--color-neutral-300);
    background: white;
    color: var(--color-neutral-500);
    box-shadow: var(--shadow-sm);
}

.step-circle-enhanced.active {
    border-color: var(--color-primary-500);
    background: var(--gradient-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.step-circle-enhanced.completed {
    border-color: var(--color-success);
    background: var(--color-success);
    color: white;
    box-shadow: var(--shadow-md);
}

.step-circle-enhanced.completed::before {
    content: "✓";
}

/* ===== ENHANCED LOADING STATES ===== */
.skeleton-enhanced {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.spinner-enhanced {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--color-neutral-200);
    border-top: 2px solid var(--color-primary-500);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.spinner-dots {
    display: flex;
    gap: 0.25rem;
}

.spinner-dot {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--color-primary-500);
    border-radius: var(--radius-full);
    animation: dot-bounce 1.4s ease-in-out infinite both;
}

.spinner-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.spinner-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dot-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* ===== ENHANCED NOTIFICATIONS ===== */
.notification-enhanced {
    position: fixed;
    top: 1rem;
    right: 1rem;
    max-width: 24rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--color-neutral-200);
    overflow: hidden;
    transform: translateX(100%);
    transition: transform var(--transition-bounce);
    z-index: 1000;
}

.notification-enhanced.show {
    transform: translateX(0);
}

.notification-header {
    padding: 1rem 1rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.success {
    background: var(--color-success);
    color: white;
}

.notification-icon.error {
    background: var(--color-error);
    color: white;
}

.notification-icon.warning {
    background: var(--color-warning);
    color: white;
}

.notification-icon.info {
    background: var(--color-info);
    color: white;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: var(--color-neutral-900);
    margin-bottom: 0.25rem;
}

.notification-message {
    color: var(--color-neutral-600);
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--color-neutral-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.notification-close:hover {
    color: var(--color-neutral-600);
    background: var(--color-neutral-100);
}

.notification-progress {
    height: 3px;
    background: var(--color-neutral-100);
    overflow: hidden;
}

.notification-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 100%;
    animation: notification-progress 5s linear;
}

@keyframes notification-progress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

/* ===== ENHANCED MODAL SYSTEM ===== */
.modal-enhanced {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-enhanced.show {
    opacity: 1;
    visibility: visible;
}

.modal-content-enhanced {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    max-width: 32rem;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(1rem);
    transition: transform var(--transition-bounce);
}

.modal-enhanced.show .modal-content-enhanced {
    transform: scale(1) translateY(0);
}

/* Add to your enhanced-ui.css file */
.chat-captcha-container {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#chatFacturarCaptcha.captcha-container {
    max-width: 100%;
    margin: 0 auto;
}

/* ===== ENHANCED ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(2rem);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-soft {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

@keyframes bounce-soft {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-0.25rem);
    }
}

/* Animation Classes */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.4s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

.animate-pulse-soft {
    animation: pulse-soft 2s ease-in-out infinite;
}

.animate-bounce-soft {
    animation: bounce-soft 1s ease-in-out infinite;
}

/* ===== ENHANCED RESPONSIVE UTILITIES ===== */
@media (max-width: 640px) {
    .btn-enhanced {
        padding: 0.75rem 1.25rem;
    }

    .card-enhanced {
        border-radius: var(--radius-xl);
        margin: 0.5rem;
    }


    .notification-enhanced {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* ===== ENHANCED FOCUS MANAGEMENT ===== */
.focus-ring {
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: outline-color var(--transition-fast);
}

.focus-ring:focus-visible {
    outline-color: var(--color-primary-500);
}

/* ===== ENHANCED ACCESSIBILITY ===== */
.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;
}

/* Ensure notification container is at the highest level */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 40px);
    pointer-events: none;
}

/* Allow interaction with notification buttons */
#notification-container .notification {
    pointer-events: auto;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-enhanced {
        border: 2px solid currentColor;
    }

    .form-input-enhanced {
        border-width: 2px;
    }

    .card-enhanced {
        border-width: 2px;
    }
}