:root {
    --bg: #ffffff;
    --text: #202124;
    --border: #dfe1e5;
    --hover: #f1f3f4;
    --blue: #1a73e8;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: block;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    margin-top: 5vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: margin-top 0.3s ease, max-width 0.3s ease;
    position: relative;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.container.active {
    margin-top: 2vh;
}

.container.gallery-mode {
    max-width: 1000px !important;
}

header {
    width: 100%;
    margin-bottom: 30px;
    text-align: center;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-family: 'Fredoka', Arial, sans-serif;
    font-size: 2rem;
    font-weight: 500;
    color: #3c4043;
    letter-spacing: -0.5px;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    width: 36px;
    height: 36px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    color: #5f6368;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 20px;
    transition: background 0.2s, color 0.2s;
}

.btn-secondary:hover {
    background: var(--hover);
    color: var(--text);
}

.user-actions .btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 20px;
}

.btn-burger {
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    font-size: 24px;
    padding: 4px;
    line-height: 1;
}

.btn-burger:hover {
    color: var(--text);
}

.burger-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.burger-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    padding: 12px 16px;
    text-align: left;
    box-sizing: border-box;
}

.burger-item:hover {
    background: var(--hover);
}

.burger-item .mdi {
    font-size: 18px;
    color: #5f6368;
}

.burger-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.btn-text {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.user-actions .btn-text {
    font-size: 2rem;
    padding: 0;
    line-height: 1;
}

.user-actions .btn-text:hover {
    text-decoration: none;
    opacity: 0.7;
}

main {
    width: 100%;
}

.search-container {
    position: relative;
    width: 100%;
    margin-bottom: 30px;
}

#searchInput {
    width: 100%;
    padding: 15px 20px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    outline: none;
    box-sizing: border-box;
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
    transition: box-shadow 0.2s;
}

#searchInput:focus {
    box-shadow: 0 1px 6px rgba(32,33,36,.4);
}

.dropdown-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 6px rgba(32,33,36,.28);
    max-height: 250px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.dropdown-results.visible {
    display: block;
}

.dropdown-item {
    padding: 10px 20px;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: var(--hover);
}

.hidden {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Recipes Panel */
.recipes-panel {
    width: 90%;
    max-width: 600px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
    margin-bottom: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.panel-header h2 {
    margin: 0;
    font-size: 16px;
    color: #3c4043;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #5f6368;
}

.recipes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recipes-list li {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    color: var(--blue);
}

.recipes-list li:hover {
    background: var(--hover);
}

/* Recipe Builder */
.recipe-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#recipeName {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 16px;
}

.btn-primary {
    background-color: var(--blue);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: bold;
}

.btn-primary:hover {
    background-color: #174ea6;
}

/* Table */
.table-container {
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 14px;
    color: #5f6368;
    font-weight: normal;
}

td input[type="number"] {
    width: 80px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: right;
}

.remove-btn {
    background: none;
    border: none;
    color: #d93025;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}

.total-row {
    font-weight: bold;
}

.gallery-container {
    width: 100%;
    margin-top: 20px;
}
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
}
.recipe-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: white;
    transition: box-shadow 0.2s;
}
.recipe-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.recipe-card-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #ccc;
}
.recipe-card-info {
    padding: 10px;
}
.recipe-card-title {
    font-weight: bold;
    margin: 0 0 5px 0;
    font-size: 16px;
}
.recipe-card-author {
    font-size: 12px;
    color: #888;
}
.score-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.score-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat {
    background: var(--hover);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.stat .label {
    display: block;
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 4px;
}

.stat .value {
    font-size: 16px;
    font-weight: bold;
}

.gauge-row {
    margin-bottom: 15px;
}
.gauge-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 5px;
}
.gauge-bar-bg {
    width: 100%;
    height: 12px;
    background-color: #e8eaed;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}
.gauge-fill {
    height: 100%;
    border-radius: 6px;
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}
.gauge-target {
    position: absolute;
    height: 100%;
    background-color: rgba(52, 168, 83, 0.3); /* Target range highlight */
    border-left: 1px solid #34a853;
    border-right: 1px solid #34a853;
    z-index: 1;
}
.gauge-hints {
    font-size: 11px;
    color: #80868b;
    margin-top: 4px;
}

.critique-item {
    margin-bottom: 8px;
    padding-left: 14px;
    position: relative;
    font-size: 14px;
}

.critique-item::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--blue);
}

.critique-success::before {
    color: #137333;
}

.affiliate-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 8px;
    font-size: 11px;
    color: #5f6368;
    text-decoration: none;
    vertical-align: middle;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.affiliate-link:hover {
    opacity: 1;
    color: #ff9900;
}

.amazon-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.affiliate-text {
    font-weight: bold;
}

/* Tutorial Viewer */
.tutorial-viewer {
    width: 100%;
}

.tutorial-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.tutorial-header h2 {
    margin: 0;
    font-size: 20px;
    color: #3c4043;
}

.tutorial-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.tutorial-content {
    font-size: 15px;
    line-height: 1.7;
    color: #3c4043;
}

.tutorial-content h2,
.tutorial-content h3 {
    margin-top: 25px;
    margin-bottom: 10px;
}

.tutorial-content p {
    margin: 10px 0;
}

.tutorial-content li {
    margin: 5px 0;
    margin-left: 20px;
}

.tutorial-content a {
    color: var(--blue);
    text-decoration: none;
}

.tutorial-content a:hover {
    text-decoration: underline;
}

.recipe-link-internal {
    font-weight: bold;
    text-decoration: underline;
    color: var(--blue);
}

.recipe-link-internal::before {
    content: "\2192 ";
    font-weight: normal;
}

/* Footer */
.site-footer {
    width: 100%;
    max-width: 1000px;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    font-size: 12px;
    color: #80868b;
}

.footer-link {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-amazon {
    flex-basis: 100%;
    font-size: 11px;
    color: #9aa0a6;
    line-height: 1.5;
}

/* Legal modals */
.legal-content {
    font-size: 14px;
    line-height: 1.7;
    color: #3c4043;
}

.legal-content h3 {
    font-size: 15px;
    margin-top: 20px;
    margin-bottom: 8px;
}

.legal-content p {
    margin: 8px 0;
}

.legal-content a {
    color: var(--blue);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }

    .logo-img {
        width: 28px;
        height: 28px;
    }

    .btn-label {
        display: none;
    }

    .btn-secondary {
        padding: 8px 10px;
    }

    .user-actions .btn-primary {
        padding: 8px 10px;
    }

    .header-content {
        gap: 8px;
    }
}
