/**
 * ST77 UI Enhancements
 * Modern glassmorphism, animations, and interactions
 */

/* Alpine.js: hide elements with x-cloak until Alpine is ready */
[x-cloak] {
    display: none !important;
}

/* ============================================
   ENHANCED HEADER WITH GLASSMORPHISM
   ============================================ */

.site-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(224, 224, 221, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom-color: rgba(224, 224, 221, 0.5);
}

/* Navbar container */
.navbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 5rem;
    gap: 2rem;
}

/* Override default navbar-nav to show on desktop */
@media (min-width: 769px) {
    .navbar-nav {
        display: flex !important;
    }

    .navbar-cta {
        display: flex !important;
    }

    nav[style*="flex: 1"] {
        display: flex !important;
    }
}

/* Modern button styles for header */
.btn-modern {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
}

.btn-modern-primary {
    background: var(--primary);
    color: white;
}

.btn-modern-primary:hover {
    background: var(--foreground);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* New header button style */
.btn-header-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 0.625rem;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #2d2e2e 0%, #1a1a1a 100%);
    color: white;
}

.btn-header-primary:hover {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Navigation link styles */
.nav-link {
    color: var(--foreground);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--accent);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Search button hover */
.search-btn:hover {
    color: var(--accent) !important;
    transform: scale(1.1);
}

/* Brand section improvements */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: transform 0.2s;
}

.navbar-brand:hover {
    transform: scale(1.02);
}

.brand-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--foreground) 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Enhanced navbar items */
.navbar-nav li {
    position: relative;
}

.navbar-nav li a {
    position: relative;
    transition: color 0.2s ease;
    display: inline-block;
}

.navbar-nav li a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.navbar-nav li a:hover::after {
    width: 80%;
}

.navbar-nav li a:hover {
    color: var(--primary);
}

/* Right side links hover */
.navbar-cta > a:not(.btn-modern):hover {
    color: var(--accent) !important;
}

/* Enhanced buttons */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    box-shadow: 0 4px 12px rgba(61, 168, 138, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(61, 168, 138, 0.35);
    transform: translateY(-2px);
}

.btn-ghost:hover {
    background: rgba(61, 168, 138, 0.1);
}

/* Enhanced mobile menu */
.mobile-menu {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.mobile-menu-hidden {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Mobile menu links */
.mobile-menu a {
    transition: all 0.2s ease;
}

.mobile-menu a:hover {
    color: var(--accent);
    transform: translateX(4px);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   LOADING STATES & SKELETONS
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(240, 240, 240, 1) 0%,
        rgba(250, 250, 250, 1) 50%,
        rgba(240, 240, 240, 1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.spinner {
    border: 3px solid rgba(61, 168, 138, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   AI CONVERSATION WIDGET
   ============================================ */

.ai-widget {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.ai-widget:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.ai-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: messageSlideIn 0.4s ease;
}

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

.ai-message.ai .message-bubble {
    background: linear-gradient(135deg, #3da88a 0%, #2e8a73 100%);
    color: white;
    border-radius: 1rem 1rem 1rem 0.25rem;
}

.ai-message.user .message-bubble {
    background: #f5f4f0;
    color: var(--foreground);
    border-radius: 1rem 1rem 0.25rem 1rem;
    margin-left: auto;
}

.message-bubble {
    padding: 1rem 1.25rem;
    max-width: 85%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    line-height: 1.5;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3da88a 0%, #2e8a73 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(61, 168, 138, 0.3);
}

.ai-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(61, 168, 138, 0.05) 0%, rgba(61, 168, 138, 0.02) 100%);
    border-radius: 1rem;
    border: 1px solid rgba(61, 168, 138, 0.1);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ============================================
   FORM ENHANCEMENTS
   ============================================ */

.form-input, .form-select, .form-textarea {
    transition: all 0.2s ease;
    border: 2px solid var(--border);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(61, 168, 138, 0.1);
    transform: translateY(-1px);
}

.form-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.form-success {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

/* ============================================
   SCROLL ANIMATIONS (PREPARED FOR AOS)
   ============================================ */

[data-aos] {
    opacity: 0;
    transition-property: opacity, transform;
}

[data-aos].aos-animate {
    opacity: 1;
}

/* Fade animations */
[data-aos="fade-up"] {
    transform: translateY(40px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-down"] {
    transform: translateY(-40px);
}

[data-aos="fade-down"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-left"] {
    transform: translateX(-40px);
}

[data-aos="fade-left"].aos-animate {
    transform: translateX(0);
}

[data-aos="fade-right"] {
    transform: translateX(40px);
}

[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    transform: scale(0.9);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}

/* ============================================
   SMOOTH SCROLL INDICATOR
   ============================================ */

.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, #2e8a73 100%);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ============================================
   PULSE ANIMATIONS
   ============================================ */

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pulse-ring {
    animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(61, 168, 138, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(61, 168, 138, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(61, 168, 138, 0);
    }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */

.animate-bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Desktop: hide mobile menu toggle */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .mobile-menu {
        display: none !important;
    }
}

/* Mobile: hide desktop navigation */
@media (max-width: 768px) {
    .navbar nav,
    .navbar .navbar-nav,
    .navbar .navbar-cta {
        display: none !important;
    }

    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .ai-widget {
        padding: 1.5rem;
    }

    .message-bubble {
        max-width: 90%;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block !important;
    }

    /* Adjust navbar for mobile */
    .navbar {
        height: 4rem;
    }
}
