/* Custom Styles for Digiten */

/* Menu Navigation Styles */
.nav-link {
    position: relative;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    display: inline-block;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(30, 64, 175, 0.1), transparent);
    transition: left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #1e40af, #3b82f6);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateX(-50%);
    border-radius: 2px;
    z-index: 1;
}

.nav-link:hover {
    color: #1e40af !important;
    transform: translateY(-2px);
    background: rgba(30, 64, 175, 0.05);
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.15);
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link:active {
    transform: translateY(-1px);
}

/* Active Navigation State */
.nav-link.active {
    color: #1e40af !important;
    background: rgba(30, 64, 175, 0.08);
}

.nav-link.active::after {
    width: 100%;
    background: linear-gradient(90deg, #1e40af, #dc2626);
}

/* Mobile Menu Enhanced Styles */
#mobileMenu .nav-link {
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    margin: 4px 0;
}

#mobileMenu .nav-link:hover {
    border-left-color: #1e40af;
    background: rgba(30, 64, 175, 0.1);
    padding-left: 20px;
    transform: translateX(8px);
}

#mobileMenu .nav-link.active {
    border-left-color: #dc2626;
    background: rgba(30, 64, 175, 0.1);
    color: #1e40af !important;
}

/* Logo Enhanced Hover */
.logo-container {
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo-container svg {
    transition: all 0.3s ease;
}

.logo-container:hover svg {
    filter: drop-shadow(0 4px 8px rgba(30, 64, 175, 0.3));
}

/* Control Buttons Enhanced */
#themeToggle, #langToggle {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#themeToggle::before, #langToggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(30, 64, 175, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

#themeToggle:hover::before, #langToggle:hover::before {
    width: 100px;
    height: 100px;
}

#themeToggle:hover, #langToggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.2);
}

/* Mobile Menu Toggle Enhanced */
#mobileMenuToggle {
    transition: all 0.3s ease;
}

#mobileMenuToggle:hover {
    transform: scale(1.1) rotate(90deg);
    color: #1e40af;
}

/* Header Backdrop Enhanced */
header {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(30, 64, 175, 0.02), transparent);
    transition: left 2s ease;
    opacity: 0;
}

header:hover::before {
    left: 100%;
    opacity: 1;
}

header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(30, 64, 175, 0.1);
}

.dark header.scrolled {
    background: rgba(17, 24, 39, 0.98);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(30, 64, 175, 0.2);
}

/* Navigation Container Enhancements */
.nav-container {
    position: relative;
}

.nav-container::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(30, 64, 175, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-container:hover::after {
    opacity: 1;
}

/* Menu Item Number Indicators */
.nav-container {
    counter-reset: nav-item;
}

.nav-link {
    counter-increment: nav-item;
}



/* Ripple Effect on Click */
.nav-link {
    position: relative;
    overflow: hidden;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.nav-link.ripple::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(30, 64, 175, 0.3);
    width: 20px;
    height: 20px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: ripple 0.6s ease-out;
    z-index: 1;
}

/* Improved Mobile Menu Animation */
#mobileMenu {
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(249,250,251,0.95));
    backdrop-filter: blur(10px);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dark #mobileMenu {
    background: linear-gradient(135deg, rgba(17,24,39,0.95), rgba(31,41,55,0.95));
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#mobileMenu:not(.hidden) {
    max-height: 400px;
    padding: 16px 0;
}

/* Staggered animation for mobile menu items */
#mobileMenu .nav-link {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

#mobileMenu:not(.hidden) .nav-link {
    opacity: 1;
    transform: translateX(0);
}

#mobileMenu:not(.hidden) .nav-link:nth-child(1) { transition-delay: 0.1s; }
#mobileMenu:not(.hidden) .nav-link:nth-child(2) { transition-delay: 0.2s; }
#mobileMenu:not(.hidden) .nav-link:nth-child(3) { transition-delay: 0.3s; }
#mobileMenu:not(.hidden) .nav-link:nth-child(4) { transition-delay: 0.4s; }
#mobileMenu:not(.hidden) .nav-link:nth-child(5) { transition-delay: 0.5s; }
#mobileMenu:not(.hidden) .nav-link:nth-child(6) { transition-delay: 0.6s; }
#mobileMenu:not(.hidden) .nav-link:nth-child(7) { transition-delay: 0.7s; }

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes spin-slow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes pulse-slow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(30, 64, 175, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(30, 64, 175, 0);
    }
}

@keyframes wiggle {
    0%, 7%, 14%, 21%, 28%, 35%, 42%, 49%, 56%, 63%, 70%, 77%, 84%, 91%, 98%, 100% {
        transform: rotate(0deg);
    }
    10.5%, 24.5%, 38.5%, 52.5%, 66.5%, 80.5%, 94.5% {
        transform: rotate(-3deg);
    }
    3.5%, 17.5%, 31.5%, 45.5%, 59.5%, 73.5%, 87.5% {
        transform: rotate(3deg);
    }
}

/* Utility Classes */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-spin-slow {
    animation: spin-slow 20s linear infinite;
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-pulse-slow {
    animation: pulse-slow 3s ease-in-out infinite;
}

.animate-wiggle {
    animation: wiggle 1s ease-in-out infinite;
}

/* Scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.dark ::-webkit-scrollbar-track {
    background: #333;
}

.dark ::-webkit-scrollbar-thumb {
    background: #666;
}

/* Chatbot Styles */
#chatbot {
    z-index: 9999 !important;
}

#chatWindow {
    max-height: 600px;
    z-index: 9999 !important;
    position: fixed !important;
}

#chatToggle {
    z-index: 9999 !important;
    position: relative;
}

#chatToggle:hover {
    animation: wiggle 1s ease-in-out;
}

/* Bot Avatar Styles */
.bot-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-right: 8px;
    position: relative;
    animation: avatarPulse 2s ease-in-out infinite;
}

.bot-avatar svg {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
    transition: all 0.3s ease;
}

.bot-avatar svg:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

/* Bot Avatar Animations */
@keyframes avatarPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes avatarBlink {
    0%, 90%, 100% {
        opacity: 1;
    }
    95% {
        opacity: 0.3;
    }
}

.bot-avatar .avatar-eyes {
    animation: avatarBlink 3s ease-in-out infinite;
}

/* Bot Message Container with Avatar */
.bot-message-container {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

.bot-message {
    align-self: flex-start;
    max-width: 80%;
    position: relative;
}

.bot-message::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #f3f4f6;
}

.dark .bot-message::before {
    border-right-color: #374151;
}

.user-message {
    align-self: flex-end;
    max-width: 80%;
    background-color: #1e40af;
    color: white;
    position: relative;
}

.user-message::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #1e40af;
}

/* Typing Indicator with Avatar */
.typing-container {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
}

.typing-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-right: 8px;
    opacity: 0.7;
}

.typing-avatar svg {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    padding: 4px;
    animation: avatarPulse 1s ease-in-out infinite;
}

/* Enhanced Chatbot Animations */
.bot-message-container {
    animation: slideInLeft 0.3s ease-out;
}

.user-message {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Service card hover effects */
.service-card {
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-5px);
}

/* Portfolio hover effects */
.portfolio-item {
    cursor: pointer;
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(to right, #1e40af, #dc2626);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form focus effects */
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* Button hover effects */
button {
    transition: all 0.3s ease;
}

/* Mobile menu animation */
#mobileMenu {
    transition: all 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #chatWindow {
        width: 90vw;
        right: -5vw;
    }
}

/* Print styles */
@media print {
    header, #chatbot, footer {
        display: none;
    }
    
    .no-print {
        display: none;
    }
}

/* 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-width: 0;
}

/* Focus visible */
:focus-visible {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
}

/* Language switch animation */
.lang-es, .lang-en {
    transition: opacity 0.3s ease;
}

/* Admin panel styles */
.admin-sidebar {
    transition: transform 0.3s ease;
}

.admin-card {
    transition: all 0.3s ease;
}

.admin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
} 