/* ========================
   ADVANCED ANIMATIONS SYSTEM
   ======================== */

/* Smooth scrolling for entire page */
html {
    scroll-behavior: smooth;
}

* {
    scroll-behavior: smooth;
}

/* Smooth transitions for common elements */
a, button, .btn, .nav-link {
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Page load fade in */
body {
    opacity: 1;
    background: linear-gradient(135deg, #faf9f7 0%, #f5f3f0 50%, #faf9f7 100%);
    background-attachment: fixed;
    position: relative;
}

/* Subtle coffee bean pattern overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(218, 159, 91, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(218, 159, 91, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(51, 33, 29, 0.02) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

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

/* ========================
   FLOATING ANIMATIONS
   ======================== */

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    50% {
        transform: translateY(-15px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(-2deg);
    }
}

@keyframes floatSlow {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* ========================
   SCROLL REVEAL ANIMATIONS
   ======================== */

.scroll-animate {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-animate.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.fade-up-item {
    opacity: 1;
    animation: none;
}

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

/* ========================
   TEXT ANIMATIONS
   ======================== */

.char-animate {
    display: inline-block;
    opacity: 1;
}

@keyframes charFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) rotate(10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

/* Gradient text shimmer */
.text-shimmer {
    background: linear-gradient(90deg, #DA9F5B, #fff, #DA9F5B);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: 200% center;
    }
}

/* ========================
   BUTTON ANIMATIONS
   ======================== */

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
}

.btn::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:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(218, 159, 91, 0.4);
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* Button ripple effect */
@keyframes ripple {
    from {
        opacity: 1;
        transform: scale(0);
    }
    to {
        opacity: 0;
        transform: scale(2.5);
    }
}

/* ========================
   IMAGE ANIMATIONS
   ======================== */

.menu-item img, .service-item img, .team-item img {
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.menu-item:hover img, .service-item:hover img {
    transform: scale(1.15) rotate(2deg);
    filter: brightness(1.1) contrast(1.1);
}

/* Image reveal animation */
@keyframes imageReveal {
    from {
        clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    }
    to {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

.img-reveal {
    animation: imageReveal 1.2s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

/* ========================
   CARD ANIMATIONS
   ======================== */

.card, .menu-item, .service-item, .team-item {
    transform-style: preserve-3d;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover, .menu-item:hover, .service-item:hover {
    transform: translateY(-15px);
    box-shadow: 0 20px 40px rgba(218, 159, 91, 0.3);
}

/* Card shine effect */
.card::after, .menu-item::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.5s;
}

.card:hover::after, .menu-item:hover::after {
    left: 100%;
}

/* ========================
   PAGE HEADER REDESIGN
   ======================== */

.page-header {
    min-height: 60vh !important; /* Much taller, spacious header */
    padding-top: 150px !important; /* Space for floating navbar */
    padding-bottom: 80px !important;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.5) 100%);
    z-index: 0;
}

.page-header > div {
    position: relative;
    z-index: 1;
    min-height: auto !important;
    padding: 60px 0 !important;
}

.page-header h1 {
    font-size: 4rem !important;
    font-weight: 800 !important;
    letter-spacing: 8px !important;
    margin-bottom: 30px !important;
    text-shadow: 0 5px 20px rgba(0,0,0,0.5);
    animation: slideInFromTop 0.8s ease-out;
}

.page-header .breadcrumb-container {
    animation: fadeInUp 1s ease-out 0.3s backwards;
}

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

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

/* Decorative elements */
.page-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 15px;
    background: url('../img/overlay-bottom.png') repeat-x bottom;
    background-size: auto;
    z-index: 2;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .page-header {
        min-height: 50vh !important;
        padding-top: 120px !important;
        padding-bottom: 60px !important;
    }
    
    .page-header h1 {
        font-size: 2.5rem !important;
        letter-spacing: 4px !important;
    }
}

.nav-bar {
    position: fixed; /* Overlay content */
    width: 100%;
    top: 30px;
    left: 0;
    z-index: 9999;
    transition: top 0.4s ease;
}

.navbar {
    height: 90px;
    padding: 0 30px !important;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.navbar-brand {
    position: absolute;
    top: 0;
    left: 45px;
    z-index: 1001; /* Above navbar background */
    padding: 0;
    margin: 0;
}

/* Override inline styles and set logo size */
.navbar-brand img {
    height: 140px !important; /* Large overhanging logo */
    width: auto;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2));
}

/* Adjust toggler position */
.navbar-toggler {
    margin-left: auto;
    z-index: 1002;
}

/* Mobile adjustments */
@media (max-width: 992px) {
    .navbar-brand {
        position: relative;
        left: 0;
        margin-right: auto;
    }
    
    .navbar-brand img {
        height: 60px !important; /* Much smaller on mobile */
    }
    
    .navbar {
        height: auto;
        padding: 10px 15px !important;
    }
    
    /* Solid background for mobile dropdown menu */
    .navbar-collapse {
        background: linear-gradient(135deg, rgba(51, 33, 29, 0.98) 0%, rgba(31, 20, 17, 0.98) 100%);
        padding: 20px 15px;
        margin: 10px -15px -10px -15px;
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
}

/* Scrolled state (handled via JS adding generic styles, 
   but we can target based on page scroll if we added a class. 
   For now, we'll try to use the transition on the image itself 
   if JS supports it, or just rely on the fixed overhang look) */


.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #DA9F5B;
    transform: translateX(-50%);
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    transform: translateY(-2px);
    color: #DA9F5B !important;
}

/* ========================
   CAROUSEL ANIMATIONS
   ======================== */

.carousel-item {
    transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1);
}

.carousel-caption {
    animation: slideUpFade 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

/* Carousel parallax */
.carousel-item img {
    transition: transform 0.3s ease-out;
    will-change: transform;
}

/* ========================
   ICON ANIMATIONS
   ======================== */

.fa, .service-icon {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service-item:hover .fa,
.service-item:hover .service-icon {
    transform: scale(1.2) rotate(360deg);
    color: #DA9F5B;
}

/* Icon bounce */
@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.fa-coffee, .fa-award, .fa-leaf {
    animation: iconBounce 2s ease-in-out infinite;
}

/* ========================
   LOADING ANIMATIONS
   ======================== */

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

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

/* ========================
   SPECIAL EFFECTS
   ======================== */

/* Glowing effect */
.glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(218, 159, 91, 0.5),
                    0 0 10px rgba(218, 159, 91, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(218, 159, 91, 0.8),
                    0 0 30px rgba(218, 159, 91, 0.5);
    }
}

/* Shake animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Bounce effect */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* ========================
   SCROLL EFFECTS
   ======================== */

.parallax {
    transition: transform 0.3s ease-out;
    will-change: transform;
}

/* Section dividers */
.section-title {
    position: relative;
    padding-bottom: 25px;
    margin-bottom: 35px;
    --bar-width: 0%;
}

.section-title::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: var(--bar-width);
    max-width: 600px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #DA9F5B, transparent);
    transition: width 0.1s linear;
}

.section-title.bar-animating::before {
    opacity: 1;
}

@keyframes slideInBar {
    from {
        width: 0;
    }
    to {
        width: 80%;
    }
}



/* ========================
   MICRO-INTERACTIONS
   ======================== */

/* Input focus effect */
input:focus, textarea:focus {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(218, 159, 91, 0.3);
}

/* Dropdown styling and animations */
.dropdown-toggle::after {
    display: none !important; /* Remove the dropdown arrow/caret */
}

/* Show dropdown on hover for better UX */
@media (min-width: 992px) {
    .nav-item.dropdown:hover .dropdown-menu {
        display: block;
    }
}

.dropdown-menu {
    background: linear-gradient(135deg, rgba(51, 33, 29, 0.98) 0%, rgba(31, 20, 17, 0.95) 100%);
    border: 1px solid rgba(218, 159, 91, 0.3);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 10px 0;
    margin-top: 10px;
    animation: dropdownSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dropdown-item {
    color: #fff !important;
    padding: 10px 25px;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(218, 159, 91, 0.3) 0%, rgba(218, 159, 91, 0.2) 100%);
    color: #DA9F5B !important;
    padding-left: 30px;
}

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

/* Back to top button */
.back-to-top {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.back-to-top:hover {
    transform: translateY(-5px) rotate(360deg);
    box-shadow: 0 10px 25px rgba(218, 159, 91, 0.5);
}

/* ========================
   RESPONSIVE ANIMATIONS
   ======================== */

@media (max-width: 768px) {
    /* Reduce animation intensity on mobile */
    .scroll-animate {
        transform: translateY(20px);
    }
    
    .char-animate {
        animation-duration: 0.3s;
    }
    
    .btn:hover {
        transform: translateY(-2px);
    }
}

/* ========================
   PERFORMANCE OPTIMIZATIONS
   ======================== */

/* GPU acceleration for smooth animations */
.btn, .menu-item, .service-item, .team-item, .carousel-item img {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Add breathing room after page headers */
.page-header + .container,
.page-header + .container-fluid,
.page-header.mb-5 {
    margin-bottom: 100px !important;
}

/* ========================
   WARM DESIGN ENHANCEMENTS
   ======================== */

/* Add subtle warm glow to containers */
.container {
    position: relative;
}

/* Decorative coffee steam elements - removed to prevent overlap */

/* Add warm card shadows and backgrounds */
.service-item,
.menu-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 20px rgba(218, 159, 91, 0.08),
        0 0 60px rgba(218, 159, 91, 0.03);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.service-item::before,
.menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(218, 159, 91, 0.5), transparent);
    transform: scaleX(0);
    transition: transform 0.5s ease;
}

.service-item:hover::before,
.menu-item:hover::before {
    transform: scaleX(1);
}

/* Warm text shadows for headings */
h1, h2, h3, .display-4 {
    text-shadow: 0 2px 10px rgba(218, 159, 91, 0.1);
}

/* Subtle pattern for section backgrounds */
.py-5 {
    position: relative;
}

.py-5:nth-child(even) {
    background: linear-gradient(180deg, rgba(245, 243, 240, 0.3) 0%, rgba(250, 249, 247, 0.3) 100%);
}

/* Coffee cup steam animation for decorative elements */
@keyframes steam {
    0% {
        transform: translateY(0) scaleX(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) scaleX(1.2);
        opacity: 0.3;
    }
    100% {
        transform: translateY(-40px) scaleX(0.8);
        opacity: 0;
    }
}

/* Add warmth to testimonial items */
.testimonial-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(250, 248, 245, 0.9) 100%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 10px 40px rgba(218, 159, 91, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
}

.testimonial-item::before {
    content: '"';
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 100px;
    color: rgba(218, 159, 91, 0.1);
    font-family: Georgia, serif;
    line-height: 1;
}

/* Add warm borders to forms */
.form-control {
    border: 2px solid rgba(218, 159, 91, 0.2);
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: rgba(218, 159, 91, 0.6);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 20px rgba(218, 159, 91, 0.15);
}

/* Warm gradient overlays for images */
.about-img img,
.menu-item img {
    position: relative;
}

/* Add subtle grain texture overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" /></filter><rect width="300" height="300" filter="url(%23noise)" opacity="0.05"/></svg>');
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: overlay;
    opacity: 0.3;
}


/* Menu item image consistency */
.menu-item-img {
    width: 120px !important;
    height: 120px !important;
    object-fit: cover;
    border-radius: 50%;
}

/* Menu item scroll animations */
.menu-item,
.service-item,
.row.align-items-center.mb-5 {
    opacity: 0;
    transform: translateY(40px) scale(0.85);
    will-change: transform, opacity;
}

/* ========================
   FLOATING COFFEE BEANS
   ======================== */

.coffee-bean {
    position: fixed;
    width: 40px;
    height: 40px;
    background-image: url('../img/bean.png');
    background-size: contain;
    background-repeat: no-repeat;
    filter: blur(1px) opacity(0.4);
    pointer-events: none;
    z-index: 1;
    transition: transform 0.1s linear, opacity 0.3s ease;
}

.coffee-bean.left {
    left: 0;
}

.coffee-bean.right {
    right: 0;
}

/* Vary bean sizes */
.coffee-bean.small {
    width: 30px;
    height: 30px;
    filter: blur(1.5px) opacity(0.3);
}

.coffee-bean.large {
    width: 50px;
    height: 50px;
    filter: blur(0.5px) opacity(0.5);
}

/* Hide beans on mobile devices */
@media (max-width: 768px) {
    .coffee-bean {
        display: none !important;
    }
}

/* Ensure parent containers don't override */
.col-4.col-sm-3 {
    position: relative;
}

.col-4.col-sm-3 .menu-item-img {
    width: 120px !important;
    height: 120px !important;
}
