/* ============================================
   Honey Sweet POS — Premium Gold & Cream Theme
   ============================================ */

@font-face {
    font-family: 'UbuntuArabic';
    src: url('../fonts/alfont_com_Ubuntu-Arabic_R.ttf') format('truetype');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'UbuntuArabic';
    src: url('../fonts/alfont_com_Ubuntu-Arabic_B.ttf') format('truetype');
    font-weight: 700;
    font-display: swap;
}

:root {
    --gold: #c9a44c;
    --gold-light: #e6c97a;
    --gold-dark: #8a6d2f;
    --gold-shine: #f4d77a;
    --cream: #fdf8ef;
    --cream-2: #f7eedb;
    --cream-3: #efe4c8;
    --ink: #2a2418;
    --ink-soft: #6b5d3c;
    --line: rgba(201, 164, 76, 0.25);
    --shadow: 0 10px 40px rgba(138, 109, 47, 0.12);
    --shadow-lg: 0 20px 60px rgba(138, 109, 47, 0.18);
    --radius: 14px;
    --radius-sm: 8px;
    --gold-gradient: linear-gradient(135deg, #e6c97a 0%, #c9a44c 50%, #8a6d2f 100%);
    --gold-gradient-soft: linear-gradient(135deg, #f4e4b0 0%, #e6c97a 100%);
}

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

html, body {
    font-family: 'UbuntuArabic', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
}

body {
    background:
        radial-gradient(circle at 0% 0%, rgba(230, 201, 122, 0.15), transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(201, 164, 76, 0.1), transparent 50%),
        var(--cream);
}

[dir="rtl"] body { font-family: 'UbuntuArabic', sans-serif; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }

/* ========== Layout ========== */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    flex: 0 0 250px;
    width: 250px;
    background: linear-gradient(180deg, #1a1610 0%, #2a2418 100%);
    color: var(--cream);
    padding: 24px 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    border-inline-end: 1px solid rgba(201, 164, 76, 0.2);
    box-shadow: var(--shadow);
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px 24px;
    border-bottom: 1px solid rgba(201, 164, 76, 0.2);
    margin-bottom: 16px;
}
/* Logo frame — used in the sidebar and the landing screen */
.logo-frame {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--gold-gradient);
    padding: 6px;
    box-shadow: 0 0 24px rgba(201, 164, 76, 0.4), inset 0 0 12px rgba(255, 220, 130, 0.3);
    transition: transform 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.logo-frame:hover { transform: rotate(8deg) scale(1.05); }
.logo-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2418 0%, #1a1610 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.logo-frame img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    /* Invert the black/white logo (now white-on-black), then tint to gold */
    filter: invert(1) sepia(1) saturate(6) hue-rotate(-15deg) brightness(1.1);
    mix-blend-mode: lighten;
}
.sidebar-logo .name {
    margin-top: 12px;
    font-size: 18px;
    font-weight: 700;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 0.5px;
}
.sidebar-logo .year { color: var(--gold-light); font-size: 12px; margin-top: 2px; opacity: 0.7; }

/* ========== Landing / entry screen ========== */
.landing-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(230, 201, 122, 0.25), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(201, 164, 76, 0.2), transparent 45%),
        linear-gradient(160deg, #1a1610 0%, #2a2418 100%);
    padding: 30px 16px;
}
.landing {
    width: 100%;
    max-width: 760px;
    text-align: center;
    position: relative;
}
.landing-lang {
    position: absolute;
    top: -10px;
    inset-inline-end: 0;
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(201, 164, 76, 0.25);
}
.landing-lang a {
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--cream-3);
}
.landing-lang a.active { background: var(--gold-gradient); color: var(--ink); }

.landing-head { margin-bottom: 36px; }
.landing-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.landing-logo .logo-frame {
    width: 130px; height: 130px;
}
.landing-head h1 {
    font-size: 34px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 0.5px;
}
.landing-sub { color: var(--cream-3); font-size: 15px; margin-top: 8px; }

.landing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 560px) { .landing-cards { grid-template-columns: 1fr; } }

.landing-card {
    background: linear-gradient(160deg, #fffdf8, #f7eedb);
    border: 1px solid rgba(201, 164, 76, 0.3);
    border-radius: 20px;
    padding: 36px 24px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.landing-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: var(--gold-gradient);
}
.landing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
    border-color: var(--gold);
}
.landing-card .lc-icon {
    width: 84px; height: 84px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--gold-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    color: var(--ink);
    box-shadow: 0 8px 20px rgba(201, 164, 76, 0.4);
}
.landing-card .lc-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gold-dark);
}
.landing-card .lc-desc {
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: 6px;
    min-height: 34px;
}
.landing-card .lc-go {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--ink);
    background: var(--gold-gradient);
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 14px;
}
.landing-card:hover .go-arrow { transform: translateX(4px); }
[dir="rtl"] .go-arrow { transform: scaleX(-1); }
[dir="rtl"] .landing-card:hover .go-arrow { transform: scaleX(-1) translateX(4px); }
.go-arrow { transition: transform 0.2s; }
.landing-foot { margin-top: 30px; color: var(--gold-light); opacity: 0.5; font-size: 12px; letter-spacing: 2px; }

/* ========== Login page + section-auth slide-down ========== */
.login-card {
    background: linear-gradient(160deg, #fffdf8, #f7eedb);
    border: 1px solid rgba(201, 164, 76, 0.3);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: start;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
}
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    background: var(--gold-gradient);
}
.input-icon { position: relative; }
.input-icon > i:first-child {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-dark);
    font-size: 14px;
    pointer-events: none;
}
.input-icon .form-control { padding-inline-start: 40px; }
.login-error, .lc-error {
    color: #c0392b;
    background: #fbe0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0;
}

.landing-logout {
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--cream-3) !important;
    font-size: 13px;
    background: transparent !important;
    margin-inline-start: 6px;
}
.landing-logout:hover { background: rgba(255, 100, 100, 0.2) !important; color: #ffaaaa !important; }

/* Landing card "flip" — face hides, password form slides down */
.landing-card { padding: 0; }
.lc-face {
    width: 100%;
    background: none;
    border: none;
    padding: 36px 24px;
    cursor: pointer;
    text-align: center;
    color: inherit;
    transition: opacity 0.25s, transform 0.25s;
}
.lc-face:hover .go-arrow { transform: translateX(4px); }
[dir="rtl"] .lc-face:hover .go-arrow { transform: scaleX(-1) translateX(4px); }

.lc-auth {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 24px;
    transition: max-height 0.35s ease, opacity 0.3s ease, padding 0.3s ease;
}
.landing-card.auth .lc-face {
    opacity: 0.35;
    transform: scale(0.92);
    pointer-events: none;
    padding: 18px 24px 6px;
}
.landing-card.auth .lc-face .lc-icon { width: 56px; height: 56px; font-size: 26px; margin-bottom: 8px; }
.landing-card.auth .lc-face .lc-go { display: none; }
.landing-card.auth .lc-face .lc-desc { display: none; }

.landing-card.auth .lc-auth {
    max-height: 280px;
    opacity: 1;
    padding: 10px 24px 24px;
}
.lc-auth .input-icon .form-control {
    padding-inline-end: 48px;
    font-size: 15px;
    background: white;
    border: 1px solid var(--gold);
}
.lc-go-btn {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--gold-gradient);
    color: var(--ink);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
[dir="rtl"] .lc-go-btn .go-arrow { transform: scaleX(-1); }
.lc-back {
    margin-top: 10px;
    background: none;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    padding: 6px;
}
.lc-back:hover { color: var(--gold-dark); }

/* Back-to-home link in the sidebar */
.home-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 12px 14px;
    padding: 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cream-3);
    border: 1px dashed rgba(201, 164, 76, 0.3);
    transition: all 0.2s;
}
.home-link:hover { background: rgba(201, 164, 76, 0.12); color: var(--gold-shine); }

/* Section switcher (Sweets / Coffee floor) */
.section-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0 12px 16px;
    padding: 6px;
    background: rgba(201, 164, 76, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(201, 164, 76, 0.2);
}
.section-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 9px;
    color: var(--cream-3);
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s;
}
.section-btn i { font-size: 17px; }
.section-btn:hover { background: rgba(201, 164, 76, 0.15); color: var(--gold-shine); }
.section-btn.active {
    background: var(--gold-gradient);
    color: var(--ink);
    box-shadow: 0 3px 10px rgba(201, 164, 76, 0.4);
}

.nav { padding: 0 12px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 10px;
    color: var(--cream-3);
    transition: all 0.25s ease;
    cursor: pointer;
    font-weight: 500;
    position: relative;
}
.nav-item:hover {
    background: rgba(201, 164, 76, 0.12);
    color: var(--gold-shine);
}
.nav-item.active {
    background: var(--gold-gradient);
    color: var(--ink);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(201, 164, 76, 0.4);
}
.nav-item .icon { font-size: 17px; width: 22px; text-align: center; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .icon i { width: 18px; }
.nav-badge {
    margin-inline-start: auto;
    background: #d23b3b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(210, 59, 59, 0.5);
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}
.nav-item.active .nav-badge { background: #8a1f1f; }

/* Stock health pill */
.health-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.health-ok { background: #e0f0e4; color: #2d6a4f; }
.health-low { background: #fcefd6; color: #9a6a12; }
.health-out { background: #fbe0e0; color: #c0392b; }

/* Stock alert panel rows */
.alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.alert-row:last-child { border-bottom: none; }
.alert-name { font-weight: 700; flex: 1; min-width: 120px; }
.alert-qty { font-size: 13px; }
.empty-state .icon i { font-size: 1em; }
.cart-item-remove i { font-size: 14px; }

.main {
    flex: 1;
    min-width: 0;
    padding: 28px 36px;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--line);
}
.topbar h1 {
    font-size: 26px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
    flex: 1;
    min-width: 0;
}
.topbar-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.lang-switcher { display: flex; gap: 4px; background: var(--cream-2); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.lang-switcher a {
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: all 0.2s;
}
.lang-switcher a.active {
    background: var(--gold-gradient);
    color: var(--ink);
    box-shadow: 0 2px 6px rgba(201, 164, 76, 0.3);
}

/* ========== Cards ========== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    border: 1px solid var(--line);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.card-header h3 { font-size: 17px; color: var(--gold-dark); font-weight: 700; }

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gold-gradient);
}
.stat-card .label { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 8px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-card .meta { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid transparent;
    cursor: pointer;
}
.btn-gold {
    background: var(--gold-gradient);
    color: var(--ink);
    box-shadow: 0 4px 12px rgba(201, 164, 76, 0.35);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(201, 164, 76, 0.5); }
.btn-outline {
    background: transparent;
    color: var(--gold-dark);
    border: 1px solid var(--gold);
}
.btn-outline:hover { background: var(--gold-gradient-soft); }
.btn-danger { background: #c44; color: white; }
.btn-danger:hover { background: #a33; }
.btn-soft { background: var(--cream-2); color: var(--gold-dark); }
.btn-soft:hover { background: var(--cream-3); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ========== Forms ========== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    background: var(--cream);
    color: var(--ink);
    transition: all 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--gold);
    background: white;
    box-shadow: 0 0 0 3px rgba(201, 164, 76, 0.15);
}

/* ========== Unit toggle ========== */
.unit-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.unit-opt { cursor: pointer; }
.unit-opt input { display: none; }
.unit-opt span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid var(--line);
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink-soft);
    background: var(--cream);
    transition: all 0.2s;
}
.unit-opt input:checked + span {
    border-color: var(--gold);
    background: var(--gold-gradient-soft);
    color: var(--gold-dark);
    box-shadow: 0 2px 8px rgba(201, 164, 76, 0.25);
}
.unit-hint { font-size: 11px; font-weight: 500; }
.badge-weight { background: #e0f0e8; color: #2d6a4f; }
.badge-item { background: var(--cream-3); color: var(--gold-dark); }
.badge-quick { background: linear-gradient(135deg, #f4d77a, #c9a44c); color: var(--ink); }

/* ========== Table ========== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}
.table th {
    background: var(--gold-gradient-soft);
    color: var(--ink);
    padding: 14px 16px;
    text-align: start;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--gold);
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.table tr:hover td { background: var(--cream); }
.table tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-gold { background: var(--gold-gradient-soft); color: var(--gold-dark); }
.badge-low { background: #ffe0e0; color: #c44; }
.badge-success { background: #d4edda; color: #2d6a4f; }
.badge-deleted { background: #f0f0f0; color: #888; }

/* ========== Cashier ========== */
.cashier-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 20px;
    min-height: calc(100vh - 120px);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    padding-bottom: 8px;
}

.product-tile {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(138, 109, 47, 0.06);
}
.product-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--gold);
}
.product-tile .ptile-name { font-weight: 700; font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.product-tile .ptile-price { color: var(--gold-dark); font-weight: 700; font-size: 15px; }
.product-tile .ptile-stock { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.product-tile.out { opacity: 0.45; cursor: not-allowed; }
.tile-type-badge {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--gold-gradient);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}
.product-tile { overflow: hidden; }
.product-tile.low { border-color: #e0b94c; }
.product-tile.out { border-color: #d88; }
.tile-ribbon {
    position: absolute;
    top: 9px;
    inset-inline-start: -28px;
    transform: rotate(-45deg);
    width: 110px;
    text-align: center;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.3px;
    padding: 3px 0;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 2;
}
[dir="rtl"] .tile-ribbon { transform: rotate(45deg); }
.ribbon-low { background: linear-gradient(135deg, #e6a93c, #c98b1f); }
.ribbon-out { background: linear-gradient(135deg, #d65656, #b03434); }
.weight-qty-input {
    width: 64px;
    padding: 5px 6px;
    border: 1px solid var(--gold);
    border-radius: 7px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
    background: var(--cream);
    color: var(--ink);
}
.weight-qty-input:focus { outline: none; background: white; box-shadow: 0 0 0 3px rgba(201,164,76,0.15); }
.kg-label { font-size: 11px; color: var(--ink-soft); font-weight: 600; }

.cart-panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    overflow: hidden;
}
.cart-header {
    background: var(--gold-gradient);
    color: var(--ink);
    padding: 14px 18px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-items { flex: 1; overflow-y: auto; padding: 8px 0; max-height: calc(100vh - 420px); }
.cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    align-items: center;
}
.cart-item-name { font-weight: 600; }
.cart-item-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.cart-item-controls { display: flex; align-items: center; gap: 6px; }
.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--cream-2);
    color: var(--gold-dark);
    font-weight: 700;
    border: 1px solid var(--line);
}
.qty-btn:hover { background: var(--gold-gradient-soft); }
.cart-item-qty { min-width: 28px; text-align: center; font-weight: 700; }
.cart-item-remove { color: #c44; padding: 4px 8px; font-size: 16px; }

.cart-footer { padding: 16px 18px; background: var(--cream); border-top: 1px solid var(--line); }
.cart-line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.cart-line.total {
    font-size: 19px;
    font-weight: 700;
    color: var(--gold-dark);
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px dashed var(--gold);
}
.cart-empty { text-align: center; padding: 40px 20px; color: var(--ink-soft); }

.search-bar {
    position: relative;
    margin-bottom: 16px;
}
.search-bar input {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(138, 109, 47, 0.06);
}
.search-bar input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 164, 76, 0.15); }

/* ========== Modal ========== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(42, 36, 24, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    z-index: 1000;
    padding: 24px 20px;
    overflow-y: auto;            /* if the modal is taller than the viewport, the backdrop scrolls */
    -webkit-overflow-scrolling: touch;
}
.modal-backdrop.open {
    display: flex;
    align-items: flex-start;     /* anchor to top so tall modals stay visible from the top */
    justify-content: center;
    animation: fadeIn 0.2s;
}
.modal {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 540px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
    margin: auto 0;              /* vertical centering when content fits; auto-shrinks otherwise */
    animation: slideUp 0.25s;
}
/* On very short screens, ensure the modal can scroll internally too */
@media (max-height: 700px) {
    .modal-backdrop { padding: 12px; }
    .modal { padding: 18px; }
    .modal-header { margin-bottom: 12px; padding-bottom: 10px; }
    .modal-footer { margin-top: 14px; padding-top: 10px; }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.modal-header h3 { font-size: 18px; color: var(--gold-dark); }
.modal-close { font-size: 22px; color: var(--ink-soft); padding: 4px 10px; border-radius: 6px; }
.modal-close:hover { background: var(--cream-2); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: white;
    padding: 14px 22px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--gold);
    z-index: 2000;
    font-weight: 600;
    animation: slideInRight 0.3s;
}
.toast.success { border-left-color: #2d6a4f; }
.toast.error { border-left-color: #c44; }
[dir="rtl"] .toast { right: auto; left: 24px; border-left: none; border-right: 4px solid var(--gold); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== Users management ========== */
.perms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}
.perm-opt { cursor: pointer; }
.perm-opt input { display: none; }
.perm-opt span {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink-soft);
    background: var(--cream);
    transition: all 0.18s;
}
.perm-opt span i { color: var(--gold-dark); width: 16px; }
.perm-opt input:checked + span {
    border-color: var(--gold);
    background: var(--gold-gradient-soft);
    color: var(--gold-dark);
}
.pw-cell {
    background: var(--cream-2);
    padding: 3px 8px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    color: var(--gold-dark);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    flex-wrap: wrap;
}
.pg-info { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.pg-pages { display: flex; align-items: center; gap: 6px; }
.pg-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: white;
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 13px;
    transition: all 0.18s;
}
.pg-btn:hover:not([disabled]):not(.active) {
    background: var(--gold-gradient-soft);
    color: var(--gold-dark);
    border-color: var(--gold);
}
.pg-btn.active {
    background: var(--gold-gradient);
    color: var(--ink);
    border-color: var(--gold);
    box-shadow: 0 2px 8px rgba(201, 164, 76, 0.35);
}
.pg-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.pg-dots { color: var(--ink-soft); padding: 0 2px; font-weight: 700; }

/* ========== Coffee shop: tables floor ========== */
.tables-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.tables-legend { display: flex; gap: 18px; }
.legend-item { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-free { background: #5aa469; }
.dot-busy { background: #d88; }

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
}
.table-card {
    background: white;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    position: relative;
}
.table-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.table-card.free { border-color: #bcd9c3; }
.table-card.busy { border-color: #e8b3b3; background: linear-gradient(180deg, #fff 60%, #fdf0f0); }
.table-card .tc-icon {
    font-size: 32px;
    margin-bottom: 8px;
}
.table-card.free .tc-icon { color: #5aa469; }
.table-card.busy .tc-icon { color: #cc6a6a; }
.table-card .tc-name { font-weight: 700; font-size: 17px; color: var(--ink); }
.table-card .tc-seats { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.tc-order { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.tc-badge {
    font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
    background: #fbe0e0; color: #c0392b;
}
.tc-badge.free { background: #e0f0e4; color: #2d6a4f; }
.tc-total { font-weight: 700; color: var(--gold-dark); font-size: 15px; }

/* Order page */
.order-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.order-topbar h2 { font-size: 22px; }

/* ========== Daily breakdown ========== */
.day-block {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    overflow: hidden;
}
.day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gold-gradient-soft);
    cursor: pointer;
    flex-wrap: wrap;
}
.day-head .day-date {
    font-weight: 700;
    color: var(--gold-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.day-head .day-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.day-head .day-stat { font-size: 12px; color: var(--ink-soft); }
.day-head .day-stat strong { color: var(--gold-dark); font-size: 14px; }
.day-head .day-stat.total strong { font-size: 15px; }
.day-head .chev { transition: transform 0.2s; color: var(--gold-dark); }
.day-block.collapsed .chev { transform: rotate(-90deg); }
[dir="rtl"] .day-block.collapsed .chev { transform: rotate(90deg); }
.day-body { padding: 0; }
.day-block.collapsed .day-body { display: none; }
.day-items { width: 100%; border-collapse: collapse; }
.day-items th {
    background: var(--cream-2);
    color: var(--ink-soft);
    text-align: start;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
}
.day-items td { padding: 8px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.day-items .num { text-align: end; }
.day-items tfoot td { font-weight: 700; background: var(--cream); border-top: 2px solid var(--gold); }
.day-items tfoot .discount { color: #c44; }

/* ========== Reports ========== */
.chart-card { background: white; padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-top: 18px; }
@media (max-width: 1000px) { .charts-grid { grid-template-columns: 1fr; } }

/* ========== Receipt 80mm ========== */
.receipt {
    width: 80mm;
    max-width: 302px;
    padding: 10px 8px;
    font-family: 'UbuntuArabic', monospace;
    font-size: 12px;
    color: #000;
    background: white;
    margin: 20px auto;
    line-height: 1.4;
}
.receipt-logo { text-align: center; margin-bottom: 8px; }
.receipt-logo img { width: 70px; height: 70px; object-fit: contain; }
.receipt-shop { text-align: center; font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.receipt-info { text-align: center; font-size: 11px; margin-bottom: 8px; }
.receipt-hr { border: none; border-top: 1px dashed #000; margin: 8px 0; }
.receipt-meta { display: flex; justify-content: space-between; font-size: 11px; margin: 2px 0; }
.receipt-items { width: 100%; border-collapse: collapse; font-size: 11px; }
.receipt-items th { text-align: start; padding: 4px 2px; border-bottom: 1px solid #000; font-size: 11px; }
.receipt-items td { padding: 3px 2px; vertical-align: top; }
.receipt-totals { margin-top: 6px; }
.receipt-total-line { display: flex; justify-content: space-between; padding: 2px 0; }
.receipt-total-line.grand { font-weight: 700; font-size: 14px; border-top: 1px dashed #000; padding-top: 6px; margin-top: 4px; }
.receipt-thanks { text-align: center; margin-top: 10px; font-style: italic; font-size: 11px; }

@media print {
    body { background: white; }
    .no-print, .sidebar, .topbar { display: none !important; }
    .main { padding: 0 !important; }
    .app { display: block; }
    .receipt { margin: 0; box-shadow: none; }
    @page { size: 80mm auto; margin: 0; }
}

/* ========== Misc ========== */
.text-muted { color: var(--ink-soft); }
.text-gold { color: var(--gold-dark); }
.text-end { text-align: end; }
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; flex-wrap: wrap; gap: 10px; }
.gap-2 { gap: 12px; }
.between { justify-content: space-between; }
.center { align-items: center; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.empty-state { text-align: center; padding: 38px 20px; color: var(--ink-soft); }
.empty-state .icon { font-size: 42px; margin-bottom: 10px; opacity: 0.4; }
.empty-state p { font-size: 14px; margin-bottom: 4px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--cream-2); }
::-webkit-scrollbar-thumb { background: var(--gold-light); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ============================================================
   RESPONSIVE — tablets (≤1024px) and phones (≤640px)
   ============================================================ */

/* Hamburger + sidebar backdrop + cart FAB — hidden on desktop, shown on tablet/phone */
.cart-fab { display: none; }
.hamburger {
    display: none;
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--cream-2);
    color: var(--gold-dark);
    font-size: 18px;
    align-items: center;
    justify-content: center;
    margin-inline-end: 4px;
    transition: background 0.2s;
}
.hamburger:hover { background: var(--gold-gradient-soft); }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(42, 36, 24, 0.5);
    backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s;
}
.sidebar-backdrop.open { display: block; opacity: 1; }

/* ===== Medium desktop / POS monitors (1025–1280px, 4:3 / 5:4 typical) =====
   Targets shop touchscreens — sidebar stays visible, but content gets tighter. */
@media (min-width: 1025px) and (max-width: 1280px) {
    .sidebar { flex: 0 0 220px; width: 220px; }
    .sidebar-logo .logo-frame { width: 90px; height: 90px; }
    .sidebar-logo .name { font-size: 16px; }
    .nav-item { padding: 10px 14px; font-size: 14px; }
    .home-link { padding: 6px; font-size: 11px; }

    .main { padding: 20px 24px; }
    .topbar { gap: 10px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 18px; }
    .topbar h1 { font-size: 22px; }

    /* Stats — fit more per row */
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 18px; }
    .stat-card { padding: 16px; }
    .stat-card .value { font-size: 23px; }
    .stat-card .label { font-size: 12px; }

    /* Cards & tables — less wasted padding */
    .card { padding: 18px; }
    .card-header { margin-bottom: 12px; padding-bottom: 10px; }
    .table th { padding: 11px 12px; font-size: 12px; }
    .table td { padding: 10px 12px; font-size: 13px; }

    /* Buttons inside table rows */
    .btn { padding: 9px 16px; font-size: 13.5px; }
    .btn-sm { padding: 5px 10px; font-size: 12.5px; }

    /* Cashier cart panel — narrower */
    .cashier-grid { grid-template-columns: 1fr 360px; gap: 16px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

    /* Reports charts stack a bit earlier */
    .charts-grid { gap: 14px; }
}

@media (max-width: 1024px) {
    .hamburger { display: inline-flex; }

    /* Sidebar becomes an off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        inset-inline-start: 0;
        height: 100vh;
        width: 280px;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    [dir="rtl"] .sidebar.open { transform: translateX(0); }

    .main {
        padding: 18px 18px 100px; /* extra bottom space so cart FAB doesn't overlap */
    }
    .topbar {
        gap: 10px;
        flex-wrap: wrap;
    }
    .topbar h1 { font-size: 20px; flex: 1; min-width: 0; }
    .lang-switcher a { padding: 5px 9px; font-size: 12px; }

    /* Stats — tighter */
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
    .stat-card .value { font-size: 22px; }

    /* Two-column forms collapse to one */
    .form-row { grid-template-columns: 1fr; gap: 10px; }

    /* Charts already collapse at 1000px — bump to 1024 */
    .charts-grid { grid-template-columns: 1fr; }

    /* Tables — let them scroll horizontally with smaller padding */
    .table th, .table td { padding: 10px 12px; font-size: 13px; }

    /* Cashier — single column with cart drawer */
    .cashier-grid {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .product-grid {
        max-height: none;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .product-tile { padding: 12px 10px; }

    /* Cart turns into a bottom drawer */
    .cart-panel {
        position: fixed;
        bottom: 0;
        inset-inline-start: 0;
        inset-inline-end: 0;
        width: auto;
        max-height: 82vh;
        border-radius: var(--radius) var(--radius) 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 900;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
    }
    body.cart-open .cart-panel { transform: translateY(0); }
    .cart-items {
        max-height: 45vh;
        min-height: 80px;
    }

    /* Floating cart pill */
    .cart-fab {
        display: inline-flex;
        position: fixed;
        bottom: 18px;
        inset-inline-end: 18px;
        z-index: 901;
        align-items: center;
        gap: 10px;
        padding: 12px 18px;
        background: var(--gold-gradient);
        color: var(--ink);
        font-weight: 700;
        border-radius: 999px;
        box-shadow: 0 8px 20px rgba(201, 164, 76, 0.45);
        font-size: 14px;
        transition: transform 0.2s;
    }
    .cart-fab:hover { transform: translateY(-2px); }
    .cart-fab i { font-size: 18px; }
    .cart-fab-count {
        background: var(--ink);
        color: var(--gold-light);
        min-width: 22px; height: 22px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
    }
    .cart-fab.has-items { animation: fab-pulse 1.6s ease-in-out infinite; }
    @keyframes fab-pulse {
        0%, 100% { box-shadow: 0 8px 20px rgba(201, 164, 76, 0.45); }
        50% { box-shadow: 0 8px 28px rgba(201, 164, 76, 0.75); }
    }

    /* Cashier search bar wraps */
    .search-bar { flex-wrap: wrap; }

    /* Coffee tables floor */
    .tables-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

    /* Modals — full width with small margin */
    .modal { max-width: calc(100vw - 24px); margin: 0 12px; }

    /* Pagination wraps nicely */
    .pagination { flex-direction: column; gap: 8px; align-items: stretch; }
    .pg-pages { justify-content: center; flex-wrap: wrap; }
}

/* ===== Phone (≤640px) ===== */
@media (max-width: 640px) {
    .main { padding: 14px 12px 100px; }
    .topbar h1 { font-size: 17px; }
    .lang-switcher { padding: 2px; }
    .lang-switcher a { padding: 4px 7px; font-size: 11px; }

    /* Stats — 2 per row even on small phones */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .value { font-size: 19px; }
    .stat-card .label { font-size: 11px; }

    .card { padding: 16px; }

    /* Product tiles smaller */
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
    .product-tile { padding: 10px 8px; }
    .product-tile .ptile-name { font-size: 12px; }
    .product-tile .ptile-price { font-size: 13px; }

    /* Tables floor — bigger touch targets, fewer per row */
    .tables-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .table-card { padding: 16px 12px; }

    /* Landing tweaks */
    .landing-head h1 { font-size: 26px; }
    .landing-card { padding: 26px 18px; }
    .landing-card .lc-icon { width: 70px; height: 70px; font-size: 30px; }

    /* Report filter — vertical stack */
    .reports-filter, .card .flex.gap-2.center { flex-direction: column; align-items: stretch !important; }

    /* Modal */
    .modal-header h3 { font-size: 16px; }

    /* Cart drawer takes more screen on phones */
    .cart-items { max-height: 32vh; }
}
