/* ============================================================
   MIMPI MANIS — Global Stylesheet
   Theme: Hijau Sage + Cream Elegan
   ============================================================ */

:root {
    --cream:        #F9F6F0;
    --cream-dark:   #F0EBE1;
    --cream-border: #E8DFD0;
    --green:        #4A7C59;
    --green-dark:   #3A6347;
    --green-pale:   #E8F0E9;
    --green-light:  #C8DEC D;
    --green-text:   #2C3E2D;
    --green-muted:  #7A9B7E;
    --border:       #D4E4D6;
    --gold:         #C8A96E;
    --gold-pale:    #FDF6E9;
    --white:        #FFFFFF;
    --danger:       #DC2626;
    --danger-pale:  #FEE2E2;
    --warning:      #D97706;
    --warning-pale: #FEF3C7;
    --info:         #0369A1;
    --info-pale:    #E0F2FE;

    /* Badge colors */
    --badge-recommended: #C8A96E;
    --badge-bestseller:  #4A7C59;
    --badge-new:         #5B9B8A;
    --badge-combo:       #9B7EC8;

    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  20px;

    --shadow-sm: 0 1px 4px rgba(44,62,45,.08);
    --shadow-md: 0 4px 16px rgba(44,62,45,.10);
    --shadow-lg: 0 8px 32px rgba(44,62,45,.12);

    --topbar-h: 58px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--green-text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.mm-topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--green);
    color: var(--white);
    display: flex; align-items: center;
    padding: 0 20px; gap: 12px;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(44,62,45,.2);
}
.mm-topbar .brand {
    font-family: 'Playfair Display', serif;
    font-size: 18px; font-weight: 700;
    color: var(--white); flex: 1;
}
.mm-topbar .brand span { color: var(--gold); }
.mm-topbar .role-badge {
    font-size: 11px; font-weight: 600;
    background: rgba(255,255,255,.15);
    padding: 3px 10px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: .5px;
}
.mm-topbar .topbar-btn {
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 600;
    border: 1.5px solid rgba(255,255,255,.3);
    color: var(--white); background: transparent;
    cursor: pointer; text-decoration: none;
    transition: background .15s;
}
.mm-topbar .topbar-btn:hover { background: rgba(255,255,255,.15); }

.mm-page { padding-top: calc(var(--topbar-h) + 24px); padding-bottom: 48px; }
.mm-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Cards ──────────────────────────────────────────────────── */
.mm-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.mm-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 14px;
    color: var(--green-text);
    display: flex; align-items: center; gap: 8px;
    background: var(--green-pale);
}
.mm-card-body { padding: 20px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.mm-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    border: none; transition: all .15s;
    text-decoration: none; white-space: nowrap;
}
.mm-btn-primary   { background: var(--green); color: var(--white); }
.mm-btn-primary:hover { background: var(--green-dark); }
.mm-btn-secondary { background: var(--green-pale); color: var(--green); border: 1.5px solid var(--border); }
.mm-btn-secondary:hover { background: var(--border); }
.mm-btn-danger    { background: var(--danger-pale); color: var(--danger); border: 1.5px solid #fecaca; }
.mm-btn-danger:hover { background: #fecaca; }
.mm-btn-gold      { background: var(--gold); color: var(--white); }
.mm-btn-gold:hover { background: #b8996e; }
.mm-btn-sm { padding: 5px 12px; font-size: 12px; }
.mm-btn-lg { padding: 13px 24px; font-size: 15px; }
.mm-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Badges menu ─────────────────────────────────────────────── */
.mm-badge {
    display: inline-block; font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: .3px;
}
.mm-badge-recommended { background: #FDF3DC; color: var(--badge-recommended); }
.mm-badge-bestseller  { background: var(--green-pale); color: var(--badge-bestseller); }
.mm-badge-new         { background: #E8F5F2; color: var(--badge-new); }
.mm-badge-combo       { background: #F3EDFC; color: var(--badge-combo); }

/* ── Forms ──────────────────────────────────────────────────── */
.mm-form-group { margin-bottom: 16px; }
.mm-form-group label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--green-muted); margin-bottom: 5px;
    text-transform: uppercase; letter-spacing: .4px;
}
.mm-input, .mm-select, .mm-textarea {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; color: var(--green-text);
    background: var(--cream); transition: border-color .2s, background .2s;
}
.mm-input:focus, .mm-select:focus, .mm-textarea:focus {
    outline: none; border-color: var(--green); background: var(--white);
}
.mm-textarea { resize: vertical; min-height: 80px; }

/* ── Tables ─────────────────────────────────────────────────── */
.mm-table { width: 100%; border-collapse: collapse; }
.mm-table th {
    background: var(--green); color: var(--white);
    padding: 10px 14px; font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .4px;
    text-align: left;
}
.mm-table td {
    padding: 11px 14px; border-bottom: 1px solid var(--green-pale);
    font-size: 13px; vertical-align: middle;
}
.mm-table tbody tr:hover { background: var(--green-pale); }
.mm-table .total-row td {
    background: var(--green-pale); font-weight: 700;
    border-top: 2px solid var(--border);
}

/* ── Status pills ────────────────────────────────────────────── */
.status-pill {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 99px; text-transform: uppercase;
}
.status-pending   { background: var(--warning-pale); color: var(--warning); }
.status-waiting_confirmation { background: #fee2e2; color: #dc2626; }
.status-confirmed { background: var(--info-pale); color: var(--info); }
.status-served    { background: var(--green-pale); color: var(--green-dark); }
.status-billed    { background: var(--gold-pale); color: var(--gold); }
.status-paid      { background: var(--green-pale); color: var(--green); }
.status-cancelled { background: var(--danger-pale); color: var(--danger); }

/* ── Meja grid ───────────────────────────────────────────────── */
.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}
.table-card {
    background: var(--white); border-radius: var(--radius-md);
    border: 2px solid var(--border);
    padding: 14px 10px; text-align: center;
    cursor: pointer; transition: all .15s;
    position: relative;
}
.table-card:hover  { border-color: var(--green); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.table-card.empty  { border-color: var(--border); }
.table-card.active { border-color: var(--gold); background: var(--gold-pale); }
.table-card.billed { border-color: var(--green); background: var(--green-pale); }
.table-card .t-num { font-size: 20px; font-weight: 800; color: var(--green-text); }
.table-card .t-area { font-size: 10px; color: var(--green-muted); margin-top: 2px; }
.table-card .t-name { font-size: 11px; color: var(--green); margin-top: 4px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-card .t-dot {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px; border-radius: 50%;
}
.t-dot-empty  { background: var(--border); }
.t-dot-active { background: var(--gold); }
.t-dot-billed { background: var(--green); }

/* ── Notification sound trigger ─────────────────────────────── */
#mm-notif-audio { display: none; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    .mm-container { padding: 0 12px; }
    .mm-card-body { padding: 14px; }
    .mm-topbar .brand { font-size: 15px; }
}

/* ── Print thermal 80mm ──────────────────────────────────────── */
@media print {
    * { -webkit-print-color-adjust: exact !important; }
    body { background: white !important; }
    .mm-topbar, .no-print, .mm-btn { display: none !important; }
    .print-only { display: block !important; }
    @page { size: 80mm auto; margin: 4mm; }
}
.print-only { display: none; }

/* ── Toggle button (dipakai di semua halaman) ────────────────── */
/* Reset button default dulu */
.toggle-btn, .toggle-btn:focus { outline: none; }
.toggle-btn {
    padding: 6px 14px; border-radius: 99px;
    border: 1.5px solid var(--border);
    cursor: pointer; font-size: 12px; font-weight: 600;
    background: var(--white); color: var(--green-text);
    transition: all .15s; font-family: inherit;
    display: inline-flex; align-items: center; gap: 4px;
}
.toggle-btn:hover  { background: var(--green-pale); border-color: var(--green); }
.toggle-btn.active { background: var(--green); color: white; border-color: var(--green); }

/* ── Modal global ────────────────────────────────────────────── */
.mm-modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 200;
    align-items: center; justify-content: center;
    padding: 16px;
}
.mm-modal.open { display: flex !important; }
.mm-modal-box {
    background: white; border-radius: var(--radius-xl);
    padding: 28px; width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.mm-modal-box h3 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 20px; font-size: 18px;
    color: var(--green-text);
}

/* ── Form row 2 kolom ────────────────────────────────────────── */
.form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media(max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ============================================================
   ADMIN SIDEBAR LAYOUT
   ============================================================ */
.mm-app-shell { display: flex; min-height: 100vh; }

.mm-sidebar {
    width: 240px; flex-shrink: 0;
    background: var(--white); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    height: 100vh; position: sticky; top: 0;
    transition: width .2s ease;
    z-index: 100;
}
.mm-sidebar.collapsed { width: 68px; }
.mm-sidebar.collapsed .brand-text,
.mm-sidebar.collapsed .nav-text,
.mm-sidebar.collapsed .mm-nav-section,
.mm-sidebar.collapsed .mm-user-info { display: none; }
.mm-sidebar.collapsed .mm-sidebar-toggle { transform: rotate(180deg); }
.mm-sidebar.collapsed .mm-user-chip { justify-content: center; }

.mm-sidebar-header {
    padding: 16px 14px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.mm-sidebar-brand { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.brand-icon { font-size: 22px; flex-shrink: 0; }
.brand-text { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 15px; white-space: nowrap; color: var(--green-text); }
.brand-text .gold { color: var(--gold); }
.mm-sidebar-toggle {
    background: var(--green-pale); border: none; width: 24px; height: 24px;
    border-radius: 6px; cursor: pointer; font-size: 10px; color: var(--green);
    flex-shrink: 0; transition: transform .2s;
}

.mm-sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.mm-nav-section {
    font-size: 10px; font-weight: 700; color: var(--green-muted);
    text-transform: uppercase; letter-spacing: .6px;
    padding: 12px 10px 4px;
}
.mm-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--green-text); text-decoration: none;
    font-size: 13px; font-weight: 500; margin-bottom: 2px;
    transition: background .15s; white-space: nowrap; overflow: hidden;
}
.mm-nav-item:hover { background: var(--green-pale); }
.mm-nav-item.active { background: var(--green); color: white; font-weight: 700; }
.nav-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }

.mm-sidebar-footer {
    padding: 12px; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.mm-user-chip { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.mm-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--green-pale); color: var(--green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.mm-user-info { min-width: 0; overflow: hidden; }
.mm-user-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-user-role { font-size: 10px; color: var(--green-muted); }
.mm-logout-btn {
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    background: var(--danger-pale); display: flex; align-items: center;
    justify-content: center; text-decoration: none; flex-shrink: 0;
    font-size: 14px;
}

.mm-main-content { flex: 1; min-width: 0; background: var(--cream); }
.mm-content-inner { padding: 24px; max-width: 1400px; margin: 0 auto; }

.mm-mobile-topbar {
    display: none; background: var(--green); color: white;
    padding: 0 16px; height: 56px; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 90;
}
.mm-hamburger { background: none; border: none; color: white; font-size: 22px; cursor: pointer; }
.mm-mobile-brand { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 16px; }
.mm-mobile-brand span { color: var(--gold); }

.mm-sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 99;
}
.mm-sidebar-overlay.show { display: block; }

@media (max-width: 900px) {
    .mm-sidebar {
        position: fixed; left: -240px; top: 0; height: 100vh;
        transition: left .25s ease; z-index: 200;
    }
    .mm-sidebar.mobile-open { left: 0; }
    .mm-sidebar.collapsed { width: 240px; }
    .mm-sidebar.collapsed .brand-text,
    .mm-sidebar.collapsed .nav-text,
    .mm-sidebar.collapsed .mm-nav-section,
    .mm-sidebar.collapsed .mm-user-info { display: block; }
    .mm-sidebar-toggle { display: none; }
    .mm-mobile-topbar { display: flex; }
    .mm-content-inner { padding: 16px; }
}

/* Dashboard stat cards */
.stat-card-lg {
    background: var(--white); border-radius: var(--radius-lg);
    border: 1px solid var(--border); padding: 20px;
    box-shadow: var(--shadow-sm);
}
.stat-card-lg .stat-icon { font-size: 24px; margin-bottom: 8px; }
.stat-card-lg .stat-value { font-size: 26px; font-weight: 800; color: var(--green); }
.stat-card-lg .stat-label { font-size: 12px; color: var(--green-muted); margin-top: 2px; }
.stat-card-lg .stat-trend { font-size: 11px; margin-top: 6px; font-weight: 600; }
.stat-trend.up { color: #16a34a; }
.stat-trend.down { color: #dc2626; }