/* style.css - Fully Optimized */
:root {
    --app-bg: #F2F2F7;
    --card-bg: #FFFFFF;
    --text-main: #1C1C1E;
    --text-muted: #8E8E93;
    --brand-color: #ff6e00; 
    /* System Font Stack: Fastest rendering possible (0ms load time) */
    --font-head: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --nav-height: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; user-select: none; }
html { scroll-behavior: smooth; }
body { background-color: var(--app-bg); font-family: var(--font-body); color: var(--text-main); margin: 0; padding: 0; }
.app-container { max-width: 500px; margin: 0 auto; background: var(--app-bg); min-height: 100vh; position: relative; box-shadow: 0 0 40px rgba(0,0,0,0.05); }

/* SVG ICON UTILITY */
.icon-svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* HEADER */
.app-header { position: sticky; top: 0; z-index: 1000; background: var(--brand-color); color: #ffffff; padding: 0 20px; height: var(--nav-height); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(255, 110, 0, 0.3); overflow: hidden; }
#default-header { display: flex; justify-content: space-between; align-items: center; width: 100%; transition: opacity 0.3s ease, transform 0.3s ease; }
#focused-header { position: absolute; left: 20px; right: 20px; text-align: center; font-family: var(--font-head); font-weight: 700; font-size: 18px; color: #ffffff; opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; justify-content: center; gap: 10px; }
#focused-header img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.4); }
.app-header.reading-mode #default-header { opacity: 0; transform: translateY(-20px); pointer-events: none; }
.app-header.reading-mode #focused-header { opacity: 1; transform: translateY(0); pointer-events: auto; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 24px; letter-spacing: -0.5px; color: white; }

.user-pill { display: flex; align-items: center; gap: 8px; background: #ffffff; padding: 4px 4px 4px 12px; border-radius: 30px; text-decoration: none; color: var(--brand-color); font-weight: 700; font-size: 13px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.user-pill img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.logo-circle { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; display: block; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

.header-icon { background: transparent; border: none; padding: 0; color: rgba(255,255,255,0.95); margin-right: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.header-icon:active { transform: scale(0.95); opacity: 0.8; }

.admin-gear { color: rgba(255,255,255,0.8); text-decoration: none; display: flex; align-items: center; justify-content: center; margin-right: 12px; }

/* TRANSLATE & SEARCH */
.translate-strip { background: #fff; border-bottom: 1px solid #eee; padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; }
.translate-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #aaa; letter-spacing: 1px; }
.goog-te-gadget-simple { background: transparent !important; border: none !important; padding: 0 !important; font-size: 12px !important; }

.search-wrapper { padding: 10px 20px; background: #fff; border-bottom: 1px solid #eee; position: relative; } 
.search-form { display: flex; align-items: center; background: #F2F2F7; border-radius: 12px; padding: 8px 15px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.06); }
.search-form input { border: none; background: transparent; width: 100%; margin-left: 10px; font-size: 16px; font-family: var(--font-body); color: #1C1C1E; user-select: auto; pointer-events: auto; }
.search-form button { background: transparent; border: none; padding: 0; display: flex; color: #8E8E93; cursor: pointer; align-items: center; }
.search-header { padding: 15px 20px 5px; display: flex; justify-content: space-between; align-items: center; }
.search-header h3 { margin: 0; font-size: 18px; }
.btn-clear-search { background: #ff6e00; color: white; text-decoration: none; font-size: 12px; padding: 4px 10px; border-radius: 15px; font-weight: 700; }

/* SEARCH HINTS CSS */
.search-hints { position: absolute; top: 100%; left: 20px; right: 20px; background: #fff; border-radius: 0 0 12px 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); z-index: 1001; display: none; max-height: 300px; overflow-y: auto; border: 1px solid #eee; border-top: none; }
.search-hints.active { display: block; }
.hint-item { padding: 12px 15px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.2s; text-decoration: none; color: inherit; }
.hint-item:last-child { border-bottom: none; }
.hint-item:hover { background: #fafafa; }
.hint-item img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: #eee; }
.hint-item span { font-size: 15px; font-weight: 600; color: #333; }

/* CARD STYLES */
.recipe-card { background: var(--card-bg); margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.02); position: relative; padding-bottom: 10px; }
.media-scroller { position: relative; height: 380px; background: #eee; overflow: hidden; z-index: 1; transition: height 0.3s ease; }
.recipe-card.is-expanded .media-scroller { position: sticky; top: 58px; z-index: 50; box-shadow: 0 4px 15px rgba(0,0,0,0.15); height: 190px; }
.media-item { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s ease-in-out; z-index: 1; }
.recipe-card.is-expanded .media-item { width: 50%; }
.recipe-card.is-expanded .media-item:nth-child(odd) { left: 0; }
.recipe-card.is-expanded .media-item:nth-child(even) { left: 50%; }
.media-item.active { opacity: 1; z-index: 2; }
.media-item img { width: 100%; height: 100%; object-fit: cover; }

.card-content { padding: 20px 20px 10px 20px; position: relative; z-index: 2; background: var(--card-bg); }
.recipe-card.is-expanded .card-content { z-index: 10; position: relative; min-height: 60vh; }
.card-top-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.recipe-title { font-family: var(--font-head); font-size: 26px; line-height: 1.1; margin: 0; color: var(--text-main); font-weight: 700; max-width: 85%; letter-spacing: -0.02em; }
.icon-btn { background: #F2F2F7; border: none; padding: 0; color: var(--text-main); cursor: pointer; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.icon-btn.active { color: #FF2D55; background: #FFEDF0; }

/* MARKDOWN CONTENT STYLES */
.md-content { font-size: 15px; line-height: 1.6; color: #444; margin-top: 10px; overflow: hidden; position: relative; transition: max-height 0.4s ease; counter-reset: recipe-steps; }
.md-content h1, .md-content h2, .md-content h3 { font-family: var(--font-head); color: #000; margin-top: 20px; margin-bottom: 10px; letter-spacing: -0.01em; }
.md-content h1 { font-size: 22px; }
.md-content h2 { font-size: 18px; font-weight: 700; }
.md-content h3 { font-size: 16px; font-weight: 700; }
.md-content ul, .md-content ol { margin: 10px 0; padding-left: 20px; }
.md-content li { margin-bottom: 6px; }
.md-content p { margin-bottom: 12px; }
.md-content table { width: 100%; border-collapse: collapse; margin: 15px 0; font-size: 14px; }
.md-content th, .md-content td { border: 1px solid #e0e0e0; padding: 8px 12px; text-align: left; }
.md-content th { background-color: #f9f9f9; font-weight: 700; color: #333; }
.md-content tr:nth-child(even) { background-color: #fcfcfc; }

.read-more-wrapper { position: relative; margin-top: -60px; padding-top: 80px; background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1) 70%); text-align: center; z-index: 20; pointer-events: none; }
.btn-expand { pointer-events: auto; background: #ff6e00; color: white; border: none; padding: 12px 28px; font-weight: 800; font-size: 14px; text-transform: uppercase; cursor: pointer; width: 100%; display: flex; justify-content: center; align-items: center; gap: 8px; box-shadow: 0 6px 8px rgba(0,0,0,0.25); transition: all 0.15s; }
.btn-expand:active { transform: translateY(5px); }
.locked-blur { filter: blur(4px); user-select: none; opacity: 0.6; pointer-events: none; }

/* LOADING SPINNER FOR SCROLL */
.scroll-loader { text-align: center; padding: 20px; display: none; }
.scroll-loader.active { display: block; }
.loading-dots { display: inline-block; font-size: 30px; line-height: 1; animation: jump 1.5s infinite; color: #ff6e00; }
@keyframes jump { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* PREMIUM SHEET */
.premium-sheet { position: fixed; bottom: 0; left: 0; width: 100%; background: #1e1e1e; padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; z-index: 9999; box-shadow: 0 -5px 20px rgba(0,0,0,0.5); transform: translateY(150%); transition: transform 0.4s; }
.premium-sheet.visible { transform: translateY(0); }
.sheet-content-left { display: flex; flex-direction: column; justify-content: center; position: relative; }
.discount-tag { position: absolute; top: -31px; left: 20px; background: #F44336; color: #fff; font-weight: 800; font-size: 10px; padding: 2px 6px; transform: rotate(-19deg); z-index: 2; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); }
.price-line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.price-main { font-size: 26px; font-weight: 800; color: #FFFFFF; }
.price-cross { font-size: 16px; color: #888888; text-decoration: line-through; font-weight: 500; }
.timer-section { display: flex; flex-direction: column; gap: 2px; }
.validity-text { font-size: 10px; color: #D4FF33; font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.timer-boxes { display: flex; align-items: center; gap: 6px; }
.time-box { background: #FFFFFF; color: #000000; font-family: monospace; font-weight: 800; font-size: 16px; padding: 4px 8px; border-radius: 4px; min-width: 32px; text-align: center; }
.time-sep { color: #FFFFFF; font-weight: 800; font-size: 16px; }
.btn-continue { background: #D4FF33; color: #000000; border: none; padding: 14px 30px; border-radius: 12px; font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: 0 0 15px rgba(212, 255, 51, 0.3); transition: transform 0.1s ease; }
.btn-continue:active { transform: scale(0.96); }
@keyframes shake-btn { 0%, 100% { transform: translateX(0); } 10%, 90% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
.shake-animation { animation: shake-btn 0.5s cubic-bezier(.36,.07,.19,.97) both; }

/* FOOTER */
.app-footer { padding: 30px 20px 120px 20px; text-align: center; background: var(--app-bg); border-top: 1px solid #e5e5ea; margin-top: 20px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin-bottom: 15px; }
.footer-links a { font-size: 12px; color: var(--text-muted); text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--brand-color); text-decoration: underline; }
.copyright { font-size: 11px; color: #aaa; }

/* GOOGLE CLEANUP */
.goog-te-gadget { color: transparent !important; }
#google_translate_element { color: transparent; }
#google_translate_element a { display: none; }
.goog-te-banner-frame { display: none !important; }
iframe.goog-te-banner-frame { display: none !important; }
body > .skiptranslate { display: none !important; }
.goog-tooltip { display: none !important; }
.goog-text-highlight { background-color: transparent !important; border: none !important; box-shadow: none !important; }
.goog-te-gadget-simple { background-color: #f2f2f7 !important; border: 1px solid #e5e5ea !important; padding: 4px 8px !important; border-radius: 8px !important; font-size: 12px !important; }
.goog-te-gadget-icon { display: none !important; }
.goog-te-gadget span { display: none !important; }
.goog-te-gadget span:first-child { display: block !important; }

/* COMPONENT STYLES */
.recipe-menu-container { width: 100%; max-width: 600px; margin: 0 auto; padding: 10px; font-family: var(--font-body); box-sizing: border-box; }
.rm-section-title { font-size: 16px; font-weight: 800; color: #2d3436; margin: 10px 0 10px 5px; display: flex; align-items: center; }
.rm-section-title::before { content: ''; width: 4px; height: 16px; background: #ff6b6b; border-radius: 2px; margin-right: 8px; }
.rm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rm-card { background: white; border-radius: 14px; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; position: relative; -webkit-tap-highlight-color: transparent; box-shadow: 0 4px 10px rgba(0, 0, 0, .6), 0 1px 3px rgba(255, 255, 255, .2); border: 1px solid #eee; transition: transform 0.1s, box-shadow 0.1s; }
.rm-image-box { width: 100%; aspect-ratio: 1 / 1; background: #f0f0f0; }
.rm-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rm-label { height: 34px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #444; background: white; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.rm-card:active { transform: translateY(3px); box-shadow: 0 2px 0px #e0e0e0; }