/* ===================================
   STYLE-RECIPSE.CSS - FINAL VERSION
   =================================== */

:root {
    --primary-color: #ff9800;
    --primary-dark: #f57c00;
    --primary-light: #fff4e9;
    --accent-color: #43a047;
    --text-color: #333;
    --text-light: #555;
    --border-color: #e0e0e0;
    --background-color: #fdfdfd;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.recipe-app-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.container {
    width: 100%;
    position: relative;
}

/* Auth Buttons Container (Top Right) */
.auth-buttons-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

html[dir="ltr"] .auth-buttons-container { justify-content: flex-end; }
html[dir="rtl"] .auth-buttons-container { justify-content: flex-start; }

.auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.auth-btn.login-btn {
    background-color: #fff;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.auth-btn.login-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.auth-btn.register-btn {
    background-color: var(--primary-color);
    color: #fff;
}

.auth-btn.register-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.auth-btn svg { flex-shrink: 0; }

/* User Info (for authenticated users) */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background-color: #fff;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-color);
}

.unlimited-badge {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, var(--accent-color), #66bb6a);
    color: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(67, 160, 71, 0.3);
}

/* Usage Counter */
.usage-counter {
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #fff8e1, #ffe0b2);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 2px solid var(--primary-color);
}

.usage-counter p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.usage-counter strong {
    color: var(--primary-dark);
    font-size: 1.3rem;
}

/* Banner Section */
.banner-section {
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 400px;
}

/* Main Title Container */
.main-title-container {
    padding: 2rem 1rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    text-align: center;
}

.main-title-container h1 {
    font-size: clamp(2rem, 6vw, 2.8rem);
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.main-title-container p {
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: var(--text-light);
}

/* Welcome & Main Page */
.welcome-container { padding: 1rem 0; }
.hero-section { padding: 1rem; margin-bottom: 2rem; }
.hero-section h2 { font-size: clamp(1.8rem, 5vw, 2.5rem); color: var(--primary-dark); margin-bottom: 1rem; }
.hero-section .hero-subtitle { font-size: clamp(1rem, 3vw, 1.2rem); color: var(--text-light); margin: 0.75rem auto 0; }

/* Stats Section */
.stats-section { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; padding: 2rem; background-color: var(--primary-light); border-radius: 12px; margin-bottom: 3rem; }
.stat-item { text-align: center; min-width: 120px; }
.stat-number { font-size: 2.0rem; font-weight: bold; color: var(--primary-dark); display: block; }
.stat-label { font-size: 1rem; color: #777; margin-top: 0.25rem; display: block; }

/* Main Search & Repeat Search */
.search-container-main { margin-top: 3rem; margin-bottom: 3rem; padding: 2rem; background-color: #fff; border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 0.75rem; }
.search-container-main input { flex-grow: 1; min-width: 250px; padding: 15px; font-size: 1.1rem; border: 2px solid var(--border-color); border-radius: 8px; transition: border-color 0.3s, box-shadow 0.3s; }
.search-container-main input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2); }
.start-btn { background: var(--primary-color); color: white; border: none; padding: 12px 30px; font-size: 1.1rem; font-weight: bold; border-radius: 8px; cursor: pointer; transition: all 0.3s ease; flex-shrink: 0; }
.start-btn:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(245, 124, 0, 0.4); }

/* Latest Recipes Section */
.latest-recipes-section { margin-top: 3rem; padding: 2rem; background-color: #fff; border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); }
.latest-recipes-section h3 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; color: var(--primary-dark); }
.latest-recipes-list { display: flex; flex-direction: column; gap: 0.75rem; }
.latest-recipe-item { background-color: var(--primary-light); padding: 0.75rem 1.25rem; border-radius: 8px; font-weight: 500; transition: background-color 0.3s; }
.latest-recipe-item:hover { background-color: #ffe0b2; }
.skeleton-loader { width: 100%; height: 40px; background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; border-radius: 8px; }
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Loading Carousel */
.loading-carousel { text-align: center; padding: 3rem 1rem; }
.loading-carousel .loading-text { font-size: 1.2rem; color: var(--primary-dark); margin-bottom: 2rem; }
.ingredients-carousel { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 1rem; }
.ingredient-carousel-item { background: #fff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); overflow: hidden; text-align: center; }
.ingredient-carousel-item img { width: 100%; height: 90px; object-fit: cover; }
.ingredient-carousel-item p { padding: 0.5rem; font-size: 0.85rem; }

/* Recipe Details */
.recipe-details { display: none; }
.recipe-summary { background: var(--primary-light); padding: 1.5rem; margin: 2rem 0; border-radius: 8px; }
.recipe-summary h3 { text-align: center; margin-bottom: 1rem; font-size: 1.5rem; }
.summary-stats { display: flex; flex-wrap: wrap; justify-content: space-around; text-align: center; }
.stat { margin: 0.5rem 1rem; }
.stat span { display: block; }
.stat-value { font-size: 1.2rem; font-weight: bold; }

/* Ingredients Section */
.ingredients-section { margin: 3rem 0; }
.ingredients-section h3 { text-align: center; margin-bottom: 2rem; font-size: 1.8rem; color: var(--primary-dark); }
.ingredients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.ingredient-card { background: #fff; border-radius: 10px; box-shadow: var(--card-shadow); overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; opacity: 0; animation: fadeInUp 0.5s forwards; }
.ingredient-card.show { opacity: 1; }
.ingredient-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); }
.ingredient-card a { text-decoration: none; color: inherit; display: block; }
.ingredient-card img { width: 100%; height: 140px; object-fit: cover; }
.ingredient-card .ingredient-title { padding: 1rem; text-align: center; }
.ingredient-card .ingredient-title strong { display: block; margin-bottom: 0.5rem; font-size: 0.95rem; color: var(--text-color); }
.ingredient-card .price { color: var(--primary-dark); font-weight: bold; font-size: 1rem; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Instructions Section */
.recipe-instructions { margin: 3rem 0; }
.recipe-instructions h3 { text-align: center; margin-bottom: 2.5rem; font-size: 1.8rem; color: var(--primary-dark); }
.instruction-step { display: flex; gap: 1.5rem; position: relative; padding-bottom: 2.5rem; }
.instruction-step:not(:last-child)::after { content: ''; position: absolute; top: 40px; bottom: 0; width: 3px; background-color: #e0e0e0; z-index: 0; }
html[dir="ltr"] .instruction-step:not(:last-child)::after { left: 18.5px; }
html[dir="rtl"] .instruction-step:not(:last-child)::after { right: 18.5px; }
.step-number { flex-shrink: 0; width: 40px; height: 40px; background-color: var(--primary-color); color: white; border-radius: 50%; font-weight: bold; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; z-index: 1; position: relative; }
.step-content {  }
.step-text { margin-bottom: 0; line-height: 1.8; padding: 0.5rem 0; }

/* Auth Prompt Section (After Recipe) */
.auth-prompt-section { margin: 3rem 0; padding: 2rem; }
.auth-prompt-card { background: linear-gradient(135deg, #fff8e1, #ffe0b2); border: 3px solid var(--primary-color); border-radius: 15px; padding: 2.5rem; text-align: center; box-shadow: 0 8px 25px rgba(255, 152, 0, 0.2); }
.auth-prompt-card h3 { font-size: 2rem; color: var(--primary-dark); margin-bottom: 1rem; }
.auth-prompt-card p { font-size: 1.1rem; color: var(--text-color); margin-bottom: 2rem; }
.auth-prompt-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.auth-prompt-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 1rem 2rem; border-radius: 10px; font-size: 1.1rem; font-weight: 600; text-decoration: none; transition: all 0.3s ease; border: 2px solid transparent; }
.auth-prompt-btn.register { background-color: var(--primary-color); color: #fff; }
.auth-prompt-btn.register:hover { background-color: var(--primary-dark); transform: translateY(-3px); box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4); }
.auth-prompt-btn.login { background-color: #fff; color: var(--primary-color); border-color: var(--primary-color); }
.auth-prompt-btn.login:hover { background-color: var(--primary-color); color: #fff; }

/* Login Required Modal */
.login-required-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); z-index: 2000; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.login-modal-content { background: #fff; border-radius: 15px; padding: 3rem; max-width: 500px; width: 90%; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); animation: modalSlideIn 0.3s ease-out; }
@keyframes modalSlideIn { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.login-modal-content h3 { font-size: 2rem; color: var(--primary-dark); margin-bottom: 1rem; }
.login-modal-content p { font-size: 1.1rem; color: var(--text-color); margin-bottom: 2rem; line-height: 1.6; }
.login-modal-buttons { display: flex; flex-direction: column; gap: 1rem; }
.modal-btn { padding: 1rem 2rem; border-radius: 10px; font-size: 1.1rem; font-weight: 600; text-decoration: none; transition: all 0.3s ease; border: 2px solid transparent; cursor: pointer; display: block; }
.modal-btn.primary { background-color: var(--primary-color); color: #fff; }
.modal-btn.primary:hover { background-color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4); }
.modal-btn.secondary { background-color: #fff; color: var(--primary-color); border-color: var(--primary-color); }
.modal-btn.secondary:hover { background-color: var(--primary-color); color: #fff; }
.modal-btn.tertiary { background-color: transparent; color: var(--text-light); border: none; }
.modal-btn.tertiary:hover { color: var(--text-color); }

/* Actions, Modals, Toasts */
.recipe-actions { text-align: center; margin: 2rem 0; padding-top: 1rem; border-top: 1px solid var(--border-color); display: flex; justify-content: center; align-items: center; gap: 1rem; flex-wrap: wrap; }
.recipe-actions button, .recipe-actions div { display: inline-block; }
.recipe-actions button { background: var(--primary-color); color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 1rem; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 0.5rem; }
.recipe-actions button:hover { background: var(--primary-dark); transform: translateY(-2px); }
.recipe-actions button:disabled { background: #aaa; cursor: not-allowed; transform: none; }
#saveFavoriteBtn { background-color: var(--accent-color); }
#saveFavoriteBtn:hover { background-color: #388e3c; }

.toast-container { position: fixed; top: 20px; z-index: 1050; }
.toast { background: #333; color: #fff; padding: 12px 20px; margin-top: 10px; border-radius: 8px; box-shadow: 0 3px 10px rgba(0,0,0,0.2); opacity: 0; transform: translateY(-20px); transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #4caf50; }
.toast-error { background: #f44336; }
.toast-info { background: #2196f3; }

.modal { display: none; position: fixed; z-index: 1010; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); justify-content: center; align-items: center; }
.modal-content { background: white; padding: 25px; border-radius: 8px; width: 90%; max-width: 400px; text-align: center; position: relative; }
.modal-content .close-btn { position: absolute; top: 10px; font-size: 1.5rem; cursor: pointer; color: #aaa; }
.modal-content h3 { margin-bottom: 1rem; }
.modal-content input { width: 100%; padding: 10px; margin: 15px 0; border: 1px solid #ccc; border-radius: 5px; }
.modal-content button { width: 100%; padding: 12px; background: var(--accent-color); color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.modal-content button:disabled { background: #aaa; }

/* Repeat Search Section */
.repeat-search-container { margin-top: 3rem; padding-top: 2rem; border-top: 2px dashed var(--border-color); }
.repeat-search-container h3 { text-align: center; margin-bottom: 1rem; }

/* RTL / LTR Specifics */
html[dir="rtl"] { text-align: right; }
html[dir="ltr"] { text-align: left; }
html[dir="ltr"] .hero-section, html[dir="ltr"] .hero-section h2, html[dir="ltr"] .hero-section .hero-subtitle { text-align: left; }
html[dir="ltr"] .main-title-container, html[dir="ltr"] .stats-section, html[dir="ltr"] .recipe-summary, html[dir="ltr"] .ingredients-section h3, html[dir="ltr"] .recipe-instructions h3, html[dir="ltr"] .recipe-actions, html[dir="ltr"] .repeat-search-container h3 { text-align: center; }
html[dir="rtl"] .main-title-container, html[dir="rtl"] .hero-section, html[dir="rtl"] .stats-section, html[dir="rtl"] .recipe-summary, html[dir="rtl"] .ingredients-section h3, html[dir="rtl"] .recipe-instructions h3, html[dir="rtl"] .recipe-actions, html[dir="rtl"] .repeat-search-container h3 { text-align: center; }
html[dir="rtl"] .recipe-summary { border-right: 5px solid var(--primary-color); border-left: none; }
html[dir="ltr"] .recipe-summary { border-left: 5px solid var(--primary-color); border-right: none; }
html[dir="rtl"] .toast-container { left: 20px; right: auto; }
html[dir="ltr"] .toast-container { right: 20px; left: auto; }
html[dir="rtl"] .modal-content .close-btn { left: 15px; right: auto; }
html[dir="ltr"] .modal-content .close-btn { right: 15px; left: auto; }

/* Responsive Design */
@media (max-width: 768px) {
    .recipe-app-wrapper { padding: 0.5rem; }
    .banner-section { margin-bottom: 1rem; border-radius: 8px; }
    .banner-image { max-height: 250px; }
    .auth-buttons-container { justify-content: center !important; }
    .auth-btn, .user-info, .unlimited-badge { padding: 0.5rem 1rem; font-size: 0.85rem; }
    .main-title-container, .hero-section { padding: 1.5rem 0.5rem; }
    .stats-section, .search-container-main { gap: 1rem; padding: 1rem; }
    .search-container-main input { min-width: 100%; }
    .ingredients-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .instruction-step { gap: 1rem; padding-bottom: 2rem; }
    .step-number { width: 35px; height: 35px; font-size: 1rem; }
    html[dir="ltr"] .instruction-step:not(:last-child)::after { left: 16px; }
    html[dir="rtl"] .instruction-step:not(:last-child)::after { right: 16px; }
    .auth-prompt-card { padding: 1.5rem; }
    .auth-prompt-card h3 { font-size: 1.5rem; }
    .auth-prompt-buttons { flex-direction: column; }
    .auth-prompt-btn { width: 100%; }
    .login-modal-content { padding: 2rem 1.5rem; }
    .login-modal-content h3 { font-size: 1.5rem; }
}
