/* Custom Properties */
:root {
    --color-navy: #0f172a;
    --color-orange: #f97316;
    --shadow-orange: rgba(249, 115, 22, 0.3);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out-expo: cubic-bezier(0.87, 0, 0.13, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-navy);
    color: #f8fafc;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Floating Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(1deg);
    }
}

@keyframes float-slow {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-slow {
    animation: float-slow 8s ease-in-out infinite;
}

/* Product Shadow for Photorealistic Effect */
.product-shadow {
    filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.5)) 
            drop-shadow(0 10px 20px rgba(249, 115, 22, 0.15));
    transition: all 0.5s ease;
}

.product-shadow:hover {
    filter: drop-shadow(0 35px 60px rgba(0, 0, 0, 0.6)) 
            drop-shadow(0 15px 30px rgba(249, 115, 22, 0.25));
    transform: translateY(-5px);
}

/* Floating Product Effect in Grid */
.floating-product {
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.4));
}

.group:hover .floating-product {
    transform: translateY(-8px) scale(1.05);
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5)) 
            drop-shadow(0 10px 20px rgba(249, 115, 22, 0.2));
}

/* Product Card Hover Effects */
.product-card {
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Hide Scrollbar for Mobile Menu */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Search Input Focus Glow */
input:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1), 
                inset 0 2px 4px 0 rgba(0, 0, 0, 0.3);
}

/* Button Press Effect */
button:active {
    transform: scale(0.98);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Ambient Glow Effects */
.glow-orange {
    box-shadow: 0 0 40px rgba(249, 115, 22, 0.3);
}

/* Hotspot Pulse Animation */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.hotspot-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(249, 115, 22, 0.5);
    animation: pulse-ring 2s ease-out infinite;
}

/* Mobile Cart Bar Slide Up */
.cart-visible {
    transform: translateY(0) !important;
}

/* Toast Slide In */
.toast-visible {
    transform: translateX(0) !important;
}

/* Loading Skeleton */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Sticky Header Shadow on Scroll */
.header-scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 
                0 2px 4px -1px rgba(0, 0, 0, 0.2);
    background: rgba(15, 23, 42, 0.95) !important;
}

/* Navigation Active State */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #f97316, #ef4444);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Card Shine Effect */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.03) 50%,
        transparent 70%
    );
    transform: rotate(45deg) translateY(-100%);
    transition: transform 0.6s;
}

.card-shine:hover::before {
    transform: rotate(45deg) translateY(100%);
}

/* Selection Color */
::selection {
    background: rgba(249, 115, 22, 0.3);
    color: white;
}

/* Focus Visible for Accessibility */
:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.5);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Cart Drawer & Modal Styles */
#cart-drawer {
    right: 0;
    top: 0;
    height: 100%;
    transition: transform 0.28s ease-in-out;
    position: fixed;
    z-index: 99999;
}

#cart-drawer.translate-x-full {
    transform: translateX(100%);
}

#cart-drawer:not(.translate-x-full) {
    transform: translateX(0);
}

#checkout-modal { position: fixed; z-index: 100000; }
#checkout-modal.hidden { display: none; }
#checkout-modal.flex { display: flex; align-items: center; justify-content: center; }

#product-modal { position: fixed; z-index: 100001; }

.cart-item { padding: 0.5rem; border-radius: 0.5rem; background: rgba(15,23,42,0.35); border: 1px solid rgba(100,116,139,0.06); }

/* Ensure product images don't form higher stacking contexts than modals */
.product-card img, .floating-product, .product-shadow {
    position: relative;
    z-index: 10;
}

/* ========================================
   APPLE-LIKE SMOOTH ANIMATIONS
   ======================================== */

/* Smooth fade in animation */
@keyframes appleFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Smooth fade out animation */
@keyframes appleFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Smooth scale and fade in (like Apple modals) */
@keyframes appleModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Smooth scale and fade out */
@keyframes appleScaleOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
}

/* Smooth slide up for mobile modals */
@keyframes appleSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Quick View Modal - Apple Style - COMPACT VERSION */
#product-modal {
    position: fixed;
    z-index: 100001;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: appleFadeIn 0.3s var(--ease-out-expo) forwards;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    inset: 0;
}

#product-modal.hidden {
    display: none;
    animation: appleFadeOut 0.25s var(--ease-in-out-expo) forwards;
}

#product-modal.flex {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: appleModalIn 0.35s var(--ease-out-expo) forwards;
}

#product-modal .glass-card {
    max-width: 36rem;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(71, 85, 105, 0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: appleModalIn 0.4s var(--ease-out-expo) forwards;
    display: flex;
    flex-direction: column;
}

/* Modal Image Container - Compact */
#product-modal-img-wrap {
    width: 100%;
    height: 280px !important;
    min-height: 200px;
    background: #1e293b;
    border-radius: 0.5rem 0.5rem 0 0;
    overflow: hidden;
    flex-shrink: 0;
}

#product-modal-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Modal Content - Compact */
#product-modal .flex.flex-col.gap-6 {
    padding: 1rem;
    gap: 0.75rem !important;
}

#product-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

#product-modal-desc {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #94a3b8;
    margin: 0;
}

#product-modal-price {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

/* Modal Buttons - Compact */
#product-modal .flex.gap-3 {
    gap: 0.5rem;
    margin-top: 0.25rem;
}

#product-modal-add,
#product-modal-close2 {
    flex: 1;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Responsive Product Modal - Full screen on mobile */
@media (max-width: 768px) {
    #product-modal {
        padding: 0.5rem;
        align-items: flex-end;
    }
    
    #product-modal.flex {
        align-items: flex-end;
        animation: appleSlideUp 0.4s var(--ease-out-expo) forwards;
    }
    
    #product-modal .glass-card {
        width: 100%;
        max-width: 100%;
        max-height: 80vh;
        border-radius: 1rem 1rem 0 0;
    }
    
    #product-modal-img-wrap {
        height: 220px !important;
    }
}

@media (max-width: 480px) {
    #product-modal {
        padding: 0;
    }
    
    #product-modal .glass-card {
        padding: 0.75rem;
        max-height: 75vh;
    }
    
    #product-modal-img-wrap {
        height: 180px !important;
    }
    
    #product-modal-title {
        font-size: 1rem;
    }
    
    #product-modal-price {
        font-size: 1.125rem;
    }
    
    #product-modal-desc {
        font-size: 0.8125rem;
    }
}

/* Responsive Cart Drawer */
@media (max-width: 768px) {
    #cart-drawer {
        width: 100%;
    }
    
    #checkout-modal {
        padding: 1rem;
    }
    
    #checkout-modal .bg-slate-900 {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Mobile-Only Chat Widget */
#chat-widget {
    display: block;
}
@media (min-width: 769px) {
    #chat-widget {
        display: none;
    }
}
/* Responsive Chat Widget */
@media (max-width: 480px) {
    #chat-widget {
        bottom: 110px; /* Above mobile cart bar */
        right: 12px;
        z-index: 100001;
    }
    
    #chat-toggle {
        width: 56px;
        height: 56px;
    }
    
    #chat-toggle svg {
        width: 26px;
        height: 26px;
    }
    
    #chat-window {
        width: calc(100vw - 36px);
        height: calc(100vh - 140px);
        right: 0;
        bottom: 72px;
        z-index: 100002;
    }
    
    .chat-header {
        padding: 14px;
    }
    
    .chat-messages {
        padding: 14px;
    }
    
    .message {
        font-size: 14px;
        padding: 12px 14px;
    }
    
    .chat-input-area {
        padding: 14px;
    }
    
    .quick-replies {
        gap: 8px;
    }
    
    .quick-reply {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* Responsive Header */
@media (max-width: 768px) {
    header {
        padding: 0.5rem 0;
    }
    
    .h-20 {
        height: auto;
        min-height: 60px;
        padding: 0.5rem 0;
    }
}

/* Responsive Product Grid */
@media (max-width: 640px) {
    #product-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    #product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Responsive Hero Section */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
}

/* Responsive Footer */
@media (max-width: 768px) {
    footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    footer .border-t {
        padding-top: 1.5rem;
    }
    
    footer .flex-col {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Responsive Buttons */
@media (max-width: 480px) {
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .px-8 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .py-4 {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

/* Ensure touch-friendly targets on mobile */
@media (max-width: 768px) {
    .product-card button,
    .quick-view-btn,
    #product-modal-add,
    #product-modal-close,
    #product-modal-close2 {
        min-height: 44px;
    }
    
    input,
    textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Smooth hover effects for buttons */
button, .btn {
    transition: all 0.3s var(--ease-out-expo);
}

button:hover, .btn:hover {
    transform: translateY(-1px);
}

button:active, .btn:active {
    transform: translateY(0) scale(0.98);
}

/* Smooth transitions for all interactive elements */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-timing-function: var(--ease-out-expo);
    transition-duration: 150ms;
}

/* Override for specific elements that need different timing */
a, button, .product-card, .glass-card, #product-modal, #product-modal .glass-card {
    transition-duration: 400ms;
}

/* Chat Widget Styles */
#chat-widget { position: fixed; bottom: 20px; right: 20px; z-index: 99999; font-family: 'Inter', system-ui, sans-serif; }
#chat-toggle { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #f97316, #ea580c); border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4); display: flex; align-items: center; justify-content: center; transition: transform 0.3s; }
#chat-toggle:hover { transform: scale(1.1); }
#chat-window { position: absolute; bottom: 80px; right: 0; width: 360px; height: 480px; background: #0f172a; border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); display: none; flex-direction: column; overflow: hidden; border: 1px solid #334155; }
#chat-window.open { display: flex; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.chat-header { background: linear-gradient(135deg, #f97316, #ea580c); padding: 16px; display: flex; align-items: center; gap: 12px; }
.chat-messages { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.message { max-width: 85%; padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.5; }
.message.bot { background: #1e293b; color: #f1f5f9; align-self: flex-start; border-bottom-left-radius: 4px; }
.message.user { background: #f97316; color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-input-area { padding: 16px; border-top: 1px solid #334155; background: #1e293b; }
#chat-input { width: 100%; padding: 12px 16px; border: 1px solid #475569; border-radius: 24px; background: #0f172a; color: white; font-size: 14px; outline: none; transition: border-color 0.3s; }
#chat-input:focus { border-color: #f97316; }
.quick-replies { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.quick-reply { padding: 8px 16px; background: #334155; border: none; border-radius: 20px; color: #f1f5f9; font-size: 12px; cursor: pointer; transition: background 0.3s; }
.quick-reply:hover { background: #475569; }
.lead-form { display: flex; flex-direction: column; gap: 8px; }
.lead-form input { padding: 10px 14px; border: 1px solid #475569; border-radius: 8px; background: #0f172a; color: white; font-size: 14px; outline: none; }
.lead-form input:focus { border-color: #f97316; }
.lead-form button { padding: 10px; background: #f97316; border: none; border-radius: 8px; color: white; font-weight: 600; cursor: pointer; }
@media (max-width: 480px) { #chat-window { width: calc(100vw - 40px); height: calc(100vh - 160px); right: -10px; } }

/* Order Success Modal Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

/* Success Modal z-index */
#order-success-modal {
    z-index: 100000;
}

/* Toast error styling (optional) */
#toast.error .glass-card {
    border-color: #ef4444;
}

#toast.error .w-10 {
    background: rgba(239, 68, 68, 0.2);
}

#toast.error i {
    color: #ef4444;
}