/* assets/css/style.css */

/* ============================================================
   BASE / LAYOUT
   ============================================================ */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f7f7f7;
    color: #222;
    display: flex;
    flex-direction: column;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
}

.site-header {
    background: #006b3f; /* Ghana green */
    color: #fff;
    padding: 1rem 0;
}

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

.logo a {
    color: #fff;
    text-decoration: none;
    font-size: 1.6rem;
    font-weight: bold;
}

.main-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.main-nav a {
    color: #ffd700; /* Ghana gold */
    margin-left: 1rem;
    text-decoration: none;
    font-weight: bold;
}

.main-nav a:hover { text-decoration: underline; }

.site-content {
    flex: 1;
    padding: 1.5rem 0 2rem;
}

/* Safety: stop raw huge images anywhere */
.site-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.site-footer {
    background: #ce1126; /* Ghana red */
    color: #fff;
    padding: 1rem 0;
    text-align: center;
}

/* ============================================================
   HERO (HOMEPAGE)
   ============================================================ */
.new-hero {
    background: url('../images/jollof.jpg') center/cover no-repeat;
    padding: 5rem 1.5rem;
    border-radius: 10px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.new-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.hero-text {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 650px;
    margin: auto;
}

.hero-text h1 {
    font-size: 3rem;
    margin: 0 0 .5rem;
}

.hero-text p {
    font-size: 1.3rem;
    margin: 0 0 1.5rem;
}

.hero-search {
    display: flex;
    justify-content: center;
    gap: 0;
}

.hero-search input {
    padding: .8rem;
    width: clamp(200px, 60%, 520px);
    border-radius: 5px 0 0 5px;
    border: none;
}

.hero-search button {
    padding: .8rem 1.2rem;
    background: #ffd700;
    color: black;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-weight: bold;
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
    font-size: 2rem;
    margin: 2rem 0 1rem;
    text-align: center;
    position: relative;
}
.section-title::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: #ffd700;
    margin: .5rem auto 0;
}

/* ============================================================
   FEATURED DISH
   ============================================================ */
.featured-section { margin: 2rem 0 3rem; }

.featured-card {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    border-left: 6px solid #ffd700;
    padding: 1rem;
}

.featured-media img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 10px;
}

.featured-content h3 {
    margin: 0.6rem 0 0.5rem;
    font-size: 1.6rem;
}

.featured-content p {
    margin: 0 0 1rem;
    color: #444;
    line-height: 1.6;
    max-width: 700px;
}

.featured-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* ============================================================
   CATEGORY GRID
   ============================================================ */
.categories-section { margin: 2rem 0 3rem; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: #006b3f;
    color: white;
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: .3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.category-card:hover { background: #004f2c; }

.category-card-title {
    margin: 0 0 .4rem;
    font-size: 1.2rem;
}

.category-card-desc {
    margin: 0;
    font-size: 0.9rem;
    font-weight: normal;
    opacity: 0.95;
}

.category-meta { margin-top: 0.8rem; }

.category-pill {
    background: rgba(255,255,255,0.25);
    color: #fff;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

/* ============================================================
   RECIPE CARD GRID (also search/related)
   ============================================================ */
.latest-recipes { margin-top: 3rem; }

/* shared grids */
.recipe-grid,
.cards,
.related-grid,
.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.2rem;
}

/* shared card base */
.recipe-card,
.card {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);

    display: flex;
    flex-direction: column;
    height: 100%;
}

/* images never huge */
.recipe-card img,
.card img,
.related-grid img,
.search-grid img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 0.6rem;
}

/* category tags */
.category-tag,
.category-label {
    display: inline-block;
    background: #ce1126;
    padding: 3px 8px;
    color: #fff;
    border-radius: 4px;
    font-size: .75rem;
    margin: .3rem 0 .6rem;
    width: fit-content;
}

/* title + text */
.recipe-card h3,
.card h3 {
    margin: 0.2rem 0 0.4rem;
    font-size: 1.15rem;
}

.recipe-card h3 a,
.card h3 a {
    text-decoration: none;
    color: #222;
}

.recipe-card p,
.card p {
    margin: 0 0 0.9rem;
    color: #444;
    font-size: 0.96rem;
    line-height: 1.6;
}

/* FORCE BUTTON TO BOTTOM */
.recipe-card .btn,
.card .btn {
    margin-top: auto;
    align-self: flex-start;
}

/* ============================================================
   SIMPLE HERO / FILTERS
   ============================================================ */
.hero {
    background: #fff;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 6px solid #ffd700;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.category-filter select,
.search-inline input[type="text"],
.search-inline button {
    padding: 0.4rem 0.6rem;
    font-size: 0.95rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-block;
    padding: 0.45rem 0.8rem;
    background: #ffd700;
    color: #000;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: 0.15s ease;
    text-align: center;
}
.btn:hover { background: #f0c400; }

.btn.danger {
    background: #ce1126;
    color: #fff;
}

/* ============================================================
   RECIPE DETAILS PAGE
   ============================================================ */
.recipe-hero img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.recipe-wrapper {
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.recipe-title {
    margin-top: 0;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.recipe-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.meta-pill,
.category-pill-large {
    background: #006b3f;
    color: #fff;
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.category-pill-large { background: #ce1126; }

.recipe-short-desc {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.recipe-content-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
}

.recipe-box {
    background: #fafafa;
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 6px solid #ffd700;
}

.ingredient-list {
    padding-left: 1.2rem;
    line-height: 1.7;
}

.instruction-text {
    white-space: pre-wrap;
    line-height: 1.7;
}

/* ============================================================
   ADMIN AUTH PAGES (LOGIN)
   ============================================================ */
.admin-auth {
    min-height: 75vh;
    display: grid;
    place-items: center;
    padding: 2rem 0;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    background: #fff;
    padding: 2rem 2.2rem;
    border-radius: 14px;
    border: 1px solid #eee;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.auth-title {
    text-align: center;
    margin: 0 0 0.5rem;
    font-size: 1.9rem;
}

.auth-subtitle {
    text-align: center;
    margin: 0 0 1.5rem;
    color: #555;
    font-size: 0.95rem;
}

.auth-row {
    margin-bottom: 1rem;
}

.auth-row label {
    font-weight: bold;
    display: block;
    margin-bottom: 0.35rem;
}

.auth-row input {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 1rem;
}

.auth-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* ============================================================
   ADMIN DASHBOARD / TABLES
   ============================================================ */
.admin { margin-bottom: 3rem; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-header p {
    margin: 0;
    color: #555;
    font-size: 0.95rem;
}

.admin-header-actions .btn { white-space: nowrap; }

.admin-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    min-width: 150px;
    border: 1px solid #ececec;
}

.admin-stat-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
}
.admin-stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: bold;
}

.admin-table-wrapper {
    background: #fff;
    padding: 1rem 1.2rem;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow-x: auto;
    max-width: 1100px;
    margin: 0 auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    min-width: 750px;
}

.admin-table th,
.admin-table td {
    border: 1px solid #eee;
    padding: 0.7rem 0.75rem;
    vertical-align: middle;
}

.admin-table th {
    background: #f8f8f8;
    text-align: left;
    font-weight: bold;
}

.admin-table tbody tr:nth-child(odd) { background: #fafafa; }
.admin-table tbody tr:hover { background: #fff7d1; transition: 0.2s; }

.admin-thumb {
    width: 84px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.admin-no-image {
    font-size: 0.8rem;
    color: #888;
}

.admin-actions { white-space: nowrap; }
.admin-actions .btn {
    margin: 0 0.25rem 0.25rem 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
}

/* ============================================================
   ADMIN FORMS (modern card layout)
   ============================================================ */
.admin-form {
    background: #fff;
    padding: 1.5rem 1.8rem;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    max-width: 950px;
    margin: 0 auto;
}

.admin-form label {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    display: block;
}

.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form select,
.admin-form textarea,
.admin-form input[type="file"],
.admin-form input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 1rem;
}

.admin-form textarea {
    min-height: 140px;
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
}
.form-grid-full { grid-column: 1 / -1; }

.inline-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.inline-fields label { flex: 1 1 160px; }

.current-image-preview {
    width: 100%;
    max-width: 260px;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #eee;
    margin-bottom: 0.5rem;
}

.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: -0.4rem;
    margin-bottom: 1rem;
}

.errors {
    background: #ffe5e5;
    border: 1px solid #ce1126;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.errors ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }

.success {
    background: #e4ffe5;
    border: 1px solid #2e7d32;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* ============================================================
   RECIPE PREVIEW (ADD/EDIT)
   ============================================================ */
.recipe-preview-wrap {
    max-width: 950px;
    margin: 0 auto 1.2rem;
}

.preview-card {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    border: 1px dashed #e6e6e6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.preview-card img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 0.6rem;
}

.preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
}

.preview-btn {
    pointer-events: none;
    opacity: 0.85;
}

/* ============================================================
   DRAG/DROP UPLOAD (NO LIBRARIES)
   ============================================================ */
.upload-dropzone {
    margin-top: 0.4rem;
    border: 2px dashed #ddd;
    background: #fafafa;
    border-radius: 10px;
    padding: 1.1rem;
    text-align: center;
    cursor: pointer;
    transition: 0.2s ease;
    position: relative;
}

/* 🔥 MOBILE-FIXED: the file input now properly receives tap/click */
.upload-dropzone input[type="file"] {
    opacity: 0;
    position: absolute;
    inset: 0;
    cursor: pointer;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: block;
}

.upload-dropzone:hover {
    border-color: #006b3f;
    background: #f4fff8;
}

.upload-dropzone:active {
    transform: scale(0.99);
    box-shadow: 0 0 0 2px rgba(0, 107, 63, 0.12);
}

.upload-dropzone.dragover {
    border-color: #ffd700;
    background: #fffbe6;
}

.upload-dropzone-inner strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.upload-dropzone-inner span {
    font-size: 0.9rem;
    color: #666;
}

/* ============================================================
   CROPPING TOOL (NO LIBRARIES)
   ============================================================ */
.cropper-wrap {
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.cropper-stage {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: 320px;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
    border-radius: 10px;
}
.cropper-stage img {
    position: absolute;
    top: 0; left: 0;
    user-select: none;
    -webkit-user-drag: none;
}

.crop-box {
    position: absolute;
    border: 2px solid #ffd700;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px; height: 12px;
    background: #ffd700;
    border-radius: 50%;
}
.crop-handle.br { right: -6px; bottom: -6px; cursor: nwse-resize; }
.crop-handle.bl { left: -6px; bottom: -6px; cursor: nesw-resize; }
.crop-handle.tr { right: -6px; top: -6px; cursor: nesw-resize; }
.crop-handle.tl { left: -6px; top: -6px; cursor: nwse-resize; }

.cropper-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

/* ============================================================
   MODAL (DELETE CONFIRMATION)
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-backdrop.hidden { display: none !important; }

.modal {
    background: #fff;
    padding: 1.4rem 1.6rem;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    margin-top: 1.2rem;
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
}
.pagination a {
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    text-decoration: none;
    color: #333;
    background: #fff;
}
.pagination a.active {
    background: #ffd700;
    border-color: #f0c400;
    font-weight: bold;
}
.pagination a:hover { background: #f8f8f8; }

/* ============================================================
   OPTIONAL ADMIN UI POLISH
   ============================================================ */

/* Search bar alignment in admin */
.admin-search input,
.admin-search button {
    height: 42px;
}

/* Better feedback banners ONLY inside admin */
.admin .success,
.admin .errors {
    margin: .75rem 0;
    padding: .75rem 1rem;
    border-radius: 10px;
    font-weight: 500;
}

/* Admin success */
.admin .success {
    background: #e7f8ee;
    color: #116b33;
    border: 1px solid #bde7cc;
}

/* Admin errors */
.admin .errors {
    background: #fdeaea;
    color: #9d1520;
    border: 1px solid #f5b5bb;
}

/* Nicer stat cards (overrides earlier admin-stat-card gently) */
.admin-stat-card {
    border-radius: 14px;
    padding: 1rem 1.2rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */
@media (max-width: 768px) {
    .container { width: 94%; }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .main-nav {
        width: 100%;
        gap: 0.6rem 1rem;
    }
    .main-nav a { margin: 0; font-size: 0.95rem; }

    .new-hero { padding: 3rem 1rem; border-radius: 8px; }
    .hero-text h1 { font-size: 1.9rem; line-height: 2.3rem; }
    .hero-text p { font-size: 1rem; }

    .hero-search { flex-direction: column; gap: 0.5rem; }
    .hero-search input,
    .hero-search button {
        width: 100%;
        border-radius: 6px;
    }

    .featured-card {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.9rem;
    }
    .featured-media img { height: 200px; }

    .recipe-grid,
    .cards,
    .category-grid,
    .related-grid,
    .about-grid {
        grid-template-columns: 1fr !important;
    }
    .recipe-card img,
    .card img { height: 160px; }

    .recipe-hero img { height: 240px; }
    .recipe-wrapper { padding: 1.3rem 1.2rem; }
    .recipe-title { font-size: 1.7rem; }
    .recipe-content-grid { grid-template-columns: 1fr; }

    .form-grid { grid-template-columns: 1fr; }

    .admin-header { flex-direction: column; align-items: flex-start; }
    .admin-header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .admin-header-actions .btn {
        width: 100%;
        text-align: center;
        padding: 0.55rem;
    }

    .admin-thumb { width: 65px; height: 50px; }

    /* Mobile upload UX tweaks */
    .upload-dropzone {
        padding: 1.4rem 1.2rem;
        border-width: 2px;
    }

    .current-image-preview,
    #imagePreviewBox {
        max-width: 100%;
        width: 100%;
        height: 210px;
    }
}

@media (max-width: 480px) {
    .admin-header-actions { grid-template-columns: 1fr; }
    .cropper-stage { height: 250px; }
}