/* ------------------------------------------------------ */
/* GLOBAL BASE LAYOUT                                     */
/* ------------------------------------------------------ */

body {
    font-family: sans-serif;
    margin: 2rem;
    background: #fafafa;
    color: #222;
}

.logo {
    height: 140px;
    width: auto;
}

/* ------------------------------------------------------ */
/* HEADER + NAVIGATION                                    */
/* ------------------------------------------------------ */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-title {
    font-size: 1.8rem;
    margin: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-nav > a {
    text-decoration: none;
    font-size: 1.1rem;
    color: #333;
    font-weight: 700;
}

.header-nav > a:hover {
    color: #4CAF50;
}

/* Add separators between top-level nav items */
.header-nav > a:not(:last-child)::after,
.header-nav > .nav-dropdown:not(:last-child)::after {
    content: "|";
    margin: 0 0.75rem;
    color: #555;
    font-weight: 400;
}

/* ------------------------------------------------------ */
/* CLICK-BASED DROPDOWN MENU                              */
/* ------------------------------------------------------ */

.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    font-weight: 700;
    color: #333;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 120%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 180px;
    padding: 0.5rem 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.nav-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background: #f0f0f0;
}

/* ------------------------------------------------------ */
/* PAGE TITLES                                            */
/* ------------------------------------------------------ */

.page-title {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

/* ------------------------------------------------------ */
/* CARDS (Forms, Details, etc.)                           */
/* ------------------------------------------------------ */

.card {
    position: relative;
    max-width: 600px;
    margin: 40px auto;
    padding: 30px 30px 60px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ------------------------------------------------------ */
/* RECIPE FORM                                            */
/* ------------------------------------------------------ */

.recipe-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recipe-form label {
    font-weight: 600;
    margin-bottom: 4px;
}

.recipe-form input,
.recipe-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.recipe-form textarea {
    min-height: 120px;
}

.btn-primary {
    padding: 14px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    width: 100%;
}

.btn-primary:hover {
    background: #43a047;
}

/* ------------------------------------------------------ */
/* RECIPE GRID                                            */
/* ------------------------------------------------------ */

.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 20px;
}

.recipe-card {
    display: block;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    text-decoration: none;
    color: #000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    position: relative;
    padding-bottom: 48px;
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.recipe-card h3 {
    margin: 0;
    font-size: 1.2rem;
}

.recipe-card img {
    width: 100%;
    border-radius: 8px;
    margin-top: 10px;
}

.card-subtext {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #4CAF50;
}

/* ------------------------------------------------------ */
/* DELETE ICON + CONFIRMATION                             */
/* ------------------------------------------------------ */

.recipe-card .delete-icon,
.card .delete-icon {
    position: absolute;
    bottom: 12px;
    right: 12px;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 20px;
    color: #c62828;
    transition: opacity 0.2s ease;
}

.recipe-card .delete-icon:hover,
.card .delete-icon:hover {
    opacity: 0.7;
}

.delete-confirmation {
    position: absolute;
    right: 16px;
    bottom: 56px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.16);
    padding: 12px 16px;
    font-size: 0.9rem;
    display: none;
    z-index: 20;
}

.card.show-delete .delete-confirmation {
    display: block;
}

.delete-confirmation button {
    margin-top: 8px;
    margin-right: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
}

.confirm-delete {
    background: #c62828;
    color: #fff;
}

.cancel-delete {
    background: #e0e0e0;
    color: #333;
}

/* ------------------------------------------------------ */
/* MODAL                                                  */
/* ------------------------------------------------------ */

.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #fff;
    padding: 20px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 320px;
    text-align: center;
}

.modal-buttons {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.btn-danger {
    background: #c62828;
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
}

//Temporary
.dropdown-menu {
    background: rgba(255, 0, 0, 0.2); /* TEMPORARY DEBUG */
}

.parse-preview { margin-top: 12px; }
.hidden { display: none; }
.spinner { font-style: italic; color: #666; }
.parse-error { color: #b00020; }
.parse-image { max-width: 220px; display:block; margin:8px 0; }

.recipe-detail-card {
    max-width: 800px;          /* keeps it contained */
    margin: 0 auto;            /* centers it */
    padding: 20px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);

    /* ⭐ The magic trio */
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.recipe-detail-card p,
.recipe-detail-card li {
    line-height: 1.6;
    margin-bottom: 10px;

    /* ensure children also wrap */
    overflow-wrap: break-word;
    word-break: break-word;
}

.recipe-detail.card {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
    position: relative;

    /* ensure the card itself contains everything */
    overflow-wrap: break-word;
    word-break: break-word;
}

.text-block {
    white-space: pre-wrap;      /* preserves line breaks */
    word-wrap: break-word;      /* wraps long words */
    overflow-wrap: break-word;  /* modern wrapping */
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Make edit fields bigger ONLY on the edit page */
.edit-card input[type="text"],
.edit-card input[type="url"],
.edit-card textarea {
    width: 100%;
    font-size: 1.1rem;
    padding: 14px;
    line-height: 1.6;
    border-radius: 8px;
    resize: vertical;
    margin-bottom: 16px;
}

/* Make textareas comfortably large */
.edit-card textarea {
    min-height: 240px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Optional: nicer focus state */
.edit-card input:focus,
.edit-card textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
    outline: none;
}

/* Center the whole search form */
.search-form {
    display: flex;
    justify-content: center;
    margin: 40px auto;
    width: 100%;
}

/* Google-style container */
.search-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    padding: 12px 20px;
    width: 60%;                 /* controls size */
    max-width: 600px;           /* Google-like max width */
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: box-shadow 0.2s ease;
}

/* Hover/focus effect like Google */
.search-inner:focus-within {
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* Search icon */
.search-icon {
    background: none;
    border: none;
    font-size: 1.3rem;
    margin-right: 10px;
    cursor: pointer;
}

/* Input field */
.search-input {
    flex: 1;
    border: none;
    font-size: 1.1rem;
    outline: none;
}

/* Clear button */
.search-clear {
    font-size: 1.2rem;
    text-decoration: none;
    margin-left: 10px;
    color: #888;
}

.search-form {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0 30px 0;
}

.search-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    width: auto;
    max-width: none;
    box-shadow: none;
    border: 1px solid #ccc;
}

.search-form {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0 30px 0;
}

.search-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 8px 12px;
    width: 100%;
    max-width: 500px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 6px;
}

.search-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    margin-right: 8px;
    cursor: pointer;
}

.search-clear {
    margin-left: 8px;
    color: #888;
    text-decoration: none;
}

/* AUTH BUTTON (Login / Logout) */
.auth-btn {
    background: #2563eb;          /* Recipecache blue */
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s ease, transform 0.15s ease;
    border: none;
}

.auth-btn:hover {
    background: #1e4fcf;          /* Slightly darker blue */
    transform: translateY(-1px);
}

.auth-btn:active {
    background: #1b46b8;
    transform: translateY(0);
}

/* Ensures spacing inside your nav */
.auth-nav {
    margin-left: 16px;
    display: flex;
    align-items: center;
}

.recipe-detail-container {
    max-width: 720px;
    margin: 0 auto;
}

.recipe-title {
    margin-bottom: 1rem;
}

.recipe-image-wrapper {
    margin: 1rem 0;
}

.recipe-image {
    width: 100%;
    border-radius: 8px;
}

.recipe-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.ingredients-list,
.instructions-list {
    padding-left: 1.2rem;
}

.ingredient-item,
.instruction-item {
    margin: 0.4rem 0;
    display: flex;
    align-items: center;
}

.ingredient-item.checked .ingredient-text,
.instruction-item.checked .instruction-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.ingredient-check,
.instruction-check {
    margin-right: 0.5rem;
    transform: scale(1.2);
}

.recipe-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

/* Floating Action Buttons */
.floating-edit,
.floating-delete {
    position: fixed;
    bottom: 20px;
    font-size: 2rem;
    background: white;
    border-radius: 50%;
    padding: 0.4rem 0.6rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 50;
}

.floating-edit {
    left: 20px;
}

.floating-delete {
    right: 20px;
    border: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    width: 300px;
    text-align: center;
}

/* Checkbox strike-through */
.ingredient-item.checked .ingredient-text,
.instruction-item.checked .instruction-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.recipe-detail-container {
    max-width: 720px;
    margin: 0 auto;
}

/* Floating action icons */
.floating-edit,
.floating-delete {
    position: fixed;
    bottom: 20px;
    font-size: 2rem;
    background: #ffffff;
    border-radius: 50%;
    padding: 0.35rem 0.6rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 50;
}

.floating-edit {
    left: 20px;
    text-decoration: none;
    border: none;
}

.floating-delete {
    right: 20px;
    border: none;
}

/* Image + meta */
.recipe-image-wrapper {
    margin: 1rem 0;
}

.recipe-image {
    width: 100%;
    border-radius: 8px;
}

.recipe-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Ingredients / instructions */
.ingredients-list,
.instructions-list {
    padding-left: 1.2rem;
}

.ingredient-item,
.instruction-item {
    margin: 0.4rem 0;
    display: flex;
    align-items: center;
}

.ingredient-item.checked .ingredient-text,
.instruction-item.checked .instruction-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.ingredient-check,
.instruction-check {
    margin-right: 0.5rem;
    transform: scale(1.1);
}

/* Actions */
.recipe-actions {
    margin-top: 2rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    width: 300px;
    max-width: 90%;
    text-align: center;
}
