/* Custom CSS for Chiroflex Website */

/* Brand palette variables (updated) */
:root {
    --ch-primary: #498582; /* muted teal */
    --ch-accent: #00aaa6;  /* bright teal */
    --ch-light: #e2fffd;   /* pale mint */
    --ch-warm: #ffa17a;    /* warm accent/orange */
}

/* Brand helper classes */
.text-ch-1 { color: var(--ch-primary) !important; }
.text-ch-2 { color: var(--ch-accent) !important; }
.text-ch-3 { color: var(--ch-light) !important; }
.text-ch-4 { color: var(--ch-warm) !important; }
.bg-ch-1 { background-color: var(--ch-primary) !important; }
.bg-ch-2 { background-color: var(--ch-accent) !important; }
.bg-ch-3 { background-color: var(--ch-light) !important; }
.bg-ch-4 { background-color: var(--ch-warm) !important; }
.border-ch-1 { border-color: var(--ch-primary) !important; }
.border-ch-2 { border-color: var(--ch-accent) !important; }
.btn-accent { background: var(--ch-warm); color: #fff; }
.btn-accent:hover { filter: brightness(0.95); }
.btn-cta { background: var(--ch-warm); color: #fff; }
.btn-cta:hover { filter: brightness(0.9); }
.bg-gradient-ch { background: linear-gradient(180deg, var(--ch-primary), var(--ch-light)); }

/* Hero intro gradient blend */
.hero-intro-gradient {
    background: linear-gradient(180deg, var(--ch-primary) 0%, var(--ch-light) 100%);
    background-repeat: no-repeat;
    background-attachment: scroll;
    background-size: cover;
    position: relative;
    overflow: hidden;
}

.hero-intro-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.06) 45%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 0;
}

.hero-intro-gradient .container,
.hero-intro-gradient section {
    position: relative;
    z-index: 1;
}

/* Fade-in animations */
.fade-in {
    animation: fadeIn 1s ease-in-out;
}

.fade-in-delay {
    animation: fadeIn 1s ease-in-out 0.5s both;
}

.fade-in-delay-2 {
    animation: fadeIn 1s ease-in-out 1s both;
}

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

/* Floating animation for buttons */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom hover effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Custom button styles */
.btn-primary {
    background: linear-gradient(135deg, var(--ch-warm), var(--ch-primary));
    color: #fff;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--ch-primary), var(--ch-warm));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Ensure common button selectors use the warm CTA color */
button,
.btn,
a.btn,
.btn-primary,
.btn-accent,
.btn-cta,
a.btn-primary,
a.btn-accent,
.whatsapp-btn,
.whatsapp,
#chatbot-btn,
.chatbot-btn {
    background: var(--ch-warm) !important;
    color: #fff !important;
    border-color: var(--ch-warm) !important;
}

/* Testimonial card effects */
.testimonial-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.testimonial-card::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 0.5s;
}

.testimonial-card:hover::before {
    left: 100%;
}

.testimonial-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Mobile menu animation */
.mobile-menu-enter {
    animation: slideDown 0.3s ease-out;
}

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

/* Chatbot animations */
.chatbot-enter {
    animation: slideUp 0.3s ease-out;
}

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

/* Enhanced chatbot modal styles - CRITICAL FIX */
#chatbot-modal {
    position: fixed !important;
    bottom: 100px !important;
    right: 20px !important;
    width: 380px !important;
    max-width: calc(100vw - 40px) !important;
    height: 600px !important;
    max-height: calc(100vh - 140px) !important;
    background: white !important;
    backdrop-filter: none;
    z-index: 99999 !important;
    border-radius: 20px;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#chatbot-modal.hidden {
    display: none !important;
}

#chatbot-modal:not(.hidden) {
    display: flex !important;
}

#chatbot-modal .bg-white {
    border-radius: 20px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    background: white;
}
/* Loading animation for chatbot responses */
.typing-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--ch-accent);
    animation: typing 1.4s infinite ease-in-out;
    margin: 0 2px;
}

/* Chatbot buttons styling */
.chatbot-question {
    background: white !important;
    border: 2px solid #e5e7eb;
    color: #374151 !important;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chatbot-question:hover:not(:disabled) {
    background: linear-gradient(to right, #fff5f2, white) !important;
    border-color: var(--ch-warm);
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-question i {
    margin-right: 8px;
    font-size: 16px;
}

/* Chat input styling */
#chat-form {
    margin-top: 16px;
    border-top: 2px solid #e5e7eb;
    padding-top: 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

#chat-input {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.3s ease;
    flex: 1;
}

#chat-input:focus {
    border-color: var(--ch-warm);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 161, 122, 0.15);
}

#chat-form button[type="submit"] {
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 161, 122, 0.3);
}

#chat-form button[type="submit"]:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 161, 122, 0.4);
}

/* Reset button styling */
#chatbot-modal button[class*="reset"] {
    background: #f3f4f6 !important;
    color: #374151 !important;
    border: 2px solid #e5e7eb !important;
    font-weight: 500;
}

#chatbot-modal button[class*="reset"]:hover {
    background: #e5e7eb !important;
    border-color: #d1d5db !important;
}

.typing-indicator:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive text sizing */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
}

/* Custom gradient backgrounds */
.gradient-blue {
    background: linear-gradient(135deg, var(--ch-accent), var(--ch-primary));
}

.gradient-green {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Pulse animation for CTA buttons */
.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* Service card hover effects */
.service-card {
    transition: all 0.3s ease;
    position: relative;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.service-card:hover .service-icon {
    transform: scale(1.1);
    color: var(--ch-primary);
}

.service-icon {
    transition: all 0.3s ease;
}

/* WhatsApp button special effects */
.whatsapp-btn {
    position: relative;
    overflow: hidden;
}

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

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

/* Chatbot button special effects */
.chatbot-btn {
    position: relative;
    overflow: hidden;
}

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

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

/* Accessibility improvements */
.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;
}

/* Focus styles for keyboard navigation */
.focus-visible:focus {
    outline: 2px solid var(--ch-accent);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .text-gray-600 {
        color: #000000;
    }
    
    .text-gray-300 {
        color: #ffffff;
    }
}

/* Chatbot specific styles */
.chatbot-question:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.chatbot-question:focus {
    outline: 2px solid var(--ch-accent);
    outline-offset: 2px;
}

/* Chat message animations */
.chat-message {
    animation: slideInMessage 0.3s ease-out;
}

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

/* Responsive background image */
.hero-bg {
    background-image: url('image.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

/* Mobile optimizations for background image */
@media (max-width: 768px) {
    .hero-bg {
        background-attachment: scroll;
        background-position: center top;
        background-size: cover;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-bg {
        background-position: center center;
        background-size: cover;
    }
}

/* Large screen optimizations */
@media (min-width: 1025px) {
    .hero-bg {
        background-attachment: fixed;
        background-position: center center;
        background-size: cover;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-bg {
        background-image: url('image.png');
        background-size: cover;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .fade-in-delay,
    .fade-in-delay-2,
    .float-animation,
    .pulse-animation,
    .typing-indicator {
        animation: none;
    }
    
    .hover-lift:hover,
    .service-card:hover,
    .testimonial-card:hover {
        transform: none;
    }
    
    .chat-message {
        animation: none;
    }
    
    .hero-bg {
        background-attachment: scroll;
    }
}