/* Custom Styles for Komfort Wood */

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

.container, section, div {
    max-width: 100%;
}

/* Ensure all fixed elements stay within viewport */
button[id="scrollTop"] {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    opacity: 0;
    visibility: hidden;
    transform: scale(0);
    pointer-events: none;
}

@media (max-width: 768px) {
    button[id="scrollTop"] {
        bottom: 1rem;
        right: 1rem;
        width: 2.75rem;
        height: 2.75rem;
    }
}

button[id="scrollTop"].visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    pointer-events: auto;
}

/* Header Scroll Effect */
#header {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(5px);
}

#header.scrolled {
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Mobile Menu */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

#mobile-menu:not(.hidden) {
    max-height: 500px;
}

/* Custom Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.6s ease-out forwards;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Image Overlay on Hover */
.image-overlay {
    position: relative;
    overflow: hidden;
}

.image-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-overlay:hover::after {
    opacity: 1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #16a34a;
    border-radius: 6px;
    border: 3px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
    background: #15803d;
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

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

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

/* Parallax Effect */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Text Selection */
::selection {
    background-color: #22c55e;
    color: white;
}

::-moz-selection {
    background-color: #22c55e;
    color: white;
}

/* Focus Styles */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

/* Smooth Transitions */
a, button, input, textarea, select {
    transition: all 0.3s ease;
}

/* Hero Section Enhancement */
#acasa {
    position: relative;
    z-index: 1;
    isolation: isolate; /* Create stacking context */
}

#acasa::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(34, 197, 94, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Ensure sections don't overlap */
section {
    position: relative;
    z-index: 2;
    background: inherit; /* Ensure background is visible */
}

/* Make sure white background sections are truly white */
section.bg-white,
section[class*="bg-white"] {
    background-color: #ffffff !important;
}

/* Make sure gray background sections are solid */
section.bg-gray-50,
section[class*="bg-gray-50"] {
    background-color: #f9fafb !important;
}

/* Prevent parallax from causing layout shifts */
#acasa img {
    will-change: transform;
    backface-visibility: hidden; /* Improve performance */
    transform: translateZ(0); /* Force GPU acceleration */
}

/* Fix for hero image container to prevent overflow issues */
#acasa .absolute.inset-0 {
    overflow: hidden;
}

/* Ensure proper spacing between sections */
section + section {
    margin-top: 0; /* Remove any default margins */
}

/* Stats Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-number {
    animation: countUp 1s ease-out forwards;
}

/* Form Input Focus Effect */
input:focus,
textarea:focus,
select:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(34, 197, 94, 0.1), 0 2px 4px -1px rgba(34, 197, 94, 0.06);
}

/* Mobile Menu Animation */
#mobile-menu {
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu.show {
    max-height: 500px;
}

/* Glowing Effect for CTA Buttons */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(34, 197, 94, 0.6);
    }
}

.btn-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Image Zoom on Hover */
.zoom-on-hover {
    overflow: hidden;
}

.zoom-on-hover img {
    transition: transform 0.5s ease;
}

.zoom-on-hover:hover img {
    transform: scale(1.1);
}

/* Gradient Border */
.gradient-border {
    position: relative;
    background: white;
    background-clip: padding-box;
    border: 2px solid transparent;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    margin: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* Section Divider */
.section-divider {
    position: relative;
    padding-top: 2rem;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, transparent, #22c55e, transparent);
    border-radius: 2px;
}

/* Floating Animation */
@keyframes floating {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

/* Text Reveal Animation */
@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

.text-reveal {
    animation: textReveal 1s ease-out forwards;
}

/* Custom Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 1rem;
    background: rgba(17, 24, 39, 0.95);
    color: white;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(34, 197, 94, 0.2);
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive utilities */
@media (max-width: 768px) {
    .mobile-center {
        text-align: center;
    }
    
    .mobile-full-width {
        width: 100%;
    }
}

/* Print styles */
@media print {
    header, footer, #scrollTop {
        display: none;
    }
}

/* Accessibility - Reduced Motion */
@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) {
    .text-gray-600 {
        color: #000;
    }
    
    .bg-gray-50 {
        background-color: #fff;
    }
}

/* Dark Mode Support (for future implementation) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here */
}
