@tailwind base;
@tailwind components;
@tailwind utilities;

html.dark {
    color-scheme: dark;
}

html,
body {
    overflow-x: hidden;
}

button,
a,
input,
select,
textarea,
[role="button"],
[role="link"] {
    transition:
        color,
        background-color,
        border-color,
        box-shadow,
        transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family:
        "Lato",
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background-color: #050505;
    /* Deep Midnight Black */
    transition: background-color 0.3s ease-in-out;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. Film Grain Texture - Paint-only layer */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
}

/* 3. Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-image: linear-gradient(
        to bottom,
        #bf953f,
        #fcf6ba,
        #b38728,
        #fbf5b7,
        #aa771c
    );
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background-image: linear-gradient(
        to bottom,
        #aa771c,
        #fbf5b7,
        #b38728,
        #fcf6ba,
        #bf953f
    );
}

/* Custom scrollbar for rental agreement */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #bf953f, #d4af37, #aa771c);
    border-radius: 10px;
    border: 2px solid #1a1a1a;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #d4af37, #fcf6ba, #bf953f);
}

/* Firefox scrollbar */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #d4af37 #1a1a1a;
}

/* Hide scrollbar for horizontal scroll areas */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 1. Royal Gold Gradient Utilities */
.text-gold-metallic {
    background: linear-gradient(
        to right,
        #bf953f,
        #fcf6ba,
        #b38728,
        #fbf5b7,
        #aa771c
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
}

.bg-gold-metallic {
    background-image: linear-gradient(
        to right,
        #bf953f,
        #fcf6ba,
        #b38728,
        #fbf5b7,
        #aa771c
    );
}

/* 4. Glassmorphism 2.0 */
.glass-panel {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background-color: rgba(5, 5, 5, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Global text shadow utility classes */
.text-shadow {
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
}

.text-shadow-lg {
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
}

/* Animation for incoming chatbot messages */
@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-message-in {
    animation: message-in 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* CSS-only Fade In Up for LCP Optimization */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Animation for modals */
@keyframes modal-scale-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-modal-scale-in {
    animation: modal-scale-in 0.2s ease-out forwards;
}

/* Animation for button feedback */
@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    70% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.animate-pop-in {
    animation: pop-in 0.3s ease-out forwards;
}

/* Gold Breath Animation for Dark Mode Logo */
@keyframes gold-breath {
    0% {
        filter: drop-shadow(0 0 2px rgba(234, 179, 8, 0.5));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.9));
        transform: scale(1.05);
    }

    100% {
        filter: drop-shadow(0 0 2px rgba(234, 179, 8, 0.5));
        transform: scale(1);
    }
}

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

/* ============================================
       ADMIN DASHBOARD VIBRANT COLOR UTILITIES
       ============================================ */

/* Glow Effects for Cards */
.glow-cyan {
    box-shadow:
        0 0 20px rgba(6, 182, 212, 0.15),
        0 0 40px rgba(6, 182, 212, 0.05);
}

.glow-emerald {
    box-shadow:
        0 0 20px rgba(16, 185, 129, 0.15),
        0 0 40px rgba(16, 185, 129, 0.05);
}

.glow-amber {
    box-shadow:
        0 0 20px rgba(245, 158, 11, 0.15),
        0 0 40px rgba(245, 158, 11, 0.05);
}

.glow-violet {
    box-shadow:
        0 0 20px rgba(139, 92, 246, 0.15),
        0 0 40px rgba(139, 92, 246, 0.05);
}

.glow-rose {
    box-shadow:
        0 0 20px rgba(244, 63, 94, 0.15),
        0 0 40px rgba(244, 63, 94, 0.05);
}

.glow-blue {
    box-shadow:
        0 0 20px rgba(59, 130, 246, 0.15),
        0 0 40px rgba(59, 130, 246, 0.05);
}

.glow-gold {
    box-shadow:
        0 0 20px rgba(251, 191, 36, 0.2),
        0 0 40px rgba(251, 191, 36, 0.08);
}

/* Gradient Backgrounds for Cards */
.bg-gradient-cyan {
    background: linear-gradient(
        135deg,
        rgba(6, 182, 212, 0.08) 0%,
        rgba(6, 182, 212, 0.02) 100%
    );
}

.bg-gradient-emerald {
    background: linear-gradient(
        135deg,
        rgba(16, 185, 129, 0.08) 0%,
        rgba(16, 185, 129, 0.02) 100%
    );
}

.bg-gradient-amber {
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.08) 0%,
        rgba(245, 158, 11, 0.02) 100%
    );
}

.bg-gradient-violet {
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.08) 0%,
        rgba(139, 92, 246, 0.02) 100%
    );
}

.bg-gradient-rose {
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.08) 0%,
        rgba(244, 63, 94, 0.02) 100%
    );
}

.bg-gradient-blue {
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.08) 0%,
        rgba(59, 130, 246, 0.02) 100%
    );
}

/* Accent Border Left */
.border-l-accent-cyan {
    border-left: 3px solid #06b6d4;
}

.border-l-accent-emerald {
    border-left: 3px solid #10b981;
}

.border-l-accent-amber {
    border-left: 3px solid #f59e0b;
}

.border-l-accent-violet {
    border-left: 3px solid #8b5cf6;
}

.border-l-accent-rose {
    border-left: 3px solid #f43f5e;
}

.border-l-accent-blue {
    border-left: 3px solid #3b82f6;
}

/* Pulsing Dot for Unread Indicators */
@keyframes pulse-dot {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

.animate-pulse-dot {
    animation: pulse-dot 2s ease-in-out infinite;
}

/* Shimmer Effect for Prices */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.text-shimmer {
    background: linear-gradient(90deg, #fbbf24 0%, #fde68a 50%, #fbbf24 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

/* Hover lift effect */
.hover-lift {
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

@keyframes buttonGlow {
    0%,
    100% {
        box-shadow:
            0 0 10px rgba(212, 175, 55, 0.2),
            0 0 20px rgba(212, 175, 55, 0.1);
    }

    50% {
        box-shadow:
            0 0 25px rgba(212, 175, 55, 0.5),
            0 0 40px rgba(212, 175, 55, 0.3);
    }
}

.animate-button-glow:hover {
    animation: buttonGlow 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

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

/* Golden Running Edge Animation for Fleet Buttons */
@keyframes gold-border-pulse {
    0%,
    100% {
        box-shadow:
            0 0 5px rgba(212, 175, 55, 0.2),
            0 0 15px rgba(212, 175, 55, 0.1),
            inset 0 0 3px rgba(212, 175, 55, 0.15);
    }

    50% {
        box-shadow:
            0 0 15px rgba(212, 175, 55, 0.5),
            0 0 30px rgba(212, 175, 55, 0.3),
            inset 0 0 8px rgba(255, 215, 0, 0.3);
    }
}

.animate-gold-edge {
    animation: gold-border-pulse 1.5s ease-in-out infinite;
    border-color: rgba(212, 175, 55, 0.5) !important;
}

/* Running Shine Effect */
@keyframes shine-sweep {
    0% {
        transform: translateX(-100%) skewX(-15deg);
    }

    100% {
        transform: translateX(200%) skewX(-15deg);
    }
}

.btn-shine-effect {
    position: relative;
    overflow: hidden;
}

.btn-shine-effect::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 215, 0, 0.4),
        transparent
    );
    transform: translateX(-100%) skewX(-15deg);
    pointer-events: none;
}

.group:hover .btn-shine-effect::after {
    animation: shine-sweep 1.5s ease-out infinite;
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
    /* Aggressively reduce blur on mobile to improve frame rates */
    [class*="backdrop-blur-"] {
        -webkit-backdrop-filter: blur(4px) !important;
        backdrop-filter: blur(4px) !important;
    }

    /* Disable decorative floating leaves on mobile to reduce layout thrash */
    .floating-leaves { display: none !important; }

    /* Reduce film grain opacity on mobile */
    body::before { opacity: 0.015 !important; }
}

/* CSS-only scroll-based reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-left.reveal-visible {
    opacity: 1;
    transform: translateX(0);
}
.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-right.reveal-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered reveal delays */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0.1s; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 0.3s; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 0.5s; }
.reveal-stagger.reveal-visible > .reveal {
    opacity: 1;
    transform: translateY(0);
}

/* Floating leaves CSS animation replacement */
@keyframes leaf-fall {
    0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    100% { transform: translateY(110vh) translateX(var(--drift, 50px)) rotate(360deg); opacity: 0; }
}
.leaf {
    position: absolute;
    top: -10%;
    animation: leaf-fall var(--duration, 8s) linear var(--delay, 0s) infinite;
}

/* Accessibility: Respect user preference for 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;
    }
}

/* 5. Majestic Text Glow & Breathe for Arabic Calligraphy */
@keyframes text-glow-breath {
    0%,
    100% {
        filter: drop-shadow(0 0 5px rgba(191, 149, 63, 0.3));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(191, 149, 63, 0.8));
        transform: scale(1.05);
    }
}

.animate-text-glow-breath {
    animation: text-glow-breath 4s ease-in-out infinite;
    /* Ensure it doesn't conflict with inline display if needed */
    display: inline-block;
}

/* 6. Premium Golden Text Masking Animation */
@keyframes golden-text-mask {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.animate-golden-text-mask {
    background: linear-gradient(
        90deg,
        #bf953f 0%,
        #fcf6ba 20%,
        #b38728 40%,
        #fbf5b7 60%,
        #aa771c 80%,
        #bf953f 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: golden-text-mask 8s linear infinite;
    display: inline-block;
}
