/* Reset and base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    line-height: 1.6;
    margin: 0;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
    color: #333;
    background: #fefefe;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3 {
    color: #333;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e8b4c8;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

/* Header section with random recipe link */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.random-link {
    font-size: 0.8rem;
    color: #777;
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    transition: all 0.1s ease;
    white-space: nowrap;
}

.random-link:hover {
    color: #d4608a;
    border-color: #f4dde7;
    background: #fafafa;
    text-decoration: none;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

/* Links */
a {
    color: #d4608a;
    text-decoration: none;
}

a:hover {
    color: #b84d75;
    text-decoration: underline;
}

/* Search section */
.search-section {
    margin: 2rem 0;
}

.search-container {
    position: relative;
}

#search-input {
    width: 100%;
    padding: 0.75rem;
    padding-right: 2.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    border: 2px solid #f4dde7;
    background: #fefefe;
    color: #333;
    transition: all 0.1s ease;
}

#search-input:focus {
    outline: none;
    border-color: #e8b4c8;
    box-shadow: 0 0 0 2px rgba(232, 180, 200, 0.2);
}

#search-input::placeholder {
    color: #aaa;
}

.clear-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    font-family: inherit;
    transition: color 0.1s ease;
}

.clear-button:hover {
    color: #d4608a;
}

/* Lists */
ul {
    padding-left: 0;
    list-style: none;
}

li {
    margin-bottom: 0.5rem;
}

/* Filter section */
.filter-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #f4dde7;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Tag filters - more compact */
.tag-filter {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: #f8f0f3;
    border: 1px solid #e8b4c8;
    color: #333;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.1s ease;
    white-space: nowrap;
    position: relative;
}

.tag-filter:hover {
    background: #f0e7ec;
    border-color: #d4608a;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(232, 180, 200, 0.3);
}

.tag-filter.active {
    background: #e8b4c8;
    border-color: #d4608a;
    color: #333;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(232, 180, 200, 0.4);
}

/* Recipe list */
#recipe-list li {
    margin-bottom: 0.5rem;
    background: #fefefe;
    border: 1px solid #f4dde7;
    border-left: 4px solid #e8b4c8;
    transition: all 0.1s ease;
}

#recipe-list li:hover {
    border-color: #e8b4c8;
    transform: translateX(4px);
    box-shadow: 2px 2px 4px rgba(232, 180, 200, 0.2);
}

.recipe-link {
    display: block;
    padding: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.recipe-link:hover {
    text-decoration: none;
    color: inherit;
}

/* Recipe page styles */
.recipe-nav {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f4dde7;
}

.recipe-nav a {
    color: #777;
    font-size: 0.9rem;
}

.recipe-nav a:hover {
    color: #d4608a;
}

.recipe {
    max-width: 1200px;
}

.recipe-content {
    margin: 2rem 0;
}

.recipe-content h2 {
    font-size: 1.3rem;
    margin-top: 0;
    color: #333;
    font-weight: 600;
}


.recipe-content ul {
    list-style: disc;
    padding-left: 1.5rem;
}

.recipe-content li {
    margin-bottom: 0.3rem;
}

.recipe-content p {
    margin: 0.5rem 0;
}

.recipe-tags {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #f4dde7;
}

.recipe-tag {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    margin-right: 0.5rem;
    background: #f8f0f3;
    border: 1px solid #e8b4c8;
    font-size: 0.8rem;
    color: #555;
}

/* Side-by-side layout for ingredients and method on wider screens */
@media (min-width: 900px) {
    .recipe-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        align-items: start;
    }
    
    .recipe-content > h2 {
        margin-bottom: 0;
        margin-top: 0;
        line-height: 1;
        padding: 0;
    }
    
    .recipe-content > ul {
        margin-top: -0.3rem;
        margin-bottom: 0;
        padding-top: 0;
    }
    
    .recipe-content > h2:first-of-type {
        grid-column: 1;
    }
    
    .recipe-content > h2:first-of-type + ul {
        grid-column: 1;
    }
    
    .recipe-content > h2:nth-of-type(2) {
        grid-column: 2;
        grid-row: 1;
    }
    
    .recipe-content > h2:nth-of-type(2) + ul {
        grid-column: 2;
        grid-row: 2;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .random-link {
        font-size: 0.75rem;
        align-self: flex-end;
    }
    
    .tag-filter {
        padding: 0.25rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .tag-container {
        gap: 0.3rem;
    }
    
    #recipe-list li {
        padding: 0.5rem;
    }
    
    .recipe-content h2 {
        font-size: 1.2rem;
    }
    
    .recipe-tag {
        padding: 0.25rem 0.6rem;
        font-size: 0.75rem;
        margin-right: 0.3rem;
    }
}