/**
 * Terranz International - Enhanced Styles
 * Additional CSS for improved design and animations
 */

/* ============================================
   Global Enhancements
   ============================================ */

:root {
    --primary-color: #21333e;
    --secondary-color: #f97316;
    --accent-color: #eef4ed;
    --transition-speed: 0.3s;
}

* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   Header Enhancements
   ============================================ */

#header {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    will-change: transform;
}

#header.scrolled {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Scroll Progress Bar */
#scroll-progress {
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
}

/* Breadcrumb Animation */
#breadcrumb-nav {
    animation: fadeInSlide 0.5s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mega Menu Improvements */
#mega-menu {
    backdrop-filter: blur(10px);
    animation: fadeInDown 0.2s ease-out;
}

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

#mega-menu a {
    transition: all 0.2s ease;
}

#mega-menu .group\/item:hover {
    animation: subtle-bounce 0.5s ease-out;
}

@keyframes subtle-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

/* Hamburger Animation */
#hamburger-line-1,
#hamburger-line-2,
#hamburger-line-3 {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


/* Search Modal */
#search-modal {
    backdrop-filter: blur(8px);
}

#search-modal.visible {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#search-modal-content {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Removed continuous animations for performance */

/* ============================================
   Button Enhancements
   ============================================ */

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Removed expensive ripple effect for performance */

/* Removed pulse animation for performance */

/* ============================================
   Card Enhancements
   ============================================ */

.card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Removed expensive sliding effect for performance */

/* ============================================
   Image Enhancements
   ============================================ */

img {
    max-width: 100%;
    height: auto;
    opacity: 1 !important; /* Prevent images from fading out */
    transition: opacity 0.5s ease-in-out;
}

img.lazy-loading {
    opacity: 0;
}

img.lazy-loaded {
    opacity: 1;
}

.img-hover-zoom {
    overflow: hidden;
}

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

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

/* ============================================
   Video Enhancements (Mobile-Friendly & Fixed Looping)
   ============================================ */

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1 !important; /* Ensure videos are always visible */
    background-color: #21333e; /* Fallback background while loading */
}

/* Optimize video for mobile devices */
@media (max-width: 768px) {
    video {
        object-fit: cover;
        /* Ensure videos work on iOS Safari */
        -webkit-playsinline: true;
    }
    
    .hero-video {
        object-fit: cover;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 0;
    }
}

/* Video loading state - subtle indicator */
video.loading {
    opacity: 0.7;
    background: #21333e;
}

video.loaded {
    opacity: 1;
    transition: opacity 0.8s ease-in-out;
}

/* Prevent video flickering/jumping */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-enclosure {
    display: none !important;
}

/* ============================================
   Form Enhancements
   ============================================ */

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.3);
}

.form-group {
    position: relative;
}

.form-label {
    transition: all 0.3s ease;
}

input:focus + .form-label,
textarea:focus + .form-label {
    color: var(--secondary-color);
    transform: translateY(-2px);
}

/* ============================================
   Loading States
   ============================================ */

.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   Scroll Animations
   ============================================ */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.animate-zoom-in {
    animation: zoomIn 0.8s ease-out forwards;
}

.animate-slide-in-up {
    animation: slideInUp 0.8s ease-out forwards;
}

.animate-slide-in-down {
    animation: slideInDown 0.8s ease-out forwards;
}

/* Scroll Animation States - elements start hidden and animate in on scroll */
.scroll-animate {
    opacity: 0 !important;
    will-change: opacity, transform;
}

/* When animation is triggered, make visible and add transform */
.scroll-animate.animated {
    opacity: 1 !important;
}

/* ============================================
   Remove Breadcrumbs
   --------------------------------------------
   Hides breadcrumb controls site-wide without editing
   each HTML page. This is reversible and low-risk.
   Expanded selectors added to catch common markup
   produced by different templates or frameworks.
   ============================================ */
#breadcrumb-nav,
#breadcrumb,
.breadcrumb,
.breadcrumbs,
.breadcrumb-nav,
.breadcrumb-wrapper,
.breadcrumbs-wrapper,
nav.breadcrumb,
nav[aria-label="breadcrumb"],
ol.breadcrumb,
nav[class*="bg-gray-50"][class*="border-b"][class*="mt-24"] {
    display: none !important;
}

/* Prepare elements with initial transforms based on animation type */
.scroll-animate[data-animation="fade-in-up"],
.scroll-animate:not([data-animation]) {
    transform: translateY(30px);
}

.scroll-animate[data-animation="slide-in-left"] {
    transform: translateX(-30px);
}

.scroll-animate[data-animation="slide-in-right"] {
    transform: translateX(30px);
}

.scroll-animate[data-animation="slide-in-up"] {
    transform: translateY(40px);
}

.scroll-animate[data-animation="slide-in-down"] {
    transform: translateY(-40px);
}

.scroll-animate[data-animation="zoom-in"] {
    transform: scale(0.95);
}

/* Reset transforms when animated */
.scroll-animate.animated {
    transform: translateY(0) translateX(0) scale(1);
    transition: all 0.8s ease-out;
}

/* Staggered Animation Delays - Simplified for Performance */
.scroll-animate:nth-child(1) { transition-delay: 0s; }
.scroll-animate:nth-child(2) { transition-delay: 0.1s; }
.scroll-animate:nth-child(3) { transition-delay: 0.2s; }
.scroll-animate:nth-child(4) { transition-delay: 0.3s; }
.scroll-animate:nth-child(5) { transition-delay: 0.4s; }
.scroll-animate:nth-child(6) { transition-delay: 0.5s; }

/* ============================================
   Section Dividers
   ============================================ */

.section-divider {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-color), transparent);
    margin: 1rem auto;
    border-radius: 2px;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(0);
}

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

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

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

/* ============================================
   Progress Bar
   ============================================ */

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--secondary-color);
    z-index: 9999;
    transition: width 0.3s ease;
}

/* ============================================
   Skeleton Loading
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* ============================================
   Badge & Tag Styles
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background-color: rgba(33, 51, 62, 0.1);
    color: var(--primary-color);
}

.badge-secondary {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--secondary-color);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* ============================================
   Tooltip Styles
   ============================================ */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* ============================================
   Responsive Utilities
   ============================================ */

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .show-mobile {
        display: none !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    header,
    footer,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

.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 {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Custom Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 12px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ============================================
   Selection Color
   ============================================ */

::selection {
    background-color: var(--secondary-color);
    color: white;
}

::-moz-selection {
    background-color: var(--secondary-color);
    color: white;
}

/* ============================================
   Enhanced Navbar Features
   ============================================ */

/* Quick Actions Dropdown */
.group:hover .group-hover\:opacity-100 {
    animation: slideDown 0.2s ease-out;
}

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

/* Search Input Focus Animation */
#search-input:focus,
#mobile-search-input:focus {
    animation: input-glow 0.3s ease-out;
}

@keyframes input-glow {
    from {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5);
    }
    to {
        box-shadow: 0 0 0 4px rgba(249, 115, 22, 0);
    }
}

/* Mobile drawer removed */

/* Navbar Links Hover Effect */
nav a {
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: width 0.3s ease, left 0.3s ease;
}

nav a:hover::after {
    width: 100%;
    left: 0;
}

/* Mega Menu Item Hover */
#mega-menu a {
    position: relative;
    overflow: hidden;
}

#mega-menu a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--secondary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

#mega-menu a:hover::before {
    transform: scaleY(1);
}

/* Removed WhatsApp pulse for performance - using static shadow instead */
a[href*="whatsapp"] {
    box-shadow: 0 4px 6px rgba(22, 163, 74, 0.3);
    transition: box-shadow 0.3s ease;
}

a[href*="whatsapp"]:hover {
    box-shadow: 0 4px 20px rgba(22, 163, 74, 0.5);
}

/* --- Overrides for Sticky Solid Nav and Right Drawer --- */
/* Ensure nav has no backdrop blur (solid) */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
        #header nav { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Mobile drawer removed */

/* Search Results Animation */
#search-results a {
    animation: slideInLeft 0.3s ease-out backwards;
}

#search-results a:nth-child(1) { animation-delay: 0.05s; }
#search-results a:nth-child(2) { animation-delay: 0.1s; }
#search-results a:nth-child(3) { animation-delay: 0.15s; }
#search-results a:nth-child(4) { animation-delay: 0.2s; }
#search-results a:nth-child(5) { animation-delay: 0.25s; }

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

/* Icon Rotate on Hover */
.group:hover i,
.group-hover\:rotate-180:hover {
    transition: transform 0.3s ease;
}

/* Backdrop Blur Support */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    #header nav {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Mobile search removed */

/* Improved Focus States for Accessibility */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Loading State for Search */
.search-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(249, 115, 22, 0.2);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   Footer: Force 4-column layout across site
   This override makes all footers use 4 equal columns
   at large screens and neutralizes Tailwind col-span
   utilities applied within the footer so the layout
   becomes consistent without editing every HTML page.
   ============================================ */
@media (min-width: 1024px) {
    footer .max-w-7xl > .grid {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        grid-auto-flow: row;
        gap: 2rem !important; /* roughly matches lg:gap-12 */
    }

    /* Ensure direct children don't keep old col-span behavior */
    footer .max-w-7xl > .grid > * {
        grid-column: auto !important;
    }

    /* Small adjustment: make the logo/intro take one column height-wise */
    footer .max-w-7xl > .grid > .lg\:col-span-4,
    footer .max-w-7xl > .grid > .lg\:col-span-3 {
        /* prevent spanning multiple columns */
        grid-column: auto !important;
    }
}
