/* iwant2eat — base styles */

:root {
    --primary: #5a9e2f;
    --primary-2: #7ab648;
    --text: #222;
    --muted: #7a7a7a;
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e4e4e4;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}
h1, h2, h3 { margin-top: 0; }
h1:focus { outline: none; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.page { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .brand {
    display: flex; align-items: center; gap: 0.5rem;
    color: var(--text); font-weight: 700; font-size: 1.1rem;
}
.topbar nav { display: flex; align-items: center; gap: 1.25rem; }
.topbar nav a { color: var(--text); }
.topbar nav .linklike {
    background: none; border: none; color: var(--text);
    cursor: pointer; font: inherit; padding: 0;
}
.topbar nav .linklike:hover { color: var(--primary); text-decoration: underline; }
.topbar nav .user-badge {
    display: flex; align-items: center; gap: 0.4rem; color: var(--text);
}
.topbar nav .user-badge:hover { text-decoration: none; color: var(--primary); }
.sub-badge {
    font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 999px;
    font-weight: 600; text-decoration: none;
}
.sub-badge.expired { background: #fbebe9; color: #b94737; }
.sub-badge.trial { background: #fff8f0; color: #8a6d3b; }
.nav-avatar {
    width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
    border: 1.5px solid var(--border);
}
.inline-form { display: inline; }

main {
    flex: 1; max-width: 960px; width: 100%;
    margin: 0 auto; padding: 2rem 1.25rem; box-sizing: border-box;
}

.auth-container {
    max-width: 420px; margin: 4rem auto; padding: 2rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.form-control, .form-control:focus {
    display: block; width: 100%; box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 1rem; background: #fff; outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(90, 158, 47, 0.15); }
.form-floating { margin-bottom: 1rem; }
.form-floating label { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--muted); }

textarea.form-control { font-family: inherit; min-height: 200px; resize: vertical; }

.btn {
    display: inline-block; padding: 0.55rem 1rem;
    border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    font-size: 1rem; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #4a8a25; color: #fff; }
.btn-lg { padding: 0.75rem 1.25rem; font-size: 1.05rem; }
.btn-danger { background: #b94737; border-color: #b94737; color: #fff; }
.w-100 { width: 100%; }

.text-danger, .validation-message { color: #b94737; font-size: 0.9rem; }

.alert {
    padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert-success { background: #eaf7e6; color: #2e6a28; border-color: #b8e1ae; }
.alert-danger { background: #fbebe9; color: #7a2720; border-color: #f2c3bc; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    grid-auto-rows: 1fr;
    gap: 1rem;
}
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem;
    box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block;
}
.card:hover { border-color: var(--primary); }
.card-processing {
    cursor: not-allowed; opacity: 0.7;
    border-style: dashed; border-color: var(--muted);
    animation: pulse-processing 2s ease-in-out infinite;
}
.card-processing:hover { border-color: var(--muted); }
@keyframes pulse-processing {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.5; }
}
.card.drag-over {
    border-color: var(--primary); border-style: dashed; border-width: 2px;
    background: #f5fbf0; transition: all 0.15s;
}
.card-thumb {
    position: absolute; top: 0.6rem; right: 0.6rem;
    width: 56px; height: 56px; border-radius: 6px;
    object-fit: cover; border: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    cursor: zoom-in;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    z-index: 2;
}
.card-thumb:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 14px rgba(0,0,0,0.28);
}

/* Lightbox overlay for expanded thumbnail */
.thumb-lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    animation: thumb-fade 0.15s ease;
    cursor: zoom-out;
}
.thumb-lightbox img {
    max-width: 90vw; max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(0,0,0,0.55);
    background: #fff;
}
@keyframes thumb-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.card:has(.card-thumb) .title,
.card:has(.card-thumb) .subtitle,
.card:has(.card-thumb) .meta { padding-right: 64px; }
.card .title { font-weight: 600; margin-bottom: 0.15rem; }
.card .subtitle { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.25rem; font-style: italic; }
.card .meta { color: var(--muted); font-size: 0.8rem; }

.card-added {
    position: absolute; bottom: 0.5rem; left: 0.8rem;
    color: var(--muted); font-size: 0.72rem; font-style: italic;
    pointer-events: none;
}
/* Reserve space at the bottom so the added-date never collides with the meta line */
.card { padding-bottom: 1.9rem; }

.trash-btn {
    position: absolute; bottom: 0.6rem; right: 0.6rem;
    background: none; border: none; cursor: pointer;
    color: #ccc; padding: 4px; border-radius: 4px;
    transition: color 0.15s;
}
.trash-btn:hover { color: #b94737; }

.delete-confirm {
    position: absolute; bottom: 0.5rem; right: 0.5rem;
    display: flex; align-items: center; gap: 0.4rem;
    background: #fff8f7; border: 1px solid #f2c3bc; border-radius: 6px;
    padding: 0.25rem 0.5rem; font-size: 0.8rem;
}
.delete-confirm span { color: #7a2720; }
.delete-confirm .btn-yes {
    background: #b94737; color: #fff; border: none; border-radius: 4px;
    padding: 0.15rem 0.5rem; cursor: pointer; font-size: 0.75rem;
}
.delete-confirm .btn-yes:hover { background: #9a3a2d; }
.delete-confirm .btn-no {
    background: #e4e4e4; color: #333; border: none; border-radius: 4px;
    padding: 0.15rem 0.5rem; cursor: pointer; font-size: 0.75rem;
}

.add-drop-banner {
    display: block; text-align: center; text-decoration: none;
    background: var(--primary); color: #fff;
    border-radius: var(--radius); padding: 1.25rem 1.5rem;
    margin-bottom: 1rem; transition: all 0.15s;
}
.add-drop-banner:hover { background: #4a8a25; text-decoration: none; color: #fff; }
.add-drop-banner .add-drop-hint { font-size: 0.9rem; opacity: 0.85; }
.add-drop-banner.drag-over {
    background: #4a8a25; transform: scale(1.02);
    box-shadow: 0 0 16px rgba(90, 158, 47, 0.5);
    border: 2px dashed #fff;
}
.add-drop-banner.drag-over .add-drop-hint::after { content: ' here'; }

.pagination {
    display: flex; gap: 0.4rem; justify-content: center;
    margin-top: 1.5rem; flex-wrap: wrap;
}
.pagination .btn { min-width: 2.2rem; padding: 0.4rem 0.6rem; font-size: 0.9rem; }

.empty-hint {
    padding: 2rem; border: 2px dashed var(--border); border-radius: var(--radius);
    text-align: center; color: var(--muted);
}
.email-list { list-style: none; padding: 0; }
.email-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.5rem 0; border-bottom: 1px solid var(--border);
}
.email-list .chip {
    font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 999px;
    background: #f0f0f0; color: var(--muted);
}
.email-list .chip.primary { background: #ffe3de; color: var(--primary); }
.email-list .chip.verified { background: #e5f2de; color: #2e6a28; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.darker-border-checkbox.form-check-input { border-color: #929292; }

#blazor-error-ui {
    background: lightyellow; bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2); display: none;
    left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
    background: #b32121; color: white; padding: 1rem;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ---------- MyRecipes: two-level sidebar navigation ---------- */
.recipes-layout {
    display: flex; gap: 1.25rem; align-items: flex-start;
}
.recipes-sidebar {
    width: 200px; flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem;
    position: sticky; top: 1rem;
}
.recipes-content { flex: 1; min-width: 0; }

.sidebar-section + .sidebar-section { margin-top: 1rem; }
.sidebar-heading {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--muted);
    padding: 0.25rem 0.5rem 0.35rem; margin: 0;
}
.sidebar-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.4rem; width: 100%;
    padding: 0.4rem 0.55rem; margin: 0.1rem 0;
    background: transparent; border: 0; border-radius: 6px;
    font: inherit; color: var(--text); text-align: left;
    cursor: pointer;
}
.sidebar-item:hover { background: rgba(90, 158, 47, 0.08); }
.sidebar-item.active {
    background: rgba(90, 158, 47, 0.15);
    color: var(--primary); font-weight: 600;
}
.sidebar-subitem {
    padding-left: 1rem; font-size: 0.9rem;
}
.sidebar-label {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-count {
    color: var(--muted); font-size: 0.78rem;
    background: var(--bg); padding: 0.05rem 0.4rem; border-radius: 10px;
    flex-shrink: 0;
}
.sidebar-item.active .sidebar-count { background: var(--surface); color: var(--primary); }

@media (max-width: 720px) {
    .recipes-layout { flex-direction: column; }
    .recipes-sidebar {
        width: 100%; position: static;
        /* Cap height on mobile so a long title list doesn't push the cards off-screen. */
        max-height: 50vh; overflow-y: auto;
    }
}
