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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f4f6f9;
    color: #222;
    overflow-x: hidden;
}

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 320px;
}

.login-box h2 {
    margin-bottom: 20px;
    font-size: 20px;
    text-align: center;
    color: #1e3c72;
}

.login-box label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.login-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.login-box button {
    width: 100%;
    margin-top: 20px;
    padding: 10px;
    background: #1e3c72;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
}

.login-box button:hover { background: #16305c; }

.alert-error {
    background: #ffe0e0;
    color: #b30000;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 10px;
}

/* ---------- Admin Layout ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    background: #f2f2f2;
    color: #585858;
    padding: 0;
    flex-shrink: 0;
    border-right: 1px solid #ccc;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .01em;
    color: #2b7dbc;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #ccc;
}
.sidebar-brand .nav-icon { color: #2b7dbc; }

.sidebar nav ul { list-style: none; margin-top: 0; }

.sidebar nav ul li a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 39px;
    line-height: 21px;
    padding: 9px 16px 9px 13px;
    color: #585858;
    text-decoration: none;
    border-bottom: 1px solid #e5e5e5;
    border-left: 3px solid transparent;
    font-size: 13px;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    flex-shrink: 0;
    color: #8a99a8;
}
.nav-icon svg { width: 16px; height: 16px; }

.sidebar nav ul li a:hover {
    background: #fff;
    border-left-color: #629cc9;
    color: #2b7dbc;
}
.sidebar nav ul li a:hover .nav-icon { color: #2b7dbc; }

.sidebar nav ul li a.active {
    color: #2b7dbc;
    font-weight: 700;
    background: #fff;
    border-left-color: #2b7dbc;
}
.sidebar nav ul li a.active .nav-icon { color: #2b7dbc; }

.content {
    flex: 1;
    padding: 30px;
    min-width: 0;
}

.content h1 { font-size: 22px; margin-bottom: 20px; color: #1e3c72; }

/* ---------- Mobile sidebar toggle ---------- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #1e3c72;
}
.sidebar-overlay { display: none; }

@media (max-width: 900px) {
    .sidebar-toggle { display: flex; }

    .layout { display: block; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform .2s ease;
        overflow-y: auto;
        max-width: 82vw;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 2px 0 16px rgba(0,0,0,.25); }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,.45);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    .sidebar-overlay.show { opacity: 1; pointer-events: auto; }

    body.sidebar-locked { overflow: hidden; }

    .content { padding: 20px 16px 16px; padding-top: 64px; }

    .content-header { flex-wrap: wrap; gap: 10px; align-items: flex-start; }

    .stat-cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

    .inline-form { flex-wrap: wrap; }
    .inline-form input { max-width: 100%; }

    .variation-row { grid-template-columns: 1fr 1fr; }

    .pos-layout { grid-template-columns: 1fr; }
    .pos-cart { position: static; }
}

@media (max-width: 480px) {
    .login-box { width: 90vw; padding: 28px 20px; }
    .content { padding: 16px 12px; padding-top: 60px; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: center;
}

.card h3 { font-size: 26px; color: #1e3c72; }
.card p { margin-top: 6px; font-size: 13px; color: #666; }

/* ---------- Buttons / Alerts ---------- */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn, .btn-secondary, .btn-danger {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn { background: #1e3c72; color: #fff; }
.btn:hover { background: #16305c; }

.btn-secondary { background: #e2e6ed; color: #333; }
.btn-secondary:hover { background: #d0d5dd; }

.btn-danger { background: #d64545; color: #fff; margin-left: 6px; }
.btn-danger:hover { background: #b53232; }

.alert-success {
    background: #e0f7e0;
    color: #1a7a1a;
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.hint { font-size: 12px; color: #888; margin: 6px 0 12px; }

/* ---------- Forms ---------- */
.inline-form {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.inline-form input {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    flex: 1;
    max-width: 300px;
}

.form-box {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    max-width: 600px;
}

.form-box label {
    display: block;
    margin-top: 14px;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.form-box input,
.form-box select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.variation-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.variation-row input { width: 100%; }

/* ---------- Table ---------- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.data-table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
}

@media (max-width: 900px) {
    .table-responsive .data-table { min-width: 600px; }
    .table-responsive { box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset -8px 0 8px -8px rgba(0,0,0,0.06); }
}

.data-table th, .data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.data-table th {
    background: #f0f3f8;
    color: #444;
    font-weight: 600;
}

.data-table tbody tr {
    background-color: #ffffff;
}

.data-table tbody tr:nth-child(even) {
    background-color: #dceaf9;
}

.data-table tbody tr:hover {
    background-color: #c3ddf5;
}

.data-table .actions a {
    margin-right: 10px;
    font-size: 12px;
    color: #1e3c72;
    text-decoration: none;
}

.data-table .actions a:hover { text-decoration: underline; }

.thumb, .thumb-preview {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 4px;
}

.thumb-preview { width: 90px; height: 90px; margin: 6px 0; }

.no-image { font-size: 11px; color: #999; }

.badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-active { background: #e0f7e0; color: #1a7a1a; }
.badge-inactive { background: #f5e0e0; color: #a52a2a; }

.inline-delete-form { display: inline; }
.inline-delete-form button.btn-danger {
    font-size: 12px;
    padding: 6px 12px;
}

/* ---------- POS / Billing screen ---------- */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    align-items: start;
}

.pos-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 14px;
    font-size: 14px;
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 70vh;
    overflow-y: auto;
}

.pos-card {
    background: #fff;
    border: 1px solid #e2e6ed;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: box-shadow .15s;
}

.pos-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.1); border-color: #1e3c72; }
.pos-card strong { font-size: 13px; }
.pos-card span { color: #1e3c72; font-weight: 600; font-size: 13px; }
.pos-card small { color: #888; font-size: 11px; }

.pos-cart {
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 20px;
}

.pos-cart h3 { margin-bottom: 12px; color: #1e3c72; }

#cart-items { max-height: 260px; overflow-y: auto; margin-bottom: 12px; }

.cart-row {
    display: grid;
    grid-template-columns: 1fr 55px 70px 24px;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}

.cart-qty { width: 50px; padding: 4px; border: 1px solid #ccc; border-radius: 4px; }
.cart-remove {
    background: none; border: none; color: #d64545; font-size: 18px; cursor: pointer; line-height: 1;
}

.pos-totals { border-top: 1px solid #eee; padding-top: 10px; font-size: 13px; }
.pos-totals > div { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.pos-totals input { width: 90px; padding: 5px; border: 1px solid #ccc; border-radius: 4px; text-align: right; }
.pos-total-final { font-weight: 700; font-size: 15px; border-top: 1px solid #ddd; margin-top: 6px; padding-top: 8px !important; }

.pos-cart form label { margin-top: 10px; }
.pos-cart form input, .pos-cart form select {
    width: 100%; padding: 7px 9px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; margin-top: 3px;
}
