:root {
    --primary: #D35400; /* Deep saffron/orange */
    --secondary: #c0392b; /* Rich red */
    --accent: #f39c12; /* Golden turmeric */
    --bg-color: #faf8f5; /* Creamy off-white */
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Outfit', sans-serif;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #f39c12; 
    --secondary: #e67e22;
    --bg-color: #121212; 
    --card-bg: #1e1e1e;
    --text-dark: #f5f6fa;
    --text-light: #b2bec3;
    --shadow: 0 10px 30px rgba(0,0,0,0.3);
}

[data-theme="dark"] body {
    color: var(--text-dark);
}

[data-theme="dark"] .app-header {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] .ing-card {
    border-color: #333;
}

[data-theme="dark"] .ing-card:hover {
    border-color: var(--primary);
    background: #2a2a2a;
}

[data-theme="dark"] .search-bar {
    background: #2a2a2a;
    border-color: #444;
    color: var(--text-dark);
}

[data-theme="dark"] .category-heading {
    border-bottom: 2px solid #333;
}

[data-theme="dark"] .wizard-view {
    background: var(--card-bg);
}

[data-theme="dark"] .modal-content {
    background: var(--card-bg);
    color: var(--text-dark);
}

[data-theme="dark"] .secondary-btn {
    background: #2a2a2a;
    color: var(--text-dark);
    border-color: #444;
}

[data-theme="dark"] .secondary-btn:hover {
    background: #333;
}

/* Language Dropdown */
.lang-dropdown {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.15);
    color: var(--text-dark);
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 8px 32px 8px 14px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23666'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 140px;
}

.lang-dropdown:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.15);
}

.lang-dropdown:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.2);
}

[data-theme="dark"] .lang-dropdown {
    background-color: #2a2a2a;
    border-color: #444;
    color: var(--text-dark);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23aaa'/%3E%3C/svg%3E");
}

[data-theme="dark"] .lang-dropdown option {
    background: #1e1e1e;
    color: var(--text-dark);
}

[data-theme="dark"] .filter-toggles {
    background: rgba(30,30,30,0.5) !important;
    border-color: #444 !important;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, hsla(28,100%,74%,0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(8,75%,60%,0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(40,100%,74%,0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

/* APP HEADER & PROGRESS */
.app-header {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h2 {
    font-family: var(--font-heading);
    color: var(--primary);
    font-weight: 800;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-dot {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #eee;
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    transition: var(--transition);
}

.step-dot.active {
    background: var(--primary);
    box-shadow: 0 0 10px rgba(211, 84, 0, 0.4);
}

.step-line {
    width: 40px; height: 3px;
    background: #eee;
    border-radius: 2px;
}

/* CONTAINER & WIZARD VIEWS */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    min-height: 80vh;
}

.wizard-view {
    animation: fadeInScale 0.4s ease forwards;
}

.hidden-view { display: none !important; }
.active-view { display: block; }

@keyframes fadeInScale {
    0% { opacity: 0; transform: translateY(20px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* HERO SECTION (VIEW 1) */
.hero-box {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 24px;
    padding: 5rem 3rem;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}

.hero-box h1 {
    font-family: var(--font-heading);
    font-size: 4rem;
    color: var(--secondary);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-desc {
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-weight: 300;
}

.hero-subdesc {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto; margin-right: auto;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 4rem;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.feature-item i {
    font-size: 3rem;
    color: var(--accent);
    background: #fff3e0;
    width: 80px; height: 80px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 20px rgba(243, 156, 18, 0.2);
}

.feature-item span {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.wizard-start-btn {
    font-size: 1.4rem !important;
    padding: 1.2rem 3rem !important;
    border-radius: 50px !important;
}

/* WIZARD COMMON */
.wizard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.wizard-header h2 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.wizard-header p {
    font-size: 1.2rem;
    color: var(--text-light);
}

/* INGREDIENT GRIDS */
.ingredient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.category-heading {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--secondary);
    margin: 2rem 0 1rem;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.grid-small {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.ing-card {
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.ing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
    border-color: rgba(211, 84, 0, 0.3);
}

.ing-card.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 40px rgba(211, 84, 0, 0.3);
}

.card-icon {
    font-size: 3.5rem;
    color: var(--secondary);
    transition: var(--transition);
}

.emoji-icon {
    font-size: 3.5rem;
    display: block;
    line-height: 1;
    transition: var(--transition);
}

.ing-card.selected .card-icon {
    color: white;
}

.card-label {
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
}

/* FOOTER ACTIONS */
.wizard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.action-footer {
    align-items: flex-end;
}

.action-combo {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* BUTTONS */
button { font-family: var(--font-body); }

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(211, 84, 0, 0.3);
    display: flex; align-items: center; gap: 10px;
}

.primary-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(192, 57, 43, 0.4);
}

.secondary-btn {
    background: white;
    color: var(--text-dark);
    border: 2px solid #ddd;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex; align-items: center; gap: 10px;
}

.secondary-btn:hover {
    background: #f1f2f6;
    border-color: #bbb;
}

.small-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

.spice-btn {
    padding: 1.2rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: flex; align-items: center; gap: 10px;
}

.non-spicy-btn {
    background: #27ae60;
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.non-spicy-btn:hover {
    background: #219a52;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.all-spicy-btn {
    background: #e74c3c;
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.all-spicy-btn:hover {
    background: #c0392b;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(192, 57, 43, 0.4);
}

/* RESULTS GRID */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding-bottom: 1rem;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.result-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border-top: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
}

.result-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}

.card-img {
    height: 180px;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 3rem;
}

.card-img.pdf-source {
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.card-tags {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #f1f2f6;
    color: var(--text-light);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.veg-tag {
    background: #e8f8f5;
    color: #27ae60;
}

.no-results {
    grid-column: 1/-1;
    text-align: center;
    padding: 5rem 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.no-results i {
    font-size: 4rem;
    color: #bdc3c7;
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1.2rem;
    color: var(--text-light);
}

/* MODAL: THE SPICE MANUAL STYLE & DEPENDENCIES */
.modal, .modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.75); /* Darker overlay */
    backdrop-filter: blur(8px); /* Blur background */
    display: flex;
    align-items: flex-start; /* Top alignment */
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 5vh; /* Space from top */
}

.modal.active, .modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
    background: #fffdf9;
    width: 92%; max-width: 850px;
    max-height: 88vh;
    border-radius: 20px; /* More rounded */
    position: relative;
    overflow-y: auto;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    transform: translateY(-50px) scale(0.95); /* Slide down effect */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 30px 50px;
}

.modal.active .modal-content, .modal-overlay.active .modal-content { 
    transform: translateY(0) scale(1); 
}

.close-btn {
    position: absolute; top: 20px; right: 20px;
    background: #f1f2f6; border: none;
    width: 40px; height: 40px; border-radius: 50%;
    font-size: 1.2rem; cursor: pointer;
    transition: var(--transition); color: var(--text-dark);
}
.close-btn:hover { background: #ff7675; color: white; }

.manual-style {
    padding: 20px 0; color: var(--text-dark);
    font-family: 'Times New Roman', Times, serif; line-height: 1.8;
    font-size: 1.15rem;
}

.manual-style h1 {
    font-family: 'Arial', sans-serif; font-size: 2.8rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.5px; line-height: 1.2;
    border-bottom: 3px solid var(--text-dark); padding-bottom: 12px; margin-bottom: 20px;
    word-wrap: break-word; overflow-wrap: break-word;
}

.manual-style .meta {
    font-style: italic; color: var(--text-light); margin-bottom: 35px;
    font-family: 'Arial', sans-serif; font-size: 1.2rem;
}

.manual-style h2 {
    font-family: 'Arial', sans-serif; font-size: 1.5rem; font-weight: 700;
    margin-top: 40px; margin-bottom: 22px; text-transform: uppercase;
}

.manual-style ul { list-style-type: none; margin-bottom: 25px; padding-left: 0; }
.manual-style li { margin-bottom: 12px; position: relative; padding-left: 25px; }
.manual-style li::before {
    content: "•"; position: absolute; left: 0;
    color: #d35400; font-weight: bold; font-size: 1.2rem;
}

.manual-style .step { margin-bottom: 20px; text-align: justify; }
.manual-style .step-title { font-weight: bold; font-family: 'Arial', sans-serif; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

@media (max-width: 1024px) {
    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* 2-3 columns on tablets */
    }
    .hero-box { padding: 4rem 2rem; }
    .hero-box h1 { font-size: 3.5rem; }
    .manual-style { padding: 40px; }
}

@media (max-width: 768px) {
    /* Container alignments */
    .container { padding: 0 15px; margin: 20px auto; }
    .app-header { padding: 1rem; flex-direction: column; gap: 15px; }
    .progress-indicator { display: none !important; } /* Hide large progress bar on phones */
    
    /* Hero Section */
    .hero-box { padding: 2.5rem 1.5rem; }
    .hero-box h1 { font-size: 2.5rem; }
    .hero-desc { font-size: 1.1rem; }
    .feature-item { width: 100%; flex-direction: row; text-align: left; }
    .feature-item i { width: 50px; height: 50px; font-size: 2rem; }
    
    /* Wizard / Typography */
    .wizard-header h2 { font-size: 2.2rem; }
    .wizard-header p { font-size: 1rem; }
    
    /* Grids scaling down intelligently */
    .ingredient-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
    .grid-small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .recipe-grid { grid-template-columns: 1fr; /* Strict 1 column for phones */ }
    
    /* Time Grid Fixes */
    .time-grid .ing-card { width: 100% !important; min-height: 140px; height: auto !important; }

    /* Modals & Layout */
    .wizard-footer { flex-direction: column; gap: 1.5rem; align-items: stretch; }
    .action-combo { flex-direction: column; }
    .manual-style { padding: 20px; }
    .manual-style h1 { font-size: 2rem; }
    .modal-content { width: 95%; max-height: 95vh; }
    
    /* Dynamic filter buttons */
    #percentage-filters { justify-content: center; width: 100%; }
    .secondary-btn, .primary-btn { padding: 1rem; text-align: center; justify-content: center; }
}

.floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.4rem;
    box-shadow: 0 4px 15px rgba(192, 57, 43, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}
.floating-btn.visible {
    opacity: 1;
    pointer-events: auto;
}
.floating-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(192, 57, 43, 0.6);
}

/* MATCH PERCENTAGE UI */
#percentage-filters .active-filter {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.match-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.95rem;
    color: white;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-card:hover .match-badge {
    opacity: 1;
    transform: translateY(0);
}

.match-100 { background: #27ae60; }
.match-high { background: #f39c12; }
.match-med { background: #e67e22; }
.match-low { background: #e74c3c; }

.missing-ingredients {
    background: #fff3f3;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 4px;
}
.missing-ingredients h3 {
    color: #e74c3c;
    margin-bottom: 5px;
    font-size: 1.1rem;
    font-weight: bold;
}
.missing-ingredients p {
    color: var(--text-dark);
    font-size: 0.95rem;
    margin: 0;
}

/* GOOGLE TRANSLATE CUSTOMIZATION */
.custom-translate {
    display: flex;
    align-items: center;
}
body { top: 0 !important; }
.goog-te-banner-frame { display: none !important; }
.skiptranslate.goog-te-gadget {
    font-family: var(--font-body) !important;
    font-size: 0px !important; 
    color: transparent !important;
}
.skiptranslate.goog-te-gadget .goog-te-combo {
    font-family: var(--font-body) !important;
    font-size: 1rem !important;
    color: var(--text-dark) !important;
    background-color: var(--card-bg) !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    padding: 8px 15px !important;
    border-radius: 20px !important;
    outline: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.goog-logo-link { display: none !important; }
.goog-te-gadget span { display: none !important; }

/* DARK MODE FIXES */
[data-theme="dark"] .missing-ingredients {
    background: rgba(231, 76, 60, 0.1);
}
[data-theme="dark"] .missing-ingredients h3 {
    color: #ff6b6b;
}
