/* ===============================================================
   RetailSuite — global stylesheet
   Brighter palette, soft shadows, fully responsive (desktop / tablet / mobile)
   =============================================================== */

:root {
    /* Brighter palette */
    --color-primary:        #6366f1;            /* indigo-500 */
    --color-primary-dark:   #4f46e5;            /* indigo-600 */
    --color-primary-soft:   #eef2ff;            /* indigo-50  */
    --color-accent:         #ec4899;            /* pink-500   */
    --color-success:        #10b981;            /* emerald-500 */
    --color-warning:        #f59e0b;            /* amber-500  */
    --color-danger:         #ef4444;            /* red-500    */

    --color-bg:             #f7f7fb;            /* light lavender-grey */
    --color-surface:        #ffffff;
    --color-border:         #e5e7eb;
    --color-border-soft:    #f1f5f9;
    --color-text:           #111827;
    --color-text-muted:     #6b7280;
    --color-text-faint:     #9ca3af;

    /* Sidebar — bright indigo gradient instead of dark slate */
    --sidebar-bg:           linear-gradient(180deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%);
    --sidebar-fg:           rgba(255,255,255,.78);
    --sidebar-fg-active:    #ffffff;
    --sidebar-hover-bg:     rgba(255,255,255,.12);
    --sidebar-active-bg:    rgba(255,255,255,.22);

    /* Surfaces / shadows */
    --shadow-sm:            0 1px 2px rgba(17,24,39,.04);
    --shadow:               0 2px 6px rgba(17,24,39,.06), 0 1px 2px rgba(17,24,39,.04);
    --shadow-lg:            0 8px 24px rgba(17,24,39,.12);

    --radius-sm:            6px;
    --radius:               10px;
    --radius-lg:            14px;

    --sidebar-width:        232px;
    --header-height:        58px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary-dark); }

/* ===============================================================
   Admin layout
   =============================================================== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    padding: 20px 16px;
    overflow-y: auto;
    transition: transform .25s ease;
}

.sidebar h2 {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .3px;
    margin: 0 0 24px;
    padding: 0 6px;
}

.sidebar a, .sidebar a:visited {
    display: block;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-fg);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 3px;
    transition: background .15s, color .15s;
}

.sidebar a:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-fg-active);
}

.sidebar a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-fg-active);
    font-weight: 600;
}

.sidebar hr {
    border: 0;
    border-top: 1px solid rgba(255,255,255,.18);
    margin: 12px 0;
}

/* Sidebar overlay for mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.45);
    z-index: 90;
}

/* ----- Main column ----- */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;       /* allow flex children to shrink for tables */
}

.header {
    background: #fff;
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-burger {
    display: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 6px;
    color: var(--color-text);
    font-size: 22px;
    line-height: 1;
}

.content {
    padding: 24px;
}

.footer {
    padding: 14px 24px;
    border-top: 1px solid var(--color-border);
    font-size: 12px;
    color: var(--color-text-faint);
    background: #fff;
}

/* ===============================================================
   Cards / surfaces
   =============================================================== */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--color-border-soft);
    box-shadow: var(--shadow);
}

/* ===============================================================
   Tables — scroll horizontally on small screens
   =============================================================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 10px;
    border-bottom: 1px solid var(--color-border);
    background: #fafafd;
}

.table td {
    padding: 12px 10px;
    border-top: 1px solid var(--color-border-soft);
    font-size: 14px;
}

.table tr:hover td { background: #fafafd; }

/* Wrap tables on small screens so they scroll horizontally instead of breaking layout. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ===============================================================
   Inputs
   =============================================================== */
.input {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 14px;
    color: var(--color-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}

.input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.input:disabled { background: #f3f4f6; color: var(--color-text-muted); }

select.input { height: 38px; }

/* ===============================================================
   Buttons
   =============================================================== */
.btn {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform .1s ease, background .15s, border-color .15s, box-shadow .15s;
    font-family: inherit;
}

.btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn:active { transform: translateY(1px); }

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(99,102,241,.32);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, #4338ca 100%);
    box-shadow: 0 4px 12px rgba(99,102,241,.40);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: transparent;
}

.btn-danger:hover { background: #dc2626; }

/* ===============================================================
   Login / signup
   =============================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #eef2ff 0%, #fce7f3 100%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    padding: 32px;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    margin: 0 0 6px;
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 26px;
}

.subtitle { font-size: 14px; color: var(--color-text-muted); margin-bottom: 22px; }

.full { width: 100%; margin-bottom: 12px; }

/* ===============================================================
   Modal
   =============================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 16px;
    overflow-y: auto;
}

.modal {
    background: #fff;
    padding: 22px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

/* ===============================================================
   Toast
   =============================================================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--color-text);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    font-size: 14px;
    max-width: calc(100vw - 48px);
}

/* ===============================================================
   Spinner
   =============================================================== */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    animation: spin 1s linear infinite;
    margin: 12px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===============================================================
   Stat cards
   =============================================================== */
.stat-card  { text-align: center; padding: 22px; }
.stat-label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 8px;
              text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--color-text); }
.stat-sub   { font-size: 12px; color: var(--color-text-faint); margin-top: 4px; }
.stat-warning .stat-value { color: var(--color-danger); }
.stat-warning             { border-color: #fecaca; background: #fff7f7; }

/* ===============================================================
   Status badges
   =============================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}

.badge-grey  { background: #f3f4f6; color: #374151; }
.badge-blue  { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-amber { background: #fef3c7; color: #a16207; }

/* ===============================================================
   Storefront
   =============================================================== */
.shop-layout {
    min-height: 100vh;
    background: var(--color-bg);
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.shop-header {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-accent) 100%);
    color: white;
    padding: 0 24px;
    min-height: 60px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.shop-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: auto;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.shop-brand {
    font-size: 19px;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: .3px;
}

.shop-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.shop-nav a {
    color: rgba(255,255,255,.88);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.shop-nav a:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
}

.cart-link { position: relative; }

.cart-badge {
    background: var(--color-warning);
    color: #fff;
    border-radius: 99px;
    font-size: 11px;
    padding: 1px 7px;
    margin-left: 4px;
    font-weight: 700;
}

.shop-main {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 20px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: #fff;
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s;
    box-shadow: var(--shadow-sm);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(99,102,241,.18);
    border-color: rgba(99,102,241,.4);
}

.product-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg,#fafafd,#eef2ff);
}

.product-img-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg,#fafafd,#eef2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--color-text-faint);
}

.product-info { padding: 14px; }

.product-name { font-weight: 600; font-size: 15px; margin-bottom: 4px;
                color: var(--color-text); line-height: 1.3; }
.product-price { color: var(--color-primary-dark); font-size: 16px; font-weight: 700; }

/* ===============================================================
   Responsive — tablet + mobile
   =============================================================== */

/* Tablet (<= 1024px) — slightly tighter spacing */
@media (max-width: 1024px) {
    .content { padding: 18px; }
    :root { --sidebar-width: 200px; }
}

/* Mobile (<= 768px) — sidebar becomes a slide-out drawer */
@media (max-width: 768px) {
    body { font-size: 14px; }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 100;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        width: min(260px, 80vw);
    }

    .sidebar.open       { transform: translateX(0); }
    .sidebar-backdrop.open { display: block; }

    .header-burger { display: inline-flex; }

    .content { padding: 14px; }

    .card { padding: 14px; border-radius: var(--radius); }

    /* Tables collapse to horizontal scroll if not wrapped — but wrapped is preferred */
    .table { font-size: 13px; }
    .table th, .table td { padding: 8px 6px; }

    /* Two-column grids stack */
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .product-img, .product-img-placeholder { height: 140px; }

    /* Storefront header content wraps; navigation chips stay scrollable */
    .shop-header { padding: 8px 16px; }
    .shop-brand  { font-size: 17px; }
    .shop-nav a  { padding: 6px 10px; font-size: 13px; }

    .shop-main { margin: 18px auto; padding: 0 14px; }

    /* Modal full-width on phone */
    .modal { max-width: 100%; padding: 18px; border-radius: var(--radius); }
    .modal-overlay { padding: 8px; }

    .footer { padding: 12px 16px; }
}

/* Small phones (<= 380px) */
@media (max-width: 380px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-img, .product-img-placeholder { height: 110px; }
    .stat-value { font-size: 24px; }
}

/* ===============================================================
   Print receipt styles
   =============================================================== */
@media print {
    body > * { display: none !important; }
    #receipt-printable { display: block !important; }
}
