/* ============================================================
   Retetar Cofetarie — Dark Theme
   ============================================================ */

:root {
    --bg-primary:   #0d1f13;
    --bg-secondary: #142a1c;
    --bg-card:      #1c3d2a;
    --bg-card-hover:#264d36;
    --accent:       #4ade80;
    --accent-hover: #22c55e;
    --text:         #eaeaea;
    --text-muted:   #9ab5a4;
    --text-dark:    #0d1f13;
    --border:       #2d5a3e;
    --success:      #4ade80;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --easy:         #4ade80;
    --medium:       #f59e0b;
    --hard:         #ef4444;
    --radius:       10px;
    --shadow:       0 4px 20px rgba(0,0,0,0.5);
    --sidebar-w:    80px;
    --sidebar-w-mobile: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* ── NAV ─────────────────────────────────────────────── */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.navbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand span { font-size: 1.5rem; }

.navbar-links { display: flex; align-items: center; gap: 20px; }

.navbar-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s;
}
.navbar-links a:hover { color: var(--text); }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ── LOGIN ───────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.login-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 40px;
    width: 380px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon { font-size: 3rem; display: block; margin-bottom: 10px; }

.login-logo h1 {
    font-size: 1.4rem;
    color: var(--text);
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── FORMS ───────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
select,
textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 10px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74,222,128,0.18);
}

textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

select option { background: var(--bg-card); }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
}
.btn:active { transform: scale(0.98); }

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

.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text); }

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

.btn-sm   { padding: 6px 14px; font-size: 0.82rem; }
.btn-full { width: 100%; }

.btn-scale {
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-scale:hover  { border-color: var(--accent); color: var(--accent); }
.btn-scale.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── ALERTS ──────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.alert-error   { background: rgba(252,92,101,0.15); border: 1px solid var(--danger); color: #fc9ba3; }
.alert-success { background: rgba(72,187,120,0.15); border: 1px solid var(--success); color: #9ae6b4; }
.alert-warning { background: rgba(237,137,54,0.15); border: 1px solid var(--warning); color: #fbd38d; }

/* ── LAYOUT ──────────────────────────────────────────── */
body { padding-left: var(--sidebar-w); }
body.no-sidebar { padding-left: 0; }

.container {
    max-width: 1780px;
    margin: 0 auto;
    padding: 0 30px;
}

@media (max-width: 768px) {
    body { padding-left: 0; padding-bottom: var(--sidebar-w-mobile); }
    .container { padding: 0 16px; }
}

.page-content { padding: 36px 0; }

/* ── HOMEPAGE SEARCH ─────────────────────────────────── */
.search-hero {
    text-align: center;
    padding: 60px 0 40px;
}

.search-hero h2 {
    font-size: 1.6rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 28px;
}

.search-wrapper {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}

.search-input {
    font-size: 1.25rem !important;
    padding: 18px 60px 18px 24px !important;
    border-radius: 50px !important;
    border: 2px solid var(--border) !important;
    background: var(--bg-secondary) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.search-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(74,222,128,0.18), 0 4px 24px rgba(0,0,0,0.3) !important;
}

.search-icon {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-results {
    max-width: 720px;
    margin: 12px auto 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: var(--text);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card); }

.search-result-item .result-icon { font-size: 1.4rem; }
.search-result-item .result-title { font-weight: 600; }
.search-result-item .result-meta { font-size: 0.8rem; color: var(--text-muted); }

/* ── CATEGORII ───────────────────────────────────────── */
.categories-section {
    padding: 20px 0 50px;
}

.categories-section h3 {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 24px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    max-width: 1800px;
    margin: 0 auto;
}

.category-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.category-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74,222,128,0.25);
    color: var(--text);
}

.category-btn .cat-icon { font-size: 4rem; }
.category-btn .cat-name { font-size: 1.3rem; font-weight: 600; }
.category-btn .cat-count { font-size: 1rem; color: var(--text-muted); }

/* ── RECIPE CARDS ────────────────────────────────────── */
.recipes-section { padding: 20px 0; }

.recipes-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 22px;
}

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.recipe-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
    display: block;
}
.recipe-card:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: var(--text);
}

.recipe-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.recipe-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
}

.recipe-card-cat { font-size: 1.3rem; }

.recipe-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-easy   { background: rgba(72,187,120,0.2); color: var(--easy); }
.badge-medium { background: rgba(237,137,54,0.2); color: var(--medium); }
.badge-hard   { background: rgba(252,92,101,0.2); color: var(--hard); }
.badge-time   { background: rgba(160,174,192,0.15); color: var(--text-muted); }
.badge-portii { background: rgba(160,174,192,0.1); color: var(--text-muted); }

/* ── RETETA PAGE — Layout 2 coloane 70/30 ────────────── */

.reteta-2col {
    display: grid;
    grid-template-columns: 70fr 30fr;
    gap: 28px;
    padding: 20px 0;
    align-items: start;
    min-height: calc(100vh - 80px);
}

/* ── Coloana stânga ── */
.reteta-col-left .breadcrumb { margin-bottom: 10px; }

.reteta-title {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 10px;
}

.reteta-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.componente-pills {
    font-size: .83rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.componenta-pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 20px;
    color: var(--text);
    font-size: .8rem;
    text-decoration: none;
}
.componenta-pill small { color: var(--accent); }

.reteta-ingrediente { margin-top: 16px; }

.reteta-actions-bottom {
    display: flex;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Coloana dreapta — secțiuni stacked ── */
.reteta-col-right {
    position: sticky;
    top: 72px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    padding-right: 4px;
}

.right-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.section-title small {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

/* ── Scale box ── */
.scale-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.scale-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.scale-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.scale-custom {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}
.scale-custom input {
    width: 80px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ── Ingrediente MARI — vizibile de la distanta ── */
.ingrediente-big { width: 100%; border-collapse: collapse; }

.ingrediente-big td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(45,90,62,0.4);
    vertical-align: middle;
}
.ingrediente-big tr:last-child td { border-bottom: none; }
.ingrediente-big tr:hover td { background: rgba(28,61,42,0.5); }

.ingrediente-big .td-cantitate {
    white-space: nowrap;
    width: 260px;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.ingrediente-big .td-unitate {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 6px;
}
.ingrediente-big .td-ingredient {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text);
}

/* ── Preparare ── */
.preparare-text {
    line-height: 1.9;
    color: var(--text);
    white-space: pre-wrap;
    font-size: 1rem;
}

.reteta-nota {
    background: rgba(28,61,42,0.55);
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 16px;
}

/* ── Alergeni ── */
.alergeni-box {
    background: rgba(237,137,54,.08);
    border-color: rgba(237,137,54,.3);
}
.alergeni-box .section-title { color: var(--warning); }
.alergeni-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--warning);
    line-height: 1.6;
}

/* ── Timer ── */
.timer-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.timer-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.timer-display {
    font-size: 2.8rem;
    font-weight: 800;
    text-align: center;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    margin: 12px 0;
    letter-spacing: 2px;
}
.timer-controls { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.timer-input-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.timer-input-row input { flex: 1; text-align: center; }
.timer-input-row label { font-size: 0.8rem; color: var(--text-muted); min-width: 24px; }

/* ── CATEGORIE PAGE ──────────────────────────────────── */
.categorie-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.categorie-header .cat-icon-big { font-size: 3rem; }
.categorie-header h2 { font-size: 1.8rem; }

.sort-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ── ADMIN PANEL ─────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 28px 0;
    flex-shrink: 0;
}

.admin-sidebar-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 0 20px;
    margin-bottom: 12px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.admin-nav a:hover { background: var(--bg-card); color: var(--text); }
.admin-nav a.active { background: var(--bg-card); color: var(--text); border-left-color: var(--accent); }
.admin-nav .nav-icon { font-size: 1.1rem; }

.admin-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.admin-content h2 {
    font-size: 1.4rem;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

/* Tables in admin */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(45,90,62,0.4);
    vertical-align: middle;
}

.data-table tr:hover td { background: rgba(28,61,42,0.55); }

/* Admin forms */
.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.admin-form-grid .full-width { grid-column: 1 / -1; }

.ingredient-builder { display: flex; flex-direction: column; gap: 8px; }

.ingredient-row {
    display: grid;
    grid-template-columns: 28px 1fr 100px 80px auto;
    gap: 8px;
    align-items: center;
    transition: opacity 0.15s;
}
.ingredient-row.drag-over-top { border-top: 2px solid var(--accent); }
.ingredient-row.drag-over-bottom { border-bottom: 2px solid var(--accent); }

.drag-handle {
    cursor: grab;
    font-size: 1.2rem;
    color: var(--text-muted);
    text-align: center;
    user-select: none;
    line-height: 1;
}
.drag-handle:hover { color: var(--accent); }
.drag-handle:active { cursor: grabbing; }

.ingredient-row .btn-remove-ing {
    background: none;
    border: 1px solid var(--border);
    color: var(--danger);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
}
.ingredient-row .btn-remove-ing:hover { background: rgba(252,92,101,0.1); }

/* ── UTILITY ─────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-right  { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 16px; }
.justify-between { justify-content: space-between; }

.tag-activ-da  { color: var(--success); font-weight: 600; font-size: 0.82rem; }
.tag-activ-nu  { color: var(--danger);  font-weight: 600; font-size: 0.82rem; }

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--border); }

/* Favorit button */
.btn-favorit {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.88rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-favorit:hover, .btn-favorit.active { border-color: var(--accent); color: var(--accent); }
.btn-favorit.active .heart { color: var(--accent); }

/* ── PRINT ───────────────────────────────────────────── */
@media print {
    .navbar, .breadcrumb, .btn-favorit, .reteta-actions-bottom,
    .scale-box, .timer-box, .sidebar { display: none !important; }
    .container { padding-left: 30px; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .reteta-2col { display: block; }
    .reteta-col-right { position: static; max-height: none; overflow: visible; }
    .right-section { border: 1px solid #ccc; background: #f9f9f9; }
    .reteta-title { font-size: 18pt; color: #000; }
    .ingrediente-big td { color: #000; border-color: #ccc; }
    .td-cantitate { color: #c00 !important; }
    .preparare-text { color: #000; }
    .alergeni-box { background: #fff8e1; border-color: #f90; }
    .alergeni-text { color: #a60; }
    a { color: inherit; }
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR GLOBAL (iconițe)
═══════════════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 150;
    box-shadow: 2px 0 12px rgba(0,0,0,0.3);
}
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--bg-card);
    border-radius: 12px;
    font-size: 1.8rem;
    text-decoration: none;
    margin-bottom: 20px;
    transition: transform 0.15s;
}
.sidebar-logo:hover { transform: scale(1.05); }
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    width: 100%;
    align-items: center;
}
.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
}
.sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.15s;
    gap: 2px;
}
.sidebar-item:hover {
    background: var(--bg-card);
    color: var(--text);
}
.sidebar-item.active {
    background: var(--accent);
    color: #fff;
}
.sidebar-item.active .sidebar-label { color: #fff; }
.sidebar-icon { font-size: 1.5rem; line-height: 1; }
.sidebar-label {
    font-size: 0.62rem;
    font-weight: 600;
    color: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile: sidebar devine bară jos */
@media (max-width: 768px) {
    .sidebar {
        top: auto;
        bottom: 0;
        width: 100%;
        height: var(--sidebar-w-mobile);
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border);
        padding: 0 8px;
        justify-content: space-around;
    }
    .sidebar-logo { display: none; }
    .sidebar-menu {
        flex-direction: row;
        flex: 1;
        gap: 4px;
        justify-content: space-around;
    }
    .sidebar-bottom {
        flex-direction: row;
        gap: 4px;
        border-top: none;
        border-left: 1px solid var(--border);
        padding-top: 0;
        padding-left: 8px;
        margin-top: 0;
        margin-left: 8px;
    }
    .sidebar-item { width: 52px; height: 48px; }
    .sidebar-icon { font-size: 1.3rem; }
    .sidebar-label { font-size: 0.58rem; }
}

/* ═══════════════════════════════════════════════════════
   BUTON "REALIZAT" pe pagina rețetă
═══════════════════════════════════════════════════════ */
.btn-realizat {
    display: block;
    width: 100%;
    padding: 20px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    margin-top: 12px;
    box-shadow: 0 4px 14px rgba(72,187,120,0.3);
}
.btn-realizat:hover { background: #38a169; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(72,187,120,0.4); }
.btn-realizat:active { transform: translateY(0); }
.btn-realizat small {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   MODAL confirmare producție
═══════════════════════════════════════════════════════ */
.modal-realizat-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.modal-realizat-overlay.open { display: flex; }
.modal-realizat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 580px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.modal-realizat h2 {
    color: var(--success);
    margin-bottom: 8px;
    font-size: 1.5rem;
}
.modal-realizat .modal-subtitle {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}
.stoc-list {
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
}
.stoc-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(45,90,62,0.4);
    font-size: 0.9rem;
    align-items: center;
}
.stoc-item:last-child { border-bottom: none; }
.stoc-item.insuf { color: var(--danger); font-weight: 600; }
.stoc-item.nemapat { color: var(--warning); }
.stoc-item-status {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(72,187,120,0.15);
    color: var(--success);
    white-space: nowrap;
}
.stoc-item.insuf .stoc-item-status { background: rgba(252,92,101,0.15); color: var(--danger); }
.stoc-item.nemapat .stoc-item-status { background: rgba(237,137,54,0.15); color: var(--warning); }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ═══════════════════════════════════════════════════════
   TOAST notifications
═══════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}
.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 14px 18px;
    box-shadow: var(--shadow);
    animation: slideIn 0.25s ease-out;
    font-size: 0.92rem;
    color: var(--text);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════
   MATERII PRIME table + shopping list + NIR
═══════════════════════════════════════════════════════ */
.materii-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.materii-toolbar input[type="search"] { flex: 1; min-width: 200px; }

.stoc-bar {
    display: inline-block;
    width: 140px;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    vertical-align: middle;
    margin-left: 8px;
}
.stoc-bar-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}
.stoc-bar-fill.low { background: var(--warning); }
.stoc-bar-fill.critical { background: var(--danger); }

/* Shopping list cards (mobile-first) */
.shopping-container { max-width: 900px; margin: 0 auto; }
.shopping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.shopping-header h2 { font-size: 1.4rem; }
.shopping-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    transition: opacity 0.2s;
}
.shopping-card.critical { border-left-color: var(--danger); }
.shopping-card.bought { opacity: 0.4; }
.shopping-card.bought .shopping-name { text-decoration: line-through; }
.shopping-check {
    width: 36px;
    height: 36px;
    accent-color: var(--success);
    cursor: pointer;
}
.shopping-info { min-width: 0; }
.shopping-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.shopping-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.shopping-prag {
    color: var(--accent);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}
.shopping-prag:hover { background: rgba(74,222,128,0.18); }
.shopping-prag input {
    width: 90px;
    text-align: right;
    font-weight: 700;
    color: var(--accent);
}
.shopping-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* NIR form */
.nir-container { max-width: 1000px; margin: 0 auto; }
.nir-header-form {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.nir-linii-header {
    display: grid;
    grid-template-columns: 1fr 140px 100px 40px;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 6px 6px 0 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}
.nir-linie {
    display: grid;
    grid-template-columns: 1fr 140px 100px 40px;
    gap: 10px;
    padding: 8px 12px;
    align-items: center;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: relative;
}
.nir-linie:last-child { border-radius: 0 0 6px 6px; }
.nir-linie .autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: var(--shadow);
}
.nir-linie .autocomplete-dropdown.open { display: block; }
.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.autocomplete-item:hover { background: var(--bg-card); }
.autocomplete-item.new-item { color: var(--accent); font-style: italic; }

.nir-history {
    margin-top: 40px;
}
.nir-history h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Productie / trasabilitate */
.productie-search { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.productie-search input, .productie-search select { padding: 10px 12px; }
.cod-trasabilitate {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--accent);
    font-size: 1.05rem;
    letter-spacing: 1px;
}

/* Eticheta print */
.eticheta-container {
    max-width: 500px;
    margin: 60px auto;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
}
.eticheta-brand {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.eticheta-cod {
    font-family: 'Courier New', monospace;
    font-size: 4.5rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 4px;
    margin: 16px 0 10px;
    line-height: 1;
}
.eticheta-titlu {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.eticheta-data {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 8px;
}
.eticheta-factor {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 4px;
}
.eticheta-actions { margin-top: 30px; display: flex; gap: 10px; justify-content: center; }

/* Print — optimizat pentru imprimantă termică SunMi 58mm (48mm printabil) */
@media print {
    @page {
        size: 48mm auto;
        margin: 2mm 0;
    }
    *, *::before, *::after { color: #000 !important; }
    html, body {
        width: 48mm;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        font-size: 12px;
    }
    body { padding-left: 0 !important; }
    .sidebar, .eticheta-actions, .page-content > *:not(.eticheta-container) { display: none !important; }
    .container, .page-content {
        max-width: none !important;
        width: 48mm !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .eticheta-container {
        width: 48mm;
        max-width: 48mm;
        margin: 0;
        padding: 2mm 1mm;
        background: #fff;
        border: none;
        border-radius: 0;
        box-shadow: none;
        page-break-after: always;
    }
    .eticheta-brand {
        font-size: 8px;
        letter-spacing: 1px;
        margin-bottom: 1mm;
    }
    .eticheta-cod {
        font-size: 28px;
        letter-spacing: 2px;
        margin: 1mm 0;
        font-weight: 900;
    }
    .eticheta-titlu {
        font-size: 14px;
        font-weight: 700;
        margin-bottom: 1mm;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    .eticheta-data {
        font-size: 11px;
        margin-top: 1mm;
    }
    .eticheta-factor {
        font-size: 12px;
        font-weight: 700;
        margin-top: 0.5mm;
    }
}

/* Raport lună */
.raport-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.raport-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.raport-section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* ═══════════════════════════════════════════════════════
   MOBILE RESPONSIVE — bp: 900px (tablet), 768px, 480px
═══════════════════════════════════════════════════════ */

/* ── Tablet & sub ── */
@media (max-width: 900px) {
    /* Rețetă: 2col → 1col */
    .reteta-2col {
        grid-template-columns: 1fr !important;
        gap: 20px;
        min-height: auto;
    }
    .reteta-col-right {
        position: static !important;
        max-height: none !important;
        overflow: visible !important;
    }
    .reteta-title { font-size: 1.7rem; }
    .ingrediente-big .td-cantitate {
        width: auto;
        font-size: 1.5rem;
    }
    .ingrediente-big .td-ingredient { font-size: 1.15rem; }
    .ingrediente-big td { padding: 10px 12px; }

    /* Admin: sidebar-ul intern devine dropdown/orizontal */
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        padding: 12px 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        flex-direction: column;
    }
    .admin-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0 12px;
    }
    .admin-nav a {
        padding: 8px 12px;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: 6px;
        font-size: 0.85rem;
    }
    .admin-nav a.active {
        border-left: none;
        border-bottom-color: var(--accent);
    }
    .admin-content { padding: 20px 16px; }
}

/* ── Mobile ── */
@media (max-width: 768px) {
    html { font-size: 15px; }

    .page-content { padding: 20px 0; }
    .search-hero { padding: 30px 0 24px; }
    .search-hero h2 { font-size: 1.3rem; }
    .search-input {
        font-size: 1.05rem !important;
        padding: 14px 50px 14px 18px !important;
    }

    /* Grid categorii - mai mic pe mobile */
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 12px;
    }
    .category-btn { padding: 24px 12px; gap: 10px; }
    .category-btn .cat-icon { font-size: 2.6rem; }
    .category-btn .cat-name { font-size: 1rem; }
    .category-btn .cat-count { font-size: 0.85rem; }

    /* Tabele responsive - scroll orizontal */
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .data-table td, .data-table th {
        white-space: nowrap;
        padding: 10px 12px;
    }

    /* NIR linii pe mobile */
    .nir-header-form {
        grid-template-columns: 1fr !important;
    }
    .nir-linii-header {
        display: none;
    }
    .nir-linie {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 14px;
        border-radius: 8px;
        margin-bottom: 8px;
        border-bottom: none;
        border: 1px solid var(--border);
    }
    .nir-linie .linie-um {
        padding-top: 0 !important;
    }

    /* Modal fullscreen pe mobile */
    .modal { width: 95vw !important; padding: 20px !important; }
    .modal-realizat { width: 95vw; padding: 20px; max-height: 92vh; }
    .btn-realizat { font-size: 1.15rem; padding: 16px; }

    /* Shopping cards */
    .shopping-card {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 12px;
    }
    .shopping-card .stoc-bar {
        grid-column: 1 / -1;
        width: 100%;
        margin-left: 0;
    }
    .shopping-name { font-size: 1.05rem; }
    .shopping-details { flex-direction: column; gap: 4px; align-items: flex-start; }
    .shopping-details > span:nth-child(2) { display: none; }

    /* Productie search filters stack */
    .productie-search {
        flex-direction: column;
        align-items: stretch;
    }
    .productie-search select,
    .productie-search input,
    .productie-search button,
    .productie-search a { width: 100%; }

    /* Eticheta compact */
    .eticheta-container { padding: 24px 16px; margin: 20px 12px; }
    .eticheta-cod { font-size: 3rem; letter-spacing: 2px; }
    .eticheta-titlu { font-size: 1.35rem; }

    /* Toast pe mobile */
    .toast-container {
        top: auto;
        bottom: calc(var(--sidebar-w-mobile) + 12px);
        left: 12px;
        right: 12px;
        max-width: none;
    }

    /* Buttons full-width in flex */
    .d-flex.gap-2 { flex-wrap: wrap; }

    /* Admin form grid single col */
    .admin-form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Categorie header */
    .categorie-header { flex-direction: column; text-align: center; gap: 8px; }
    .categorie-header .cat-icon-big { font-size: 3rem; }

    /* Sort bar */
    .sort-bar { flex-wrap: wrap; }

    /* Reteta actions bottom mobile */
    .reteta-actions-bottom { flex-wrap: wrap; }

    /* Superadmin sidebar bottom borders on mobile */
    .admin-sidebar > div:last-child {
        text-align: center;
        padding: 12px !important;
    }
}

/* ── Small mobile (phones) ── */
@media (max-width: 480px) {
    html { font-size: 14px; }
    .container { padding: 0 12px; }

    .reteta-title { font-size: 1.4rem; }
    .reteta-meta { gap: 6px; }
    .badge { font-size: 0.75rem; padding: 3px 8px; }

    .btn { padding: 9px 14px; font-size: 0.85rem; }
    .btn-realizat { font-size: 1.05rem; padding: 14px; }

    .ingrediente-big .td-cantitate { font-size: 1.25rem; }
    .ingrediente-big .td-ingredient { font-size: 1rem; }
    .ingrediente-big td { padding: 8px 10px; }

    .eticheta-cod { font-size: 2.3rem; letter-spacing: 1px; }

    /* Categorii grid: 2 pe linie */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ═══════════════════════════════════════════════════════
   IMAGINI CATEGORII
═══════════════════════════════════════════════════════ */
.cat-img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    padding: 8px;
    display: block;
}
.cat-img-big {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    padding: 10px;
    display: block;
}
.cat-thumb-admin {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--bg-primary);
    padding: 4px;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .cat-img { width: 72px; height: 72px; padding: 6px; }
    .cat-img-big { width: 80px; height: 80px; padding: 8px; }
}

/* ── Alarm ────────────────────────────────────────── */
.alarm-top-btn {
    position: absolute;
    top: 18px;
    right: 24px;
    z-index: 50;
}
.btn-alarm-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .2s;
    position: relative;
}
.btn-alarm-icon:hover { background: var(--bg-secondary); transform: scale(1.08); }
.btn-alarm-icon.active { border-color: var(--accent); box-shadow: 0 0 8px rgba(74,222,128,.3); }
.alarm-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent);
    color: #000;
    font-size: .7rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
}
.alarm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.alarm-overlay.open { display: flex; }
.alarm-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    min-width: 320px;
    text-align: center;
}
.alarm-modal h3 { margin-bottom: 20px; }
.alarm-inputs {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 16px;
}
.alarm-field { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.alarm-field input {
    width: 70px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text);
}
.alarm-field label { font-size: .85rem; color: var(--text-muted); }
.alarm-status {
    font-size: .9rem;
    color: var(--accent);
    margin-bottom: 16px;
    min-height: 24px;
}
.alarm-actions { display: flex; gap: 10px; justify-content: center; }

/* Ring overlay */
.alarm-ring-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.alarm-ring-overlay.open { display: flex; }
.alarm-ring-modal { text-align: center; }
.alarm-ring-icon {
    font-size: 6rem;
    animation: alarm-shake .4s infinite alternate;
}
@keyframes alarm-shake {
    from { transform: rotate(-15deg); }
    to { transform: rotate(15deg); }
}
.alarm-ring-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin: 16px 0 24px;
}
.btn-lg { padding: 16px 48px; font-size: 1.2rem; }
