@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');

:root {
    --bg-color: #2e2520;
    --panel-bg: #40342d;
    --text-color: #e0dcd7;
    --accent-color: #ffffff;
    --slider-track: #5a4a42;
    --button-bg: #5a4a42;
    --button-hover-bg: #705c52;
    --steam-color: rgba(255, 255, 255, 0.5);

    /* Coffee Layer Colors */
    --espresso-color: #3b2a22;
    --steamed-milk-color: #dcd3c4;
    --milk-foam-color: #f7f3e9;
    --hot-water-color: #a2c8cc;
    --chocolate-color: #4a2f2f;
    --whipped-cream-color: #fdfbf5;
    --caramel-syrup-color: #c5893f;
    --ice-cream-color: #f4e9be;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    /* Changed to allow footer at the bottom */
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.cafe-container {
    background-color: var(--panel-bg);
    border-radius: 15px;
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.main-title, .subtitle { width: 100%; text-align: center; }
.main-title { margin: 0 0 5px 0; font-size: 2rem; color: var(--accent-color); }
.subtitle { margin-bottom: 30px; font-size: 1.1rem; }

.main-content-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 30px;
}

.display-panel {
    flex: 3;
    min-width: 300px;
    text-align: center;
}

.cup-container {
    background-color: var(--bg-color);
    border-radius: 10px;
    margin-bottom: 20px;
    position: relative;
    width: 280px;
    height: 280px;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    place-items: center;
}

.cup-liquid, .cup-labels, .cup-svg {
    grid-area: 1 / 1;
}

.cup-svg {
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.cup-outline path {
    fill: none;
    stroke: var(--text-color);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cup-liquid, .cup-labels {
    width: 53%;
    height: 45%;
    margin-top: 13%;
}

.cup-liquid {
    transition: background 0.5s ease-in-out;
}

.steam {
    stroke: var(--steam-color);
    stroke-width: 1.5;
    fill: none;
    opacity: 0;
    transform-origin: bottom;
    animation: steam-animate 6s infinite linear;
}
.steam:nth-child(2) { animation-delay: 2s; }
.steam:nth-child(3) { animation-delay: 4s; }

@keyframes steam-animate {
    0% { opacity: 0; transform: translateY(0) scaleX(1); }
    30% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-40px) scaleX(1.5); }
}

.cup-labels {
    position: relative;
}

.layer-label {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 50%);
    color: #000;
    font-weight: bold;
    font-size: 9px;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.7);
    transition: bottom 0.5s ease-in-out;
}


#coffee-name { font-size: 1.8rem; color: var(--accent-color); margin: 0 0 10px 0; }
.instructions-text { font-size: 0.9rem; line-height: 1.5; min-height: 50px; color: #c7b8ae; }
#recipe-display-side { background: rgba(0,0,0,0.2); padding: 10px; border-radius: 5px; min-height: 60px; font-size: 0.9rem; }
#recipe-display-side p { margin: 4px 0; }

.controls-panel {
    flex: 4;
    min-width: 300px;
}
.slider-group .slider-row { margin-bottom: 12px; }
.slider-group label { display: block; margin-bottom: 5px; font-size: 0.9rem; }
.slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 5px; background: var(--slider-track);
    outline: none; border-radius: 5px;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; background: var(--accent-color);
    cursor: pointer; border-radius: 50%; border: 3px solid var(--panel-bg);
}
.slider::-moz-range-thumb {
    width: 20px; height: 20px; background: var(--accent-color);
    cursor: pointer; border-radius: 50%; border: 3px solid var(--panel-bg);
}

.presets-panel { width: 100%; margin-top: 20px; }
.presets-panel h3 { text-align: center; margin-bottom: 20px; font-size: 1.2rem; }
.button-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.preset-btn {
    background-color: var(--button-bg); color: var(--text-color);
    border: none; border-radius: 20px; padding: 10px 15px;
    font-family: 'Vazirmatn', sans-serif; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s;
}
.preset-btn:hover { background-color: var(--button-hover-bg); }
.preset-btn.active { background-color: var(--accent-color); color: var(--bg-color); font-weight: bold; }

@media (max-width: 768px) {
    body { padding: 10px; }
    .cafe-container { padding: 15px; }
    .main-content-wrapper { flex-direction: column; }
    
    .display-panel { order: 1; width: 100%; }
    .presets-panel { order: 2; margin-top: 30px; }
    .controls-panel { order: 3; margin-top: 30px; width: 100%; min-width: 0; }
    
    .cup-container {
        width: 60vw;
        height: 60vw;
        max-width: 240px;
        max-height: 240px;
    }

    .slider-group .slider-row { margin-bottom: 8px; }
    .slider-group label { font-size: 0.85rem; }

    .button-grid { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
    .main-title { font-size: 1.8rem; }
}

/* --- بخش جدید: استایل فوتر --- */
footer {
    width: 100%;
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
    color: var(--text-color);
    font-size: 0.9rem;
    opacity: 0.7;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    transition: opacity 0.2s;
}

footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}