/* Miles Family Recipe Book - Styles */
/* Mobile-first, kitchen-friendly design */

:root {
    --primary-color: #2c5f2d;
    --primary-dark: #1a3d1b;
    --accent-color: #ff6b35;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --border-color: #e0e0e0;
    --sidebar-width: 280px;
    --header-height: 60px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
}

/* === HEADER === */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    border-radius: 4px;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.site-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
}

.site-title a {
    color: white;
    text-decoration: none;
}

.header-search {
    flex: 0 1 300px;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
}

.search-button {
    background: var(--accent-color);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
}

.search-button:hover {
    background: #e55a28;
}

/* === SIDEBAR === */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: -280px;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: left 0.3s ease;
    z-index: 999;
}

.sidebar.active {
    left: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-color);
    color: white;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
}

.sidebar-nav {
    padding: 1rem;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav .nav-level-0 {
    margin-bottom: 0.5rem;
}

.sidebar-nav .nav-directory {
    margin-bottom: 0.75rem;
}

.sidebar-nav .nav-directory-title {
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav .nav-file {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-nav a:hover {
    background: rgba(44, 95, 45, 0.1);
}

.sidebar-nav a.active {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
}

/* === MAIN CONTENT === */

.page-wrapper {
    padding-top: var(--header-height);
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* === BREADCRUMBS === */

.breadcrumbs {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
}

/* === RECIPE META === */

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 1rem;
    margin-top: 1rem;
    font-size: 1.1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-item strong {
    color: var(--primary-color);
}

/* === NUTRITION INFORMATION === */

/* Nutrition box styling - applies to nutrition sections */
.nutrition-box {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    margin: 1rem 0 2rem 0;
}

.nutrition-box h2 {
    margin-top: 0;
    border-bottom-color: var(--accent-color);
}

.nutrition-box p {
    margin: 0.5rem 0 1rem 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

.nutrition-box ul {
    padding-left: 0;
    list-style: none;
    margin: 0;
}

.nutrition-box ul li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    padding-left: 0;
}

.nutrition-box ul li strong {
    color: var(--primary-dark);
    min-width: 140px;
    display: inline-block;
}

/* Nested nutrition items (fiber, sugar, saturated fat) */
.nutrition-box ul ul {
    margin: 0.25rem 0 0.5rem 1.5rem;
    padding-left: 0;
}

.nutrition-box ul ul li {
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

/* === HOME PAGE === */

.home-page {
    max-width: 1000px;
    margin: 0 auto;
}

/* === CATEGORY PAGE === */

.category-page {
    max-width: 1000px;
    margin: 0 auto;
}

.category-page h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.category-breadcrumb {
    margin-bottom: 2rem;
}

.category-breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1rem;
}

.category-breadcrumb a:hover {
    text-decoration: underline;
}

.no-recipes {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.recipe-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.recipe-card h3 {
    margin: 0 0 0.75rem 0;
    color: var(--primary-color);
    font-size: 1.3rem;
    line-height: 1.3;
}

.recipe-card-description {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
    flex: 1;
}

.recipe-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: auto;
    font-size: 0.9rem;
    color: var(--text-light);
}

.recipe-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.home-page h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.home-intro {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 3rem;
}

.recipe-categories {
    margin-bottom: 3rem;
}

.recipe-categories h2 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.category-card h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.category-card p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

.home-search {
    margin-bottom: 3rem;
}

.home-search h2 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

.home-search-form {
    display: flex;
    gap: 1rem;
    max-width: 600px;
}

.home-search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
}

.home-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.home-search-button {
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    font-weight: 600;
}

.home-search-button:hover {
    background: var(--primary-dark);
}

/* === RECIPE CONTENT === */

.recipe-wrapper {
    /* Container for recipe content, meta, and controls */
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.recipe-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.layout-toggle-container {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end;
}

.layout-toggle {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.layout-toggle:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.clear-checkboxes {
    padding: 0.35rem 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 1rem;
}

.clear-checkboxes:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Ingredients header with clear button */
.ingredients-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recipe-layout-single .recipe-columns {
    display: block;
}

/* Column layout only on desktop */
.recipe-layout-columns .recipe-columns {
    display: block;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .recipe-layout-columns .recipe-columns {
        display: grid;
        grid-template-columns: 35fr 65fr;
        gap: 2rem;
        width: 100%;
        max-width: 100%;
    }
}

.recipe-ingredients-column {
    background: var(--bg-secondary);
    padding: 0 1.5rem 1.5rem 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    min-width: 0;
    overflow-wrap: break-word;
}

.recipe-instructions-column {
    padding: 0;
    min-width: 0;
    overflow-wrap: break-word;
}

/* Make h2 headings same size in column view */
.recipe-layout-columns .recipe-ingredients-column h2,
.recipe-layout-columns .recipe-instructions-column h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--primary-dark);
}

.recipe-layout-columns .recipe-ingredients-column h2:first-child,
.recipe-layout-columns .recipe-instructions-column h2:first-child {
    padding-top: 1.5rem;
}

.recipe-layout-columns .recipe-ingredients-column h3 {
    margin-top: 1rem;
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.recipe-content h1 {
    font-size: 2rem;
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    line-height: 1.2;
}

.recipe-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem 0;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.recipe-content h3 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--primary-dark);
}

.recipe-content ul,
.recipe-content ol {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.recipe-content li {
    margin-bottom: 0.5rem;
}

/* Tighter spacing for ingredient lists */
.recipe-ingredients-column ul {
    padding-left: 0;
}

.recipe-ingredients-column ul li {
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

/* Remove indentation from ingredient lists with checkboxes */
.recipe-content ul:has(.ingredient-checkbox) {
    padding-left: 0;
}

.recipe-layout-single .recipe-content ul li {
    margin-bottom: 0.35rem;
}

/* Ingredient checkbox styles */
.ingredient-item {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
}

/* Remove bullets from ingredient list items */
.ingredient-item::marker {
    display: none;
}

li:has(.ingredient-item) {
    list-style: none;
}

.ingredient-checkbox {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0.2rem 0.75rem 0 0;
    cursor: pointer;
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--primary-color);
    background: white;
    position: relative;
}

.ingredient-checkbox:checked {
    background: var(--primary-color);
}

.ingredient-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.ingredient-checkbox:checked + .ingredient-text {
    text-decoration: line-through;
    color: var(--text-light);
}

.ingredient-text {
    flex: 1;
}

.recipe-content p {
    margin: 1rem 0;
}

.recipe-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-color);
    font-style: italic;
    color: var(--text-light);
}

.recipe-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

.recipe-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

.recipe-content a:hover {
    color: var(--primary-dark);
}

.recipe-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.recipe-content code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.recipe-content pre {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

.recipe-content strong {
    font-weight: 600;
    color: var(--primary-dark);
}

/* === SEARCH RESULTS === */

.search-results-page h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.search-query {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.results-count {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.no-results,
.no-query {
    font-size: 1.1rem;
    color: var(--text-light);
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-result-item {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.result-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.5rem;
}

.result-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.result-title a:hover {
    text-decoration: underline;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.result-category {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

.result-ingredients {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.6;
}

.more-indicator {
    color: var(--primary-color);
    font-style: italic;
}

/* === BACK TO TOP BUTTON === */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    box-shadow: var(--shadow-lg);
    z-index: 900;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
}

/* === ERROR PAGE === */

.error-page {
    max-width: 600px;
    margin: 4rem auto;
    padding: 2rem;
    text-align: center;
}

.error-page h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-page a {
    color: var(--primary-color);
}

/* === RESPONSIVE - TABLET === */

@media (min-width: 768px) {
    .header-content {
        padding: 0 2rem;
    }

    .main-content {
        padding: 2rem;
    }

    .recipe-content {
        font-size: 1.15rem;
    }

    .recipe-content h1 {
        font-size: 2.5rem;
    }
}

/* === RESPONSIVE - DESKTOP === */

@media (min-width: 1024px) {
    .sidebar {
        left: 0;
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar-header {
        display: block;
    }

    .sidebar-close {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: var(--sidebar-width);
        max-width: calc(1200px + var(--sidebar-width));
    }

    .recipe-content {
        font-size: 1.2rem;
    }

    .recipe-content h1 {
        font-size: 3rem;
    }
}

/* === PRINT STYLES === */

@media print {
    /* Hide all navigation and UI elements */
    .site-header,
    .sidebar,
    .sidebar-overlay,
    .breadcrumbs,
    .back-to-top,
    .search-form,
    .layout-toggle-container,
    .clear-checkboxes {
        display: none !important;
    }

    /* Reset layout for print */
    .page-wrapper {
        padding-top: 0;
    }

    .main-content {
        margin: 0;
        padding: 0.4in 0.5in;
        max-width: 100%;
    }

    /* Force single column layout for print */
    .recipe-layout-columns .recipe-columns {
        display: block !important;
        grid-template-columns: none !important;
    }

    .recipe-ingredients-column,
    .recipe-instructions-column {
        padding: 0;
        background: none;
        border: none;
    }

    /* Typography */
    body {
        font-size: 8pt;
        line-height: 1.25;
        color: #000;
    }

    .recipe-content {
        font-size: 8pt;
        line-height: 1.25;
    }

    .recipe-content h1 {
        font-size: 14pt;
        color: #000;
        margin-bottom: 0.15in;
        page-break-after: avoid;
    }

    .recipe-content h2 {
        font-size: 10pt;
        color: #000;
        margin-top: 0.1in;
        margin-bottom: 0.08in;
        border-bottom: 1pt solid #000;
        page-break-after: avoid;
    }

    .recipe-content h3 {
        font-size: 9pt;
        color: #000;
        margin-top: 0.08in;
        margin-bottom: 0.05in;
        page-break-after: avoid;
    }

    /* Override column-specific h3 sizes for print */
    .recipe-layout-columns .recipe-ingredients-column h3,
    .recipe-layout-columns .recipe-instructions-column h3 {
        font-size: 9pt !important;
    }

    /* Recipe metadata */
    .recipe-meta {
        border: 1pt solid #000;
        padding: 0.08in;
        margin-bottom: 0.1in;
        background: none;
        page-break-after: avoid;
        page-break-inside: avoid;
        font-size: 8pt;
    }

    .meta-item strong {
        color: #000;
    }

    /* Blockquotes (descriptions) */
    .recipe-content blockquote {
        background: none;
        border-left: 3pt solid #000;
        padding: 0.05in 0.1in;
        margin: 0.08in 0;
        page-break-inside: avoid;
        font-size: 8pt;
    }

    /* Lists */
    .recipe-content ul,
    .recipe-content ol {
        padding-left: 0.2in;
        margin: 0.03in 0;
    }

    .recipe-content li {
        margin-bottom: 0.03in;
        page-break-inside: avoid;
    }

    /* Ingredients - show checkboxes for manual checking */
    .ingredient-item {
        display: flex;
        align-items: flex-start;
        padding: 0;
        margin-bottom: 0.03in;
    }

    .ingredient-checkbox {
        flex-shrink: 0;
        width: 8pt;
        height: 8pt;
        margin: 0.02in 0.06in 0 0;
        border: 0.75pt solid #000;
        border-radius: 50%;
        background: white;
        appearance: none;
        -webkit-appearance: none;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .ingredient-text {
        flex: 1;
    }

    /* Nutrition box */
    .nutrition-box {
        border: 1pt solid #000;
        padding: 0.08in;
        margin: 0.1in 0;
        background: none;
        page-break-inside: avoid;
        font-size: 8pt;
    }

    .nutrition-box h2 {
        border-bottom-color: #000;
    }

    .nutrition-box ul li {
        margin-bottom: 0.02in;
    }

    /* Prevent orphans and widows */
    p, li, blockquote {
        orphans: 3;
        widows: 3;
    }

    /* Page breaks */
    .recipe-content h2,
    .recipe-content h3 {
        page-break-after: avoid;
    }

    /* Links - show URL after link text */
    .recipe-content a {
        color: #000;
        text-decoration: underline;
    }

    .recipe-content a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
    }

    /* Hide images to save ink (optional - remove if you want images) */
    .recipe-content img {
        display: none;
    }

    /* Horizontal rules */
    .recipe-content hr {
        border-top: 1pt solid #000;
        margin: 0.15in 0;
    }
}
