/* ========== 1. General Setup & Variables ========== */
:root {
    --bg-color: #05060a;
    --bg-elevated: #0d0c0f;
    --text-color: #f5f5f7;
    --muted-text: #a0a0b2;

    --primary-color: #c89f9c;
    --secondary-color: #8b6b61;
    --accent-color: #ffb86b;

    --card-bg: rgba(9, 10, 15, 0.85);
    --card-bg-soft: rgba(18, 18, 24, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-strong: rgba(255, 255, 255, 0.22);
    --glow-color: rgba(200, 159, 156, 0.5);
    --shadow-color: rgba(0, 0, 0, 0.65);
    --neon-color: #ff98f5;

    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-pill: 999px;

    --font-family: 'Dana FaNum', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

    --transition-fast: 0.25s ease-out;
    --transition-med: 0.4s ease;
}

[data-theme="light"] {
    --bg-color: #f6f2ef;
    --bg-elevated: #ffffff;
    --text-color: #2d2424;
    --muted-text: #7a6a6a;

    --primary-color: #b47e76;
    --secondary-color: #6d544f;
    --accent-color: #dba36c;

    --card-bg: rgba(255, 255, 255, 0.85);
    --card-bg-soft: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-border-strong: rgba(0, 0, 0, 0.15);
    --glow-color: rgba(180, 126, 118, 0.35);
    --shadow-color: rgba(15, 10, 8, 0.25);
    --neon-color: #d946ef;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: radial-gradient(circle at 0% 0%, #181822 0, #05060a 50%, #020308 100%);
    color: var(--text-color);
    transition: background 0.5s ease, color 0.5s ease;
    overflow-x: hidden;
    padding-bottom: 100px;
}

button,
input {
    font-family: inherit;
}

/* ========== 2. Backgrounds & Effects ========== */
.aurora-background {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(200, 159, 156, 0.3), transparent 50%),
        radial-gradient(circle at 80% 90%, rgba(139, 107, 97, 0.35), transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 152, 245, 0.15), transparent 40%);
    mix-blend-mode: screen;
    opacity: 0.45;
    animation: aurora-pan 26s ease-in-out infinite alternate;
    z-index: -2;
}

@keyframes aurora-pan {
    0% { transform: translate3d(-5%, -5%, 0) scale(1); }
    50% { transform: translate3d(5%, 10%, 0) scale(1.05); }
    100% { transform: translate3d(-10%, 0%, 0) scale(1.08); }
}

#floating-beans-container .bean {
    position: fixed;
    bottom: -50px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M50,0C22.4,0,0,22.4,0,50s22.4,50,50,50s50-22.4,50-50S77.6,0,50,0z M50,90C27.9,90,10,72.1,10,50S27.9,10,50,10s40,17.9,40,40S72.1,90,50,90z" fill="%236F4E37" opacity="0.6"/><path d="M50,15c-11.2,0-21.3,4.6-28.3,12.1c-1,1.1-1,2.8,0.1,3.8s2.8,1,3.8-0.1C31.5,24,40.2,20,50,20s18.5,4,24.4,10.8c1,1.1,2.8,1,3.8-0.1s1-2.8-0.1-3.8C71.3,19.6,61.2,15,50,15z" fill="%236F4E37" opacity="0.6"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    width: 20px;
    height: 20px;
    opacity: 0;
    animation: float-up 10s linear infinite;
    z-index: -1;
}

@keyframes float-up {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10%, 90% { opacity: 0.5; }
    100% { transform: translateY(-120vh) rotate(360deg); opacity: 0; }
}

#mouse-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    background: var(--glow-color);
    border-radius: 50%;
    filter: blur(100px);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: -1;
    transition: background 0.5s ease;
}

/* ========== 3. Loading Screen (Coffee Pour) ========== */
#loading-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, #15151f 0, #05060a 45%, #01010a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: hidden;
}

#loading-screen::before {
    content: '';
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(circle at 0% 0%, rgba(255, 184, 107, 0.22), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(255, 152, 245, 0.18), transparent 55%);
    opacity: 0.8;
    filter: blur(20px);
    animation: loader-bg-move 8s ease-in-out infinite alternate;
}

@keyframes loader-bg-move {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-5%, 4%, 0) scale(1.03); }
    100% { transform: translate3d(6%, -4%, 0) scale(1.06); }
}

.loader-inner {
    position: relative;
    z-index: 1;
    width: min(360px, 90vw);
    padding: 28px 22px 24px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(12, 12, 20, 0.92), rgba(10, 6, 18, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.85),
        0 0 0 1px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(26px);
    -webkit-backdrop-filter: blur(26px);
}

.loader-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 18px;
}

.loader-logo-img {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    object-fit: contain;
    box-shadow: 0 16px 40px rgba(0,0,0,0.75);
    filter: drop-shadow(0 0 12px rgba(200, 159, 156, 0.55));
}

.loader-brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.06em;
    color: var(--primary-color);
}

.coffee-loader {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto 16px;
}

.cup {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 120px;
    height: 80px;
    transform: translateX(-50%);
}

.cup-inner {
    position: relative;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 0%, #f5f5f5, #dcdcdc);
    border-radius: 0 0 32px 32px;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 22px 45px rgba(0,0,0,0.85),
        inset 0 0 0 1px rgba(200, 159, 156, 0.18);
    overflow: hidden;
}

.coffee-surface {
    position: absolute;
    inset: 6px 8px auto;
    height: 20px;
    border-radius: 999px;
    background: radial-gradient(circle at 10% 0%, #7b4b33, #312018);
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.coffee-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.28), transparent 52%);
    mix-blend-mode: screen;
    animation: coffee-glow 1.8s ease-in-out infinite alternate;
}

@keyframes coffee-glow {
    0% { opacity: 0.3; transform: translateX(-6px); }
    50% { opacity: 0.6; transform: translateX(3px); }
    100% { opacity: 0.4; transform: translateX(0); }
}

.cup-handle {
    position: absolute;
    right: -20px;
    top: 18px;
    width: 30px;
    height: 42px;
    border: 4px solid #f4f4f4;
    border-radius: 20px;
    border-left: 0;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.cup-shadow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 120px;
    height: 18px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.9) 0, transparent 65%);
    opacity: 0.95;
}

.coffee-stream {
    position: absolute;
    top: 0;
    left: 50%;
    width: 14px;
    height: 90px;
    transform: translateX(-50%);
    overflow: visible;
}

.stream {
    position: absolute;
    bottom: 18px;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, #ffb86b, #8b5a38);
    border-radius: 999px;
    box-shadow:
        0 0 16px rgba(255, 184, 107, 0.55),
        0 0 32px rgba(255, 184, 107, 0.35);
    animation: coffee-pour 2s ease-out forwards;
    transform-origin: bottom center;
}

@keyframes coffee-pour {
    0% { height: 0%; opacity: 0; }
    10% { height: 70%; opacity: 1; }
    50% { height: 100%; opacity: 1; }
    100% { height: 0%; opacity: 0; }
}

.coffee-drops {
    position: absolute;
    top: 50px;
    left: 50%;
    width: 50px;
    height: 50px;
    transform: translateX(-50%);
    pointer-events: none;
}

.drop {
    position: absolute;
    width: 10px;
    height: 14px;
    background: linear-gradient(to bottom, #ffb86b, #8b5a38);
    border-radius: 999px;
    opacity: 0;
}

.drop-1 {
    left: 14px;
    animation: drop-fall-1 2s ease-in forwards;
}

.drop-2 {
    right: 10px;
    animation: drop-fall-2 2s ease-in forwards;
}

@keyframes drop-fall-1 {
    0% { transform: translateY(-20px) scale(0.6); opacity: 0; }
    30% { opacity: 1; }
    70% { transform: translateY(38px) scale(1); opacity: 1; }
    100% { transform: translateY(60px) scale(0.6); opacity: 0; }
}

@keyframes drop-fall-2 {
    0% { transform: translateY(-10px) scale(0.5); opacity: 0; }
    35% { opacity: 1; }
    80% { transform: translateY(36px) scale(0.9); opacity: 1; }
    100% { transform: translateY(60px) scale(0.6); opacity: 0; }
}

.coffee-wave {
    position: absolute;
    bottom: 46px;
    left: 50%;
    width: 92px;
    height: 22px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: radial-gradient(circle at 20% 0%, #9c5b3a, #4a2b21);
    filter: blur(0.5px);
    clip-path: path("M0,11 C15,8 30,14 45,11 C60,8 75,14 90,11 L90,22 L0,22 Z");
    animation: coffee-wave-anim 2s ease-in-out infinite;
    opacity: 0.95;
}

@keyframes coffee-wave-anim {
    0% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -2px); }
    100% { transform: translate(-50%, 0); }
}

.loader-text {
    text-align: center;
    margin-bottom: 14px;
}

.loader-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 0.02em;
}

.loader-subtitle {
    font-size: 0.85rem;
    color: var(--muted-text);
    margin-top: 4px;
}

.loader-progress {
    margin-top: 6px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--neon-color));
    box-shadow: 0 0 12px rgba(255, 184, 107, 0.75);
    animation: progress-fill-anim 2s ease-out forwards;
}

@keyframes progress-fill-anim {
    0% { width: 0%; }
    40% { width: 40%; }
    70% { width: 75%; }
    100% { width: 100%; }
}

/* ========== 4. Header & Hero ========== */
#main-header {
    padding: 20px 5%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.logo-container {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
}

.logo {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 4px 8px var(--shadow-color));
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.1);
}

.header-controls {
    position: absolute;
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
}

#theme-toggle-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#theme-toggle-btn .fa-sun {
    display: none;
}

[data-theme="light"] #theme-toggle-btn .fa-moon {
    display: none;
}

[data-theme="light"] #theme-toggle-btn .fa-sun {
    display: block;
}

.hero-section {
    text-align: center;
    padding: 140px 20px 50px;
}

.hero-section h1 {
    font-size: clamp(2.4rem, 3.4vw, 3.2rem);
    color: var(--primary-color);
    letter-spacing: 0.04em;
}

.hero-section p {
    font-size: 1.05rem;
    margin-top: 12px;
    color: var(--muted-text);
}

/* ========== 5. Search Box ========== */
.search-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 40px;
    position: relative;
    width: 90%;
    max-width: 500px;
}

#search-box {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font-family);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#search-box:focus {
    outline: none;
    box-shadow: 0 0 15px var(--glow-color);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    opacity: 0.7;
}

/* ========== 6. Menu Grid & Cards ========== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 0 5%;
}

.menu-card {
    background: linear-gradient(145deg, var(--card-bg), var(--card-bg-soft));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow:
        0 18px 40px var(--shadow-color),
        0 0 0 1px rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color 0.3s ease;
}

.menu-card::before {
    content: '';
    position: absolute;
    inset: -40%;
    background: conic-gradient(from 180deg, rgba(255,255,255,0.12), transparent 30%, transparent 70%, rgba(255,255,255,0.08));
    opacity: 0;
    pointer-events: none;
}

.menu-card.hidden {
    display: none;
}

.menu-card:hover {
    box-shadow: 0 18px 55px rgba(0,0,0,0.9);
    border-color: var(--glass-border-strong);
}

.menu-card:hover::before {
    opacity: 1;
    animation: card-glow-rotate 2.4s linear infinite;
}

@keyframes card-glow-rotate {
    to { transform: rotate(360deg); }
}

.menu-card-img-container {
    position: relative;
    margin-bottom: 20px;
}

.menu-card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 15px;
    transform: translateZ(20px);
}

/* Steam Animation */
.steam-container {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 50px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.menu-card:hover .steam-container {
    opacity: 0.6;
}

.steam-svg path {
    stroke: #ffffff;
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
}

.menu-card:hover .steam-svg .steam-path-1 {
    animation: steam-flow 4s infinite linear 0s;
}

.menu-card:hover .steam-svg .steam-path-2 {
    animation: steam-flow 4s infinite linear 0.5s;
}

.menu-card:hover .steam-svg .steam-path-3 {
    animation: steam-flow 4s infinite linear 1s;
}

@keyframes steam-flow {
    0% { stroke-dashoffset: 20; opacity: 0; }
    20% { opacity: 1; }
    80% { stroke-dashoffset: 0; opacity: 1; }
    100% { opacity: 0; }
}

.menu-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    transform: translateZ(40px);
}

.menu-card p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.6;
    height: 65px;
    overflow: hidden;
    transform: translateZ(30px);
    color: var(--muted-text);
}

.price-add-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transform: translateZ(50px);
}

.price {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-color);
    transition: transform 0.3s ease;
}

.menu-card:hover .price {
    transform: scale(1.1);
    color: var(--neon-color);
}

.add-to-cart-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--bg-color);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    cursor: not-allowed;
    font-weight: 500;
    font-family: var(--font-family);
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.25s ease, opacity 0.25s ease;
    opacity: 0.85;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 25px rgba(0,0,0,0.45);
}

.add-to-cart-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 16px 30px rgba(0,0,0,0.6);
    opacity: 1;
}

/* ========== 7. Ripple Effect ========== */
.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-effect 0.6s linear;
}

@keyframes ripple-effect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========== 8. Bottom Navigation ========== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
}

.nav-item i {
    font-size: 1.5rem;
}

.nav-item span {
    font-size: 0.7rem;
    margin-top: 4px;
}

.nav-item.active,
.nav-item:hover {
    opacity: 1;
    color: var(--primary-color);
    transform: translateY(-5px);
}

/* ========== 9. Responsive Design ========== */
@media (max-width: 768px) {
    body {
        padding-bottom: 90px;
    }

    .bottom-nav {
        display: flex;
    }

    .hero-section {
        padding-top: 120px;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        padding: 0 5%;
    }

    .loader-inner {
        width: min(320px, 92vw);
        padding: 24px 18px 20px;
    }

    .coffee-loader {
        transform: scale(0.92);
    }

    .price-add-container {
        flex-wrap: wrap;
        justify-content: space-between;
    }
}

@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;
    }
}
