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

:root {
    --primary: #C4783A;
    --primary-dark: #A05828;
    --secondary: #7A8A6C;
    --background: #F4EEE2;
    --surface: #FAF7F2;
    --text: #2E2418;
    --text-light: #66584A;
    --border: #D8CDB8;
    --success: #6A8A5C;
    --warning: #C4783A;
    --shadow: rgba(46, 36, 24, 0.1);
    --danger: #ff4444;
    --danger-hover: #ff3333;
    --notes-bg: #fff9e6;
    --notes-text: #856404;
    --gf-bg: #e8f5e9;
    --gf-bg-dark: #c8e6c9;
    --gf-text: #2e7d32;
    --storage-bg: #f3e5f5;
    --storage-border: #9c27b0;
    --storage-text: #7b1fa2;
    --variations-bg: #e3f2fd;
    --variations-border: #2196f3;
    --variations-text: #1565c0;
    --equipment-bg: #fff8e1;
    --equipment-border: #ffc107;
    --equipment-text: #f57c00;
    --serving-bg: #fce4ec;
    --serving-border: #e91e63;
    --serving-text: #c2185b;
    --tips-bg: #e8eaf6;
    --tips-border: #3f51b5;
    --tips-text: #303f9f;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Sticky Top Wrapper */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px var(--shadow);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.5rem 1rem;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
}

.header-tested {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 500;
    white-space: nowrap;
}

.header-version {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.125rem;
}

/* Header Search */
.header-search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0 0.5rem;
    flex: 0 1 35%;
    max-width: 200px;
    min-width: 100px;
}

.header-search-wrapper input {
    flex: 1;
    padding: 0.5rem 0.25rem;
    border: none;
    font-size: 0.9rem;
    background: transparent;
    color: white;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
}

.header-search-wrapper input:focus {
    outline: none;
}

.header-search-wrapper input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.header-search-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.header-clear {
    display: none;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.header-clear.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.export-btn {
    margin-top: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: white;
    color: var(--primary);
    border: 2px solid white;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.export-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.clear-notes-btn {
    margin-top: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--danger);
    color: white;
    border: 2px solid var(--danger);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-notes-btn:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

.clear-notes-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 68, 68, 0.3);
}

/* ============================
   SEARCH & FILTERS CONTAINER
   ============================ */

.search-filters-container {
    background: var(--background);
    padding: 0.5rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Compact Search Row */
.search-row {
    margin-bottom: 0.75rem;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0 0.5rem;
    transition: all 0.2s;
}

.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.search-icon {
    font-size: 0.9rem;
    padding: 0 0.25rem;
    opacity: 0.6;
}

#search-input {
    flex: 1;
    padding: 0.6rem 0.5rem;
    border: none;
    font-size: 0.95rem;
    background: transparent;
    -webkit-appearance: none;
}

#search-input:focus {
    outline: none;
}

#search-input::placeholder {
    color: var(--text-light);
}

.clear-btn {
    display: none;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--text-light);
    color: white;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.clear-btn.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn:active {
    transform: scale(0.95);
}

/* Filter Dropdowns */
.filter-dropdowns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
    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 fill='%237F8C8D' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.75rem;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-select:not([value=""]) {
    border-color: var(--secondary);
    background-color: rgba(78, 205, 196, 0.08);
}

/* Quick Filter Chips */
/* Results Info */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-light);
    background: var(--background);
}

#results-count {
    font-weight: 500;
}

.clear-filters-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filters-btn:hover {
    background: var(--primary);
    color: white;
}

.clear-filters-btn.hidden {
    display: none;
}

/* Mobile adjustments for filters */
@media (max-width: 480px) {
    .filter-dropdowns {
        grid-template-columns: 1fr 1fr;
    }

    .filter-select {
        font-size: 0.75rem;
        padding: 0.45rem 0.5rem;
        padding-right: 1.5rem;
    }
}

/* Legacy tab styles (kept for compatibility) */
.filter-tabs {
    display: none; /* Hidden - replaced by chips */
}

.tab {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab:active {
    transform: scale(0.97);
}

/* Recipe List */
.recipe-list {
    padding: 0 1rem 2rem;
    display: grid;
    gap: 1rem;
}

.recipe-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    overflow: hidden;
}

.recipe-card:not(.has-image) {
    padding: 1.25rem;
}

.recipe-card:active {
    transform: scale(0.98);
}

.recipe-card:focus-within {
    border-color: var(--primary);
}

.recipe-card.tested {
    border-color: var(--success);
}

/* Recipe Card Image */
.recipe-card-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: var(--background);
}

.recipe-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recipe-card:hover .recipe-card-image img {
    transform: scale(1.05);
}

.recipe-card-content {
    padding: 1rem 1.25rem 1.25rem;
}

.recipe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.recipe-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

.tested-badge {
    background: var(--success);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.recipe-category {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.has-notes {
    color: var(--warning);
    font-weight: 600;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    position: relative;
    padding: 2rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--text-light);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
}

.close-modal:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.menu-toggle:focus-visible {
    outline: 3px solid white;
    outline-offset: 2px;
}

.menu-close:focus-visible {
    outline: 3px solid white;
    outline-offset: 2px;
}

.menu-list li a:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
    background: var(--background);
}

.recipe-detail-image {
    width: 100%;
    height: 2in;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#recipe-detail h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text);
}

#recipe-detail h2 {
    font-size: 1.375rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--text);
}

#recipe-detail h3 {
    font-size: 1.125rem;
    margin: 1rem 0 0.5rem;
    color: var(--text);
}

#recipe-detail p {
    margin-bottom: 0.75rem;
}

#recipe-detail ul, #recipe-detail ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

#recipe-detail li {
    margin-bottom: 0.5rem;
}

#recipe-detail table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9375rem;
}

#recipe-detail th, #recipe-detail td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

#recipe-detail th {
    background: var(--background);
    font-weight: 600;
}

/* Testing Controls */
.testing-controls {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.testing-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.testing-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.notes-guide {
    background: #FFF9E6;
    border-left: 4px solid var(--warning);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.notes-guide strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.notes-guide ul {
    margin: 0.5rem 0 0 1.25rem;
    list-style: disc;
}

.notes-guide li {
    margin-bottom: 0.25rem;
    color: var(--text-light);
}

.testing-notes {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
}

.testing-notes:focus {
    outline: none;
    border-color: var(--primary);
}

/* Photo Upload */
.photo-section {
    margin: 1.5rem 0;
}

.photo-upload {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.photo-preview {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    margin-top: 1rem;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn:active {
    transform: scale(0.97);
}

/* Wake Lock Button */
.wake-lock-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    cursor: pointer;
    z-index: 150;
    transition: all 0.2s;
}

.wake-lock-btn:active {
    transform: scale(0.95);
}

.wake-lock-btn.active {
    background: var(--success);
}

/* Responsive */
@media (min-width: 768px) {
    .recipe-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .recipe-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ===== COOKBOOK-STYLE RECIPE LAYOUT ===== */

/* Recipe Title */
.recipe-title-main {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary);
}

/* Metadata Card */
.recipe-metadata-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.meta-category {
    font-size: 0.875rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.meta-times {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.meta-item {
    font-size: 0.9375rem;
    color: var(--text);
}

.meta-item strong {
    color: var(--text-light);
}

.meta-yield {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.meta-source {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.meta-status {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.meta-status.status-tested {
    background: rgba(106, 138, 92, 0.15);
    color: var(--success);
}

.meta-status.status-untested {
    background: rgba(196, 120, 58, 0.15);
    color: var(--warning);
}

/* Recipe Sections */
.recipe-section {
    margin-bottom: 2rem;
}

.recipe-section h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.recipe-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin: 1.25rem 0 0.75rem;
}

/* Ingredients Section */
.ingredients-section {
    background: var(--surface);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.ingredients-section h2 {
    border-bottom-color: var(--secondary);
}

/* Ingredients List (cookbook style) */
.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 1;
}

.ingredient-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}

.ingredient-item:last-child {
    border-bottom: none;
}

.ingredient-amount {
    font-weight: 600;
    color: var(--primary);
    margin-right: 0.25rem;
}

@media (min-width: 600px) {
    .ingredients-list {
        columns: 2;
        column-gap: 2rem;
    }

    .ingredient-item {
        break-inside: avoid;
    }
}

/* Instructions Section */
.instructions-section {
    margin-bottom: 2rem;
}

.instructions-section h2 {
    border-bottom-color: var(--primary);
}

/* Instructions Paragraphs (cookbook style) */
.instructions-paragraphs {
    margin: 0;
}

.instruction-step {
    margin-bottom: 1rem;
    line-height: 1.7;
    text-align: justify;
}

.instruction-step strong {
    color: var(--primary);
    font-weight: 700;
}

/* Bullet Lists */
.bullet-list {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.bullet-list .bullet-item {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Notes Section */
.notes-section {
    background: var(--notes-bg);
    border-left: 4px solid var(--warning);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.notes-section h2,
.notes-section .collapsible-header span:first-child {
    color: var(--notes-text);
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* GF Section */
.gf-section {
    background: linear-gradient(135deg, var(--gf-bg) 0%, var(--gf-bg-dark) 100%);
    border-left: 4px solid var(--success);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.gf-section h2,
.gf-section .collapsible-header span:first-child {
    color: var(--gf-text);
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* Storage Section */
.storage-section {
    background: var(--storage-bg);
    border-left: 4px solid var(--storage-border);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.storage-section h2,
.storage-section .collapsible-header span:first-child {
    color: var(--storage-text);
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* Nutrition Section - compact grid */
.nutrition-section {
    background: var(--surface);
    border-left: 4px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.nutrition-section h2 {
    color: #66584A;
    border-bottom: none;
    margin-bottom: 0.5rem;
    padding-bottom: 0;
    font-size: 1rem;
}

.nutrition-section .collapsible-content ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 2px 16px;
}

.nutrition-section .collapsible-content li {
    margin: 0;
    padding: 3px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

/* Variations Section */
.variations-section {
    background: var(--variations-bg);
    border-left: 4px solid var(--variations-border);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.variations-section h2,
.variations-section .collapsible-header span:first-child {
    color: var(--variations-text);
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* Equipment Section */
.equipment-section {
    background: var(--equipment-bg);
    border-left: 4px solid var(--equipment-border);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.equipment-section h2 {
    color: var(--equipment-text);
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* Serving Suggestions Section */
.serving-section {
    background: var(--serving-bg);
    border-left: 4px solid var(--serving-border);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.serving-section h2 {
    color: var(--serving-text);
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* Tips Section */
.tips-section {
    background: var(--tips-bg);
    border-left: 4px solid var(--tips-border);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5rem;
}

.tips-section h2 {
    color: var(--tips-text);
    border-bottom: none;
    margin-bottom: 0.75rem;
    padding-bottom: 0;
}

/* Recipe Footer */
.recipe-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
}

/* Blockquotes in recipes */
#recipe-detail blockquote {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left: 4px solid var(--success);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
    font-weight: 500;
}

/* Recipe detail paragraphs */
.recipe-section p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Mobile adjustments for cookbook layout */
@media (max-width: 480px) {
    .recipe-title-main {
        font-size: 1.5rem;
    }

    .meta-times {
        flex-direction: column;
        gap: 0.5rem;
    }

    .instruction-step {
        text-align: left;
    }
}

/* ============================
   AD CONTAINERS
   ============================ */

.ad-container {
    margin: 1.5rem 0;
    padding: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

.ad-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px dashed #ced4da;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    width: 100%;
    max-width: 728px; /* Standard leaderboard width */
    min-height: 90px; /* Standard banner height */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #868e96;
    display: block;
}

/* Ad spot after recipe list */
.ad-list-bottom {
    margin-top: 2rem;
    padding: 0 1rem;
}

/* Ad spot after description (before ingredients) */
.ad-after-description {
    margin: 1.5rem 0;
}

/* Ad spot at end of recipe (before testing controls) */
.ad-recipe-bottom {
    margin: 2rem 0;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

/* Mobile ad adjustments */
@media (max-width: 480px) {
    .ad-placeholder {
        max-width: 100%;
        min-height: 60px; /* Smaller mobile banner */
    }
}

/* Hide ads for premium users (class added via JS) */
body.premium-user .ad-container {
    display: none;
}

/* When real ads are loaded, hide placeholder */
.ad-container.ad-loaded .ad-placeholder {
    display: none;
}

/* ============================
   OFFLINE INDICATOR
   ============================ */

.offline-banner {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.offline-banner.hidden {
    display: none;
}

.offline-banner span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ============================
   JUMP TO RECIPE BUTTON
   ============================ */

.recipe-action-buttons {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
}

.jump-to-recipe-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px var(--shadow);
}

.jump-to-recipe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 120, 58, 0.4);
}

.jump-to-recipe-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(196, 120, 58, 0.3);
}

.print-recipe-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    padding: 0.875rem 1rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px var(--shadow);
}

.print-recipe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(122, 138, 108, 0.4);
}

.print-recipe-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(122, 138, 108, 0.3);
}

.card-size-toggle {
    display: inline-flex;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    overflow: hidden;
    align-self: center;
}

.card-size-btn {
    background: none;
    border: none;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.card-size-btn.active {
    background: var(--primary);
    color: #fff;
}

.card-size-btn:hover:not(.active) {
    background: var(--bg-secondary);
}

.variant-toggle {
    display: inline-flex;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.variant-btn {
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
}

.variant-btn.active {
    background: var(--primary);
    color: #fff;
}

@media print {
    .print-recipe-btn,
    .jump-to-recipe-btn,
    .card-size-toggle,
    .variant-toggle,
    .testing-controls,
    .photo-section,
    .ad-container,
    .header,
    .sticky-top,
    .results-info,
    .recipe-list,
    .close-modal {
        display: none !important;
    }
}

/* ============================
   COLLAPSIBLE DESCRIPTION
   ============================ */

.collapsible-section {
    margin-bottom: 1.5rem;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--background) 0%, var(--border) 100%);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: background 0.2s;
    user-select: none;
    border-bottom: none;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, var(--border) 0%, #c8bda8 100%);
}

/* Styled sections inherit their own background into the header */
.gf-section .collapsible-header { background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); }
.gf-section .collapsible-header:hover { background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%); }
.storage-section .collapsible-header { background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); }
.storage-section .collapsible-header:hover { background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%); }
.variations-section .collapsible-header { background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); }
.variations-section .collapsible-header:hover { background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%); }
.notes-section .collapsible-header { background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%); }
.notes-section .collapsible-header:hover { background: linear-gradient(135deg, #ffecb3 0%, #ffe082 100%); }

.collapsible-header span:first-child {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.collapse-icon {
    font-size: 0.875rem;
    color: var(--text-light);
    transition: transform 0.3s ease;
}

.collapsible-content {
    padding: 0 0.5rem;
    max-height: 1000px;
    overflow-y: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

/* Collapsed state */
.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0;
}

/* ============================
   APP ONLY BADGE
   ============================ */

.app-only-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 0.5rem;
    white-space: nowrap;
    background: linear-gradient(135deg, #e8d5f5 0%, #d4b8e8 100%);
    color: #5b2d8e;
    border: 1px solid #9b59b6;
}

.app-only-badge::before {
    content: "\1F4F1";
    font-size: 0.75rem;
}

/* ============================
   WANT TO TRY BADGE
   ============================ */

.want-to-try-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 0.5rem;
    white-space: nowrap;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #f0c040;
}

.want-to-try-badge::before {
    content: "\2606";
    font-size: 0.75rem;
}

/* ============================
   SMALL BATCH BADGE
   ============================ */

.small-batch-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 0.5rem;
    white-space: nowrap;
    background: linear-gradient(135deg, #fde8d0 0%, #f8d0b0 100%);
    color: #7a3a0a;
    border: 1px solid #C4783A;
}

.small-batch-badge::before {
    content: "½";
    font-size: 0.75rem;
}

/* Mobile adjustments for badges */
@media (max-width: 480px) {
    .app-only-badge,
    .want-to-try-badge,
    .small-batch-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
}

/* ============================
   GF CONFIDENCE BADGES
   ============================ */

.gf-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 0.5rem;
    white-space: nowrap;
}

/* Tested GF - highest confidence (green) */
.gf-badge.gf-tested {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #28a745;
}

/* Estimated GF - conversion available but untested (yellow/orange) */
.gf-badge.gf-estimated {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #ffc107;
}

/* Naturally GF - no flour/gluten ingredients (blue) */
.gf-badge.gf-natural {
    background: linear-gradient(135deg, #cce5ff 0%, #b8daff 100%);
    color: #004085;
    border: 1px solid #007bff;
}

/* Not GF - contains gluten, no conversion available (gray) */
.gf-badge.gf-none {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    color: #383d41;
    border: 1px solid #6c757d;
}

/* Badge icons */
.gf-badge::before {
    font-size: 0.75rem;
}

.gf-badge.gf-tested::before {
    content: "✓";
}

.gf-badge.gf-estimated::before {
    content: "~";
}

.gf-badge.gf-natural::before {
    content: "★";
}

/* GF Badge Legend */
.gf-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: 8px;
    margin: 0.5rem 1rem 1rem;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px var(--shadow);
}

.gf-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.gf-legend-label {
    color: var(--text-light);
}

/* Mobile adjustments for badges */
@media (max-width: 480px) {
    .gf-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .gf-legend {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ============================
   HAMBURGER MENU
   ============================ */

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.header-top h1 {
    flex: 1;
    margin-bottom: 0;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.menu-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Slide-out Menu */
.slide-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--surface);
    z-index: 201;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.slide-menu.open {
    right: 0;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.menu-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.menu-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.menu-list li a {
    display: block;
    padding: 1rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

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

.menu-list li a:active {
    background: rgba(255, 107, 107, 0.1);
}

.menu-divider {
    height: 8px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.menu-section-header {
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.05em;
    background: var(--background);
}

/* Page Modal Content */
.page-modal-content {
    max-width: 800px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.page-content {
    padding: 0 0.5rem;
    line-height: 1.7;
}

.page-content h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.page-content h2 {
    font-size: 1.35rem;
    color: var(--text);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.page-content h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.page-content p {
    margin-bottom: 1rem;
}

.page-content ul, .page-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.page-content li {
    margin-bottom: 0.5rem;
}

.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.page-content th,
.page-content td {
    padding: 0.5rem;
    border: 1px solid var(--border);
    text-align: left;
}

.page-content th {
    background: var(--background);
    font-weight: 600;
}

.page-content a {
    color: var(--primary);
    text-decoration: none;
}

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

.page-content blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: var(--background);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
}

.page-content code {
    background: var(--background);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.page-content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

.close-page-modal {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
