* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f5f5f5;
    color: #222;
    line-height: 1.6;
    padding: 0 1rem;
    overflow-wrap: anywhere;
}

a {
    color: #2a7ae2;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
}

h3 {
    font-size: 1.15rem;
    margin-bottom: 0.3rem;
}

img {
    max-width: 100%;
    height: auto;
}

/*  Centered page container */
body > * {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Header */
.top, header.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 1.5rem;
}

.top a {
    font-weight: bold;
}

/* Navigation */
.nav, .nav-row, nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Recipe cards */
.recipes, .recipes-list, .cards-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.recipe-box, .card, .recipe-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1.2rem;
}

.recipe-box h2, .recipe-box h3, .card h2, .recipe-card-title {
    margin-bottom: 0.4rem;
}

.recipe-box img, .card img, .recipe-card-image {
    border-radius: 4px;
    margin: 0.5rem 0;
}

.recipe-box p, .card p, .recipe-card-preview {
    margin-bottom: 0.4rem;
}

.card ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* Profile page */
.profile-intro {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.profile-intro img {
    width: 120px;
    border-radius: 50%;
}

/* Recipe detail page */
.recipe-detail {
    margin-top: 1rem;
}

.recipe-header {
    margin-bottom: 1rem;
}

.recipe-detail > * {
    width: 100%;
}

.recipe-author {
    color: #555;
    margin-bottom: 0.5rem;
}

.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.tag {
    display: inline-block;
    background: #e8f0fe;
    color: #2a7ae2;
    font-size: 0.85rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.recipe-photo {
    width: 100%;
    border-radius: 6px;
    margin: 1rem 0;
}

.recipe-description {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.recipe-description h2 {
    margin-bottom: 0.5rem;
}

.recipe-info {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.info-item strong {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 0.2rem;
}

.info-item span {
    font-size: 1.1rem;
}

.recipe-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

.recipe-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
}

.recipe-columns h2 {
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.3rem;
    margin-bottom: 0.8rem;
}

.recipe-columns ul, .recipe-columns ol {
    padding-left: 1.2rem;
}

.recipe-columns li {
    margin-bottom: 0.5rem;
}

/* Search */
.search-block {
    margin-bottom: 1.5rem;
}

.search-block form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.search-block label {
    font-weight: bold;
}

.search-block input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.search-block button {
    padding: 0.4rem 1rem;
    background: #2a7ae2;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.search-block button:hover {
    background: #1a5fb4;
}

/* Login form */
.login-form input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    margin-top: 0.3rem;
}

.login-form button {
    margin-top: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: #2a7ae2;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.login-form button:hover {
    background: #1a5fb4;
}

/* Spacing helpers */
p + p {
    margin-top: 0.4rem;
}

h1 + p, h2 + p {
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 700px) {
    body {
        padding: 0 0.75rem 1rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .recipe-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .profile-intro {
        flex-direction: column;
        gap: 1rem;
    }

    .search-block form {
        align-items: stretch;
    }

    .search-block label {
        width: 100%;
    }

    .search-block input[type="search"],
    .search-block button {
        width: 100%;
    }
}

/* Ratings & Reviews */
.avg-rating-display {
    margin-top: 0.5rem;
}

.stars-display {
    color: #f5a623;
    font-size: 1.2rem;
}

.recipe-card-rating {
    color: #f5a623;
    font-weight: bold;
    margin-bottom: 0.4rem;
}

.rating-section {
    margin-top: 2rem;
}

.rating-form-area {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    max-width: 500px;
}

.rating-form-area label {
    display: block;
    margin-top: 0.8rem;
    font-weight: bold;
}

.rating-form-area input,
.rating-form-area textarea {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

#star-selector {
    font-size: 28px;
    margin-top: 0.3rem;
}

.star {
    cursor: pointer;
    color: #ccc;
    transition: color 0.15s;
}

.star.active {
    color: #f5a623;
}

.star:hover {
    color: #f5a623;
}

#selected-score {
    color: #555;
    font-size: 0.9rem;
}

#submit-rating-btn {
    margin-top: 0.8rem;
    padding: 0.5rem 1.5rem;
    background: #2a7ae2;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

#submit-rating-btn:hover {
    background: #1a5fb4;
}

#rating-message {
    margin-top: 0.5rem;
    font-weight: bold;
}

#rating-message.success {
    color: green;
}

#rating-message.error {
    color: red;
}

/* Reviews section */
.reviews-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.reviews-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.reviews-controls button {
    padding: 0.4rem 1rem;
    background: #2a7ae2;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.reviews-controls button:hover {
    background: #1a5fb4;
}

#reviews-average {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.8rem;
}

.review-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    max-width: 500px;
    margin-bottom: 0.8rem;
}

.review-score {
    color: #f5a623;
    font-size: 1.2rem;
    font-weight: bold;
}

.review-comment {
    font-style: italic;
    color: #555;
}
