/* ================================================
   SD eJuice Calculator - Stylesheet v2
   Darker blue, compact layout
   ================================================ */

:root {
    --primary: #1a6bbf;
    --primary-dark: #155da6;
    --primary-darker: #0f4a85;
    --primary-light: #3c81c8;
    --primary-hover: #3c81c8;
    --bg: #dce8f5;
    --bg-card: #FFFFFF;
    --bg-input: #f5f9ff;
    --text: #212121;
    --text-muted: #607D8B;
    --text-light: #90A4AE;
    --border: #c8d8e8;
    --success: #2E7D32;
    --success-bg: #C8E6C9;
    --danger: #C62828;
    --danger-bg: #FFCDD2;
    --warning: #F57F17;
    --warning-bg: #FFF9C4;
    --info: #1a6bbf;
    --info-bg: #dce8f5;
    --shadow: 0 1px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 3px 12px rgba(0,0,0,0.15);
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 10px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --transition: 0.15s ease;

    --badge-admin: #C62828;
    --badge-superuser: #2E7D32;
    --badge-user: #1a6bbf;
    --badge-active: #2E7D32;
    --badge-inactive: #78909C;
    --badge-pending: #F57F17;

    --table-header: var(--primary);
    --table-stripe: #f0f4f8;

    --color-nic: #C62828;
    --color-pg: #1a6bbf;
    --color-vg: #2E7D32;
    --color-flavor: #EF6C00;
}

/* ================================================
   Reset & Base
   ================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14.5px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #125a9e; text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ================================================
   Navigation
   ================================================ */
.main-nav {
    background: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 42px;
    position: relative;
}

.nav-left { display: flex; align-items: center; gap: 0; }

.nav-brand {
    display: flex; align-items: center; gap: 5px;
    color: #fff; font-weight: 800; font-size: 0.85rem;
    margin-right: 1rem; text-decoration: none;
    transition: opacity var(--transition);
}
.nav-brand:hover { opacity: 0.82; }
.nav-brand:hover .brand-icon {
    background: rgba(255,255,255,0.85);
}

.brand-icon {
    background: #fff; color: var(--primary-dark);
    padding: 2px 5px; border-radius: 3px;
    font-weight: 800; font-size: 0.7rem;
    transition: background var(--transition);
}

.brand-text { letter-spacing: 2px; font-size: 0.75rem; }

.nav-link {
    color: rgba(255,255,255,0.8);
    padding: 10px 14px;
    font-weight: 600; font-size: 0.85rem;
    transition: all var(--transition); text-decoration: none;
}

.nav-link:hover, .nav-link.active {
    color: #fff; background: rgba(255,255,255,0.12);
}

.nav-right { display: flex; align-items: center; gap: 8px; }

.nav-username { color: #fff; font-weight: 600; font-size: 0.8rem; }

.user-badge {
    font-size: 0.6rem; font-weight: 800;
    padding: 2px 7px; border-radius: 3px;
    color: #fff; letter-spacing: 0.5px;
}

.user-badge.admin { background: var(--badge-admin); }
.user-badge.superuser { background: var(--badge-superuser); }
.user-badge.user { background: var(--badge-user); }

.nav-toggle {
    display: none; background: none; border: none;
    color: #fff; font-size: 1.4rem; cursor: pointer;
    padding: 6px 10px; margin-left: 8px;
}

/* ================================================
   Main Content
   ================================================ */
.main-content {
    max-width: 1100px; /* page-narrow pages override to 780px below */
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem 1rem;
    flex: 1;
}

/* Narrow layout for calculator, recipe, edit_recipe — keeps flavor rows tight */
.page-narrow .main-content { max-width: 780px; }

/* ================================================
   Cards
   ================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: visible;
    margin-bottom: 1.25rem;
}

/* Clip child elements to card's rounded corners */
.card > *:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card > *:last-child  { border-radius: 0 0 var(--radius) var(--radius); }
.card > *:first-child:last-child { border-radius: var(--radius); }

.card-header {
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.85rem;
    font-style: normal;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

/* Only round the card-header if it's the first child of its card */
.card-header:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

/* Inner card-headers (not first child) get no rounding */
.card-header:not(:first-child) {
    border-radius: 0;
}

.card-header .count {
    margin-left: auto; font-weight: 400;
    font-size: 0.8rem; opacity: 0.85;
    text-transform: none;
}

.card-body { padding: 16px; }
.card-body-compact { padding: 10px 16px; }

/* ================================================
   Page Headers
   ================================================ */
.page-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.4rem; font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: -0.2px;
}

.page-header .icon { font-size: 1.6rem; }

/* ================================================
   Buttons
   ================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px; border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: all var(--transition);
    text-decoration: none; line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1B5E20; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B71C1C; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }

.btn-secondary { background: #B0BEC5; color: var(--text); }
.btn-secondary:hover { background: #90A4AE; }

.btn-outline {
    background: transparent; color: #fff;
    border: 1.5px solid rgba(255,255,255,0.5);
}
.btn-outline:hover { background: rgba(255,255,255,0.12); color: #fff; }

.btn-outline-primary {
    background: transparent; color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-lg { padding: 10px 24px; font-size: 0.9rem; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ================================================
   Forms
   ================================================ */
.form-group { margin-bottom: 0.85rem; }

.form-group label {
    display: block; font-weight: 600;
    margin-bottom: 3px; font-size: 0.82rem;
}

.form-control {
    width: 100%; padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    transition: border-color var(--transition);
    background: var(--bg-input);
}

.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(21,101,192,0.15);
}

/* Calculator field error state */
.form-control.input-error {
    border-color: var(--danger, #e74c3c) !important;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.20) !important;
    background-color: rgba(231,76,60,0.04);
}
.form-control.input-error:focus {
    border-color: var(--danger, #e74c3c) !important;
    box-shadow: 0 0 0 2px rgba(231,76,60,0.30) !important;
}
.calc-warning-persist {
    /* persistent — no auto-dismiss */
}

.form-control-sm { padding: 4px 7px; font-size: 0.78rem; }

textarea.form-control { resize: vertical; min-height: 70px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
}

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.input-group { display: flex; align-items: center; }

.input-group .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-addon {
    padding: 6px 10px;
    background: var(--primary);
    color: #fff; font-weight: 700;
    font-size: 0.78rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    white-space: nowrap;
}

/* ================================================
   Tables
   ================================================ */
.table-wrapper { overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.table-wrapper table { min-width: 0; } /* _HOLD was: min-width: 520px */

table { width: 100%; border-collapse: collapse; }

table thead th {
    background: var(--primary);
    color: #fff; padding: 8px 14px;
    text-align: left; font-weight: 700;
    font-size: 0.8rem; letter-spacing: 0.3px;
    white-space: nowrap;
}

table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

/* When a table sits inside a .card (after a card-header), kill the top-corner
   radius on thead — the card-header above already provides rounded corners,
   and the mismatched radii cause a visible subpixel gap between the two blue bars. */
.card .table-wrapper table thead th:first-child,
.card .table-wrapper table thead th:last-child,
.card > table thead th:first-child,
.card > table thead th:last-child { border-radius: 0; }

table tbody td {
    padding: 7px 14px;
    border-bottom: 1px solid #ECEFF1;
    font-size: 0.82rem;
    vertical-align: middle;
}

table tbody tr:hover { background: rgba(21,101,192,0.03); }
table tbody tr:nth-child(even) { background: var(--table-stripe); }

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ================================================
   Alerts
   ================================================ */
/* ── Toast notifications (bottom-right) ─────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    min-width: 280px;
    max-width: 380px;
    padding: 13px 14px 10px 14px;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.08);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}
.toast.toast-hiding {
    animation: toastOut 0.25s ease forwards;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0)    scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0)    scale(1);    max-height: 120px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateX(40px) scale(0.96); max-height: 0;     margin-bottom: -10px; }
}
.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
}
.toast-body { flex: 1; line-height: 1.4; }
.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.45;
    padding: 0;
    line-height: 1;
    font-size: 1rem;
    margin-top: -1px;
    transition: opacity 0.15s;
}
.toast-close:hover { opacity: 0.9; }
/* Progress bar */
.toast-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    border-radius: 0 0 10px 10px;
    animation: toastProgress linear forwards;
}
@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}
/* Colour variants */
.toast-success {
    background: #f0faf3;
    color: #1a5c2a;
    border: 1px solid #a3d9a5;
}
.toast-success .toast-progress { background: var(--success, #2e7d32); animation-duration: 4s; }
.toast-success .toast-icon { color: var(--success, #2e7d32); }

.toast-error {
    background: #fff5f5;
    color: #8b1a1a;
    border: 1px solid #f5a0a0;
}
.toast-error .toast-progress { background: var(--danger, #c62828); animation-duration: 6s; }
.toast-error .toast-icon { color: var(--danger, #c62828); }

.toast-warning {
    background: #fffbf0;
    color: #7a4f00;
    border: 1px solid #f5d58a;
}
.toast-warning .toast-progress { background: #e6a817; animation-duration: 5s; }
.toast-warning .toast-icon { color: #d48f00; }

.toast-info {
    background: #f0f6ff;
    color: #0d3b7a;
    border: 1px solid #90b8f0;
}
.toast-info .toast-progress { background: var(--primary, #1a6bbf); animation-duration: 4s; }
.toast-info .toast-icon { color: var(--primary, #1a6bbf); }

/* Legacy .alert class — kept for alert-persistent and alert-inline usages */
.alert {
    position: static;
    z-index: auto;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.82rem;
    box-shadow: none;
}
.alert-success { background: var(--success-bg); color: #1B5E20; border-left: 3px solid var(--success); }
.alert-error { background: var(--danger-bg); color: #B71C1C; border-left: 3px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: #F57F17; border-left: 3px solid var(--warning); }
.alert-info   { background: var(--info-bg); color: #0D47A1; border-left: 3px solid var(--info); }
.alert-danger  { background: var(--danger-bg); color: #B71C1C; border-left: 3px solid var(--danger); } /* alias for alert-error */

/* Inline alerts — sit in normal document flow inside cards, not fixed/floating */
.alert-inline {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    z-index: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-shadow: none;
    animation: none;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

/* ================================================
   Badges
   ================================================ */
.badge {
    display: inline-block; padding: 2px 7px;
    border-radius: 3px; font-size: 0.65rem;
    font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-admin { background: var(--badge-admin); color: #fff; }
.badge-superuser { background: var(--badge-superuser); color: #fff; }
.badge-user { background: var(--badge-user); color: #fff; }
.badge-active { background: var(--badge-active); color: #fff; }
.badge-inactive { background: var(--badge-inactive); color: #fff; }
.badge-pending { background: var(--badge-pending); color: #fff; }
.badge-info { background: var(--primary-light); color: #fff; font-size: 0.72rem; padding: 2px 8px; }

/* ================================================
   Tabs
   ================================================ */
.tabs {
    display: flex; flex-wrap: wrap; gap: 0;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 1.25rem;
}

.tab-link {
    padding: 8px 16px; font-weight: 700; font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    cursor: pointer; text-decoration: none;
    display: flex; align-items: center; gap: 5px;
}

.tab-link:hover { color: var(--primary); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ================================================
   Modal
   ================================================ */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000; display: flex; align-items: center; justify-content: center;
}

.modal-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative; background: #fff;
    border-radius: var(--radius); padding: 20px;
    min-width: 300px; max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content h3 { margin-bottom: 6px; color: var(--danger); }
.modal-content p { margin-bottom: 16px; color: var(--text-muted); }

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ================================================
   Calculator
   ================================================ */
.calc-base-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.85rem;
}

.calc-flavor-entry {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px; padding: 5px 0;
    border-bottom: 1px solid #ECEFF1;
}

.calc-flavor-entry .flavor-name-col {
    flex: 1; min-width: 0;
}

.calc-flavor-entry .flavor-pct-col {
    display: flex; align-items: center;
    width: 110px; flex-shrink: 0;
}

.calc-flavor-entry .flavor-pct-col .form-control {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    width: 70px;
}

.calc-flavor-entry .flavor-pct-col .input-addon {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.calc-flavor-entry .btn { flex-shrink: 0; }
.calc-flavor-entry .form-control { min-width: 0; }

/* Carrier pill row — sits on second line under name/pct */
.fc-carrier-row {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-basis: 100%;
    padding-left: 2px;
    margin-top: 2px;
}

.fc-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 8px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid transparent;
    color: var(--text-muted);
    background: var(--bg-subtle, #f4f6f9);
    border-color: var(--border);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    user-select: none;
    line-height: 1.6;
    letter-spacing: 0.3px;
}
.fc-pill:hover { border-color: var(--primary); color: var(--primary); }
.fc-pill.fc-active.fc-pg    { background: var(--primary); color: #fff; border-color: var(--primary); }
.fc-pill.fc-active.fc-vg    { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.fc-pill.fc-active.fc-other { background: #FFC107; color: #5a3e00; border-color: #FFC107; }

/* Stash carrier pills (my_stash.php) */
.stash-carrier-pills {
    display: flex;
    gap: 4px;
    align-items: center;
}
.stash-carrier-pills .fc-pill {
    padding: 2px 10px;
    font-size: 0.78rem;
}

.color-dot {
    display: inline-block; width: 9px; height: 9px;
    border-radius: 50%; margin-right: 5px; vertical-align: middle;
}

.dot-nic { background: var(--color-nic); }
.dot-pg { background: var(--color-pg); }
.dot-vg { background: var(--color-vg); }
.dot-flavor { background: var(--color-flavor); }

/* ================================================
   Recipe Card (View)
   ================================================ */
.recipe-header {
    background: var(--primary);
    color: #fff; padding: 10px 16px;
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}

.recipe-header h2 { font-size: 1.1rem; font-weight: 800; }

.recipe-stars { color: #FFC107; font-size: 0.95rem; }

.recipe-meta {
    margin-left: auto; font-size: 0.78rem; opacity: 0.9;
}

.recipe-badges {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 8px 16px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.recipe-badge {
    background: var(--info-bg); color: var(--primary-dark);
    padding: 3px 10px; border-radius: 16px;
    font-size: 0.72rem; font-weight: 600;
}

.recipe-image { text-align: center; padding: 12px; }

.recipe-image img {
    max-width: 100%; max-height: 360px;
    border-radius: var(--radius); box-shadow: var(--shadow);
}

.recipe-notes {
    padding: 14px 16px; border-top: 1px solid var(--border);
    font-size: 0.85rem; line-height: 1.6;
    color: var(--text-muted);
}

.recipe-notes a { color: var(--primary); text-decoration: underline; }

/* ================================================
   Recipe Index - enhanced listing
   ================================================ */
.recipe-list-item {
    display: flex; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #ECEFF1;
    transition: background var(--transition);
    text-decoration: none; color: var(--text);
}

.recipe-list-item:nth-child(even) {
    background: var(--table-stripe);
}

.recipe-list-item:hover {
    background: rgba(26,107,191,0.05); color: var(--text);
}

.recipe-list-info { flex: 1; min-width: 0; }

.recipe-list-name {
    font-weight: 700; font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 2px;
}

.recipe-list-flavors {
    font-size: 0.75rem; color: var(--text-muted);
    white-space: normal; overflow: hidden;
}

.recipe-list-meta {
    display: grid;
    grid-template-columns: 160px 110px 130px;
    gap: 8px;
    align-items: center;
    font-size: 0.78rem; color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

.recipe-list-meta > span {
    display: inline-flex;
    align-items: center;
}

.recipe-list-actions {
    display: flex; gap: 4px; flex-shrink: 0; margin-left: 10px;
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%; background: var(--primary);
    color: #fff; display: flex; align-items: center;
    justify-content: center; font-size: 0.82rem;
    font-weight: 800; flex-shrink: 0; margin-right: 6px;
}

/* ================================================
   Comments
   ================================================ */
.comment {
    padding: 10px 16px;
    border-bottom: 1px solid #ECEFF1;
}

.comment:last-child { border-bottom: none; }

.comment-header {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 3px;
}

.comment-author { font-weight: 700; color: var(--primary); font-size: 0.8rem; }
.comment-date { color: var(--text-light); font-size: 0.72rem; }
.comment-body { font-size: 0.85rem; }
.comment-actions { margin-top: 3px; }

/* ================================================
   Rating Stars
   ================================================ */
.star-rating { display: inline-flex; gap: 2px; cursor: pointer; }

.star-rating .star {
    font-size: 1.2rem; color: var(--text-light);
    cursor: pointer; transition: color 0.15s;
}

.star-rating .star.filled { color: #FFC107; }

/* ================================================
   Auth Pages
   ================================================ */
.auth-container { max-width: 400px; margin: 2.5rem auto; }

.auth-card {
    background: #fff; border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary);
}

.auth-header {
    background: var(--primary); color: #fff;
    text-align: center; padding: 24px 16px 14px;
}

.auth-header h1 { font-size: 1.4rem; font-weight: 800; font-style: italic; }
.auth-header p { opacity: 0.85; margin-top: 3px; font-size: 0.85rem; }

.auth-body { padding: 24px; }

.auth-body .btn {
    width: 100%; justify-content: center;
    padding: 8px; font-size: 0.9rem;
}

.auth-footer {
    text-align: center; padding: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem; color: var(--text-muted);
}

.auth-footer a { font-weight: 700; }

/* ================================================
   Profile
   ================================================ */
.profile-info {
    display: grid; grid-template-columns: auto 1fr;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.profile-info .pi-row { display: contents; }

.profile-info .pi-row:nth-child(even) dt,
.profile-info .pi-row:nth-child(even) dd {
    background: var(--table-stripe);
}

.profile-info dt {
    font-weight: 700; font-size: 0.82rem; color: var(--text-muted);
    padding: 7px 14px 7px 12px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.profile-info dd {
    font-size: 0.88rem;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
}

.profile-info .pi-row:last-child dt,
.profile-info .pi-row:last-child dd {
    border-bottom: none;
}

.defaults-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1.5rem;
}

.defaults-grid .form-group {
    display: flex; align-items: center; gap: 6px;
}

.defaults-grid .form-group label { min-width: 130px; margin-bottom: 0; }
.defaults-grid .form-group .form-control { max-width: 90px; }

/* ================================================
   Search Bar
   ================================================ */
.search-bar {
    display: flex; gap: 6px;
    align-items: center; margin-bottom: 0.85rem;
}

.search-bar .form-control { flex: 1; }

/* ================================================
   Autocomplete
   ================================================ */
.autocomplete-wrapper { position: relative; }

.autocomplete-list {
    position: absolute; top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 180px; overflow-y: auto;
    z-index: 100; box-shadow: var(--shadow);
    display: none;
}

.autocomplete-list.visible { display: block; }

.autocomplete-item {
    padding: 7px 12px; cursor: pointer;
    font-size: 0.88rem;
    display: flex; gap: 8px; align-items: center;
    transition: background var(--transition);
    color: var(--text);
}

.autocomplete-item:hover,
.autocomplete-item.highlighted { background: var(--info-bg); }

.autocomplete-item .mfg { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

/* ================================================
   Footer
   ================================================ */
.site-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.65);
    text-align: center; padding: 14px 1rem 12px;
    font-size: 0.78rem; margin-top: auto;
}

.footer-container {
    display: flex; align-items: center;
    justify-content: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 8px;
}

.footer-sep {
    opacity: 0.55;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0;
}
.site-footer a { color: rgba(255,255,255,0.8); font-weight: 600; }
.site-footer a:hover { color: #fff; }

.footer-sentinel {
    margin-top: 5px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.03em;
}
.footer-sentinel strong {
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.08em;
    font-size: 0.72rem;
}

.footer-perf {
    margin-top: 3px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.03em;
    font-family: monospace;
    font-weight: 600;
}

/* ================================================
   Flavor Page
   ================================================ */
.flavor-stat {
    text-align: center; padding: 6px 16px;
    background: var(--info-bg); border-radius: var(--radius-sm);
}

.flavor-stat .stat-value { font-size: 1.2rem; font-weight: 800; color: var(--primary-dark); }
.flavor-stat .stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.flavor-link { color: var(--primary); font-weight: 600; }
.flavor-link:hover { text-decoration: underline; }

/* ================================================
   Utilities
   ================================================ */
.mt-1 { margin-top: 0.4rem; }
.mt-2 { margin-top: 0.85rem; }
.mt-3 { margin-top: 1.25rem; }
.mb-1 { margin-bottom: 0.4rem; }
.mb-2 { margin-bottom: 0.85rem; }
.mb-3 { margin-bottom: 1.25rem; }
.mr-1 { margin-right: 0.4rem; }
.ml-auto { margin-left: auto; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.4rem; }
.gap-2 { gap: 0.85rem; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-100 { width: 100%; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.78rem; }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }

/* ================================================
   Nav Dropdown
   ================================================ */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--primary-dark);
    min-width: 150px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1001;
}

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

.nav-dropdown-menu a {
    display: block;
    padding: 8px 16px;
    color: rgba(255,255,255,0.85);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition);
}

.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}

/* ================================================
   Pagination
   ================================================ */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    font-size: 0.82rem;
    background: #fff;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
}

.pagination a {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--border);
}

.pagination a:hover {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-color: var(--primary);
}

.pagination span.current {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

.pagination span.disabled {
    color: var(--text-light);
    border: 1px solid var(--border);
    background: #f5f5f5;
}

/* ================================================
   Mix-by bold column
   ================================================ */
.mix-bold { font-weight: 800; font-size: 1.05rem; color: var(--primary, #1a73e8); }

/* ================================================
   A-Z Letter Filter
   ================================================ */
.az-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.az-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 5px;
    background: var(--primary);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
}

.az-letter:hover {
    background: var(--primary-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.az-letter.active {
    background: var(--primary-dark);
    color: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* ================================================
   Sortable Table Headers
   ================================================ */
.sort-header {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.sort-header:hover {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.sort-active {
    color: #FFD54F;
    font-weight: 700;
}

/* ================================================
   Calculator layout
   ================================================ */
/* _HOLD - redundant now that .main-content is 820px
.calculator-card {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.recipe-card {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}
*/

.calc-base-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}

.calc-base-col {
    display: flex;
    flex-direction: column;
}

/* ================================================
   Responsive
   ================================================ */
.nav-admin-link { display: inline-flex; align-items: center; gap: 4px; }

/* Responsive column hide utilities */
.hide-md { /* hidden at tablet and below */ }
.hide-sm { /* hidden at mobile only */ }

@media (max-width: 768px) {
    .hide-md { display: none !important; }
    .nav-left .nav-link, .nav-left .nav-dropdown { display: none; }
    .nav-left.open {
        position: fixed; top: 42px; left: 0; right: 0;
        background: var(--primary-dark);
        flex-direction: column; padding: 6px 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        z-index: 1000;
        overflow-y: auto;
        max-height: calc(100vh - 42px);
    }
    .nav-left.open .nav-link, .nav-left.open .nav-dropdown { display: flex; padding: 8px 16px; align-items: center; }
    .nav-left.open .nav-admin-link { display: flex; }
    .nav-left.open .nav-dropdown-menu {
        position: static;
        display: block;
        box-shadow: none;
        background: rgba(0,0,0,0.1);
    }
    .nav-left.open .nav-dropdown-menu a { padding-left: 32px; }
    .nav-toggle { display: block; }

    .calc-base-row { grid-template-columns: 1fr; }
    .calc-base-grid { grid-template-columns: 1fr; }
    .calc-base-col { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .profile-info { grid-template-columns: auto 1fr; }
    .defaults-grid { grid-template-columns: 1fr; }
    .recipe-header { flex-direction: column; align-items: flex-start; }
    .recipe-meta { margin-left: 0; }
    .auth-container { margin: 1rem; }
    .recipe-list-meta { display: none; }
}

@media (max-width: 480px) {
    .hide-sm { display: none !important; }
    html { font-size: 13px; }
    .main-content { padding: 0.85rem 0.6rem; }
    .card-body { padding: 12px; }
    table thead th, table tbody td { padding: 6px 8px; font-size: 0.78rem; }
    /* Don't hide columns — allow horizontal scroll instead so Author/Rating sort links are reachable */
    .col-hide-xs { display: none !important; }
    .mobile-scroll-hint { display: none !important; } /* retired — col-hide-xs handles this now */
}
@media (min-width: 481px) {
    .col-show-xs { display: none !important; }
    .mobile-scroll-hint { display: none !important; }
}

/* Mobile (<= 480px): hide inline fallback since columns are accessible by scrolling */
@media (max-width: 480px) {
    .col-show-xs { display: none !important; }
}

/* Mobile scroll hint — shown only on xs, sits between A-Z card and recipe table */
.mobile-scroll-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 0 2px;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    user-select: none;
}

/* ============================================
   Print — recipe.php mix sheet only
   ============================================ */
@media print {
    /* White page, no background bleed */
    html, body {
        background: white !important;
        margin: 0;
        padding: 0;
    }

    /* Hide site chrome */
    header, nav, footer, .site-header, .main-nav { display: none !important; }

    /* Hide everything in .recipe-card except #mix-sheet */
    .recipe-card { background: white !important; box-shadow: none !important; padding: 0 !important; }
    .recipe-card > *  { display: none !important; }
    .recipe-card > #mix-sheet { display: block !important; }

    /* Clean up mix sheet card for paper */
    #mix-sheet .card {
        box-shadow: none !important;
        border-radius: 0 !important;
        border: 1px solid #ccc !important;
    }

    /* Table borders */
    #mix-sheet table, #mix-sheet th, #mix-sheet td {
        border-color: #ccc !important;
    }

    /* Force backgrounds to print (BASE/FLAVORS labels, Totals row) */
    #mix-sheet, #mix-sheet * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
