/*
 * P4 Warehouse - Modern 2026 Design Effects
 * ===========================================
 * Implements cutting-edge 2026 design trends:
 * - Micro-interactions with smooth animations
 * - Organic shapes and curved dividers
 * - Glassmorphism / Frosted glass effects
 * - Kinetic typography
 * - Performance-optimized animations
 *
 * Version: 1.0.0
 * Last Updated: January 2026
 */

/* ============================================
   1. MICRO-INTERACTIONS - Buttons & CTAs
   ============================================ */

.btn,
button {
    transition: transform var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                background-color var(--duration-fast) var(--ease-default);
    will-change: transform;
}

.btn:hover,
button:hover {
    transform: var(--hover-lift);
}

.btn:active,
button:active {
    transform: var(--active-press);
}

/* Primary CTA buttons get extra emphasis */
.btn-primary:hover {
    transform: var(--hover-lift-lg);
    box-shadow: var(--shadow-xl), var(--glow-primary);
}

.btn-outline-primary:hover {
    transform: var(--hover-lift);
    box-shadow: var(--shadow-lg);
}

/* Smooth focus states */
.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    transform: var(--hover-scale-sm);
}

/* ============================================
   2. CARD MICRO-INTERACTIONS
   ============================================ */

.card {
    transition: transform var(--duration-moderate) var(--ease-out),
                box-shadow var(--duration-moderate) var(--ease-out);
    will-change: transform;
}

.card:hover {
    transform: var(--hover-lift);
    box-shadow: var(--shadow-2xl);
}

/* Feature cards */
.feature-card,
[class*="feature-"] {
    transition: all var(--duration-moderate) var(--ease-out);
}

.feature-card:hover,
[class*="feature-"]:hover {
    transform: var(--hover-lift);
}

/* ============================================
   3. ORGANIC SHAPES - Curved Dividers
   ============================================ */

.section-curve-bottom {
    position: relative;
}

.section-curve-bottom::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: var(--bg-primary);
    clip-path: ellipse(100% 100% at 50% 100%);
}

.section-curve-top {
    position: relative;
}

.section-curve-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: var(--bg-primary);
    clip-path: ellipse(100% 100% at 50% 0%);
}

/* Organic blob shapes for decorative elements */
.blob-shape {
    border-radius: var(--blob-radius-1);
    animation: blob-morph 8s ease-in-out infinite;
}

@keyframes blob-morph {
    0%, 100% {
        border-radius: var(--blob-radius-1);
    }
    33% {
        border-radius: var(--blob-radius-2);
    }
    66% {
        border-radius: var(--blob-radius-3);
    }
}

/* Organic card borders */
.card-organic {
    border-radius: var(--radius-organic-md) !important;
}

/* ============================================
   4. GLASSMORPHISM / FROSTED GLASS
   ============================================ */

.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
}

.glass-heavy {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur-heavy);
    -webkit-backdrop-filter: var(--glass-blur-heavy);
    border: 1px solid var(--glass-border);
}

/* Glassmorphic navigation */
.navbar.glass {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
}

/* ============================================
   5. KINETIC TYPOGRAPHY - Animated Text
   ============================================ */

.hero-title,
.animated-heading {
    animation: text-reveal var(--text-reveal-duration) var(--text-reveal-ease) both;
}

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

/* Staggered text reveal for multiple lines */
.hero-title {
    animation-delay: 0s;
}

.hero-subtitle {
    animation: text-reveal var(--text-reveal-duration) var(--text-reveal-ease) both;
    animation-delay: 0.2s;
}

.hero-cta {
    animation: text-reveal var(--text-reveal-duration) var(--text-reveal-ease) both;
    animation-delay: 0.4s;
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, var(--p4-blue) 0%, var(--p4-orange) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: var(--text-gradient-animate);
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ============================================
   6. SMOOTH SCROLL & PAGE TRANSITIONS
   ============================================ */

html {
    scroll-behavior: smooth;
}

/* Smooth theme transitions */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background-color var(--duration-moderate) var(--ease-default),
                color var(--duration-moderate) var(--ease-default),
                border-color var(--duration-moderate) var(--ease-default),
                box-shadow var(--duration-moderate) var(--ease-default) !important;
}

/* Fade-in on scroll for sections */
.fade-in-section {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity var(--duration-slower) var(--ease-out),
                transform var(--duration-slower) var(--ease-out);
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   7. MODERN FORM INPUTS
   ============================================ */

.form-control,
.form-select {
    transition: border-color var(--duration-fast) var(--ease-default),
                box-shadow var(--duration-fast) var(--ease-default),
                transform var(--duration-fast) var(--ease-default);
}

.form-control:focus,
.form-select:focus {
    transform: var(--hover-scale-sm);
    box-shadow: var(--shadow-focus);
}

/* Floating label effect */
.form-floating label {
    transition: all var(--duration-normal) var(--ease-default);
}

/* ============================================
   8. LINK HOVER EFFECTS
   ============================================ */

a {
    transition: color var(--duration-fast) var(--ease-default);
}

.nav-link {
    position: relative;
    transition: color var(--duration-fast) var(--ease-default);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width var(--duration-moderate) var(--ease-out),
                left var(--duration-moderate) var(--ease-out);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
    left: 0;
}

/* ============================================
   9. IMAGE HOVER EFFECTS
   ============================================ */

img {
    transition: transform var(--duration-moderate) var(--ease-out),
                filter var(--duration-moderate) var(--ease-out);
}

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

.hover-brighten img:hover {
    filter: brightness(1.1);
}

/* ============================================
   10. LOADING STATES & SKELETONS
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

/* Spinner animation */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   11. MESH GRADIENT BACKGROUNDS
   ============================================ */

.mesh-gradient-bg {
    position: relative;
    overflow: hidden;
}

.mesh-gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-mesh);
    opacity: 0.5;
    z-index: 0;
}

.mesh-gradient-bg > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   12. TOOLTIP & POPOVER ANIMATIONS
   ============================================ */

.tooltip,
.popover {
    animation: tooltip-fade-in var(--duration-fast) var(--ease-out);
}

@keyframes tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   13. PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* GPU acceleration for animated elements */
.btn,
.card,
.nav-link,
img {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Prevent layout shifts */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* ============================================
   14. DARK MODE SPECIFIC ADJUSTMENTS
   ============================================ */

[data-theme="dark"] .hero-title,
[data-theme="dark"] .animated-heading {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .card {
    background: var(--surface-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-primary {
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .btn-primary:hover {
    box-shadow: var(--shadow-xl);
}

/* ============================================
   15. MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Reduce animation complexity on mobile */
    .blob-shape {
        animation: none;
        border-radius: var(--radius-xl);
    }

    /* Simplify hover effects (touch devices) */
    .card:hover,
    .btn:hover {
        transform: none;
    }

    /* Reduce backdrop blur on mobile (performance) */
    .glass-effect,
    .glass-heavy {
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }
}

/* ============================================
   16. ACCESSIBILITY - RESPECT USER PREFERENCES
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .blob-shape {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .glass-effect,
    .glass-heavy {
        background: var(--bg-primary);
        border: 2px solid var(--border-color);
        backdrop-filter: none;
    }

    .gradient-text {
        -webkit-text-fill-color: inherit;
        background-clip: unset;
        color: var(--text-primary);
    }
}
