/* ==========================================================================
   Atanix catalogue admin — layout on top of the storefront design system
   ========================================================================== */

body.admin { background: var(--bg-alt); }

/* ---------- Login gate ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 20px; }
.login-card { width: min(420px, 100%); background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 36px; }
.login-card .brand { margin-bottom: 24px; }
.login-card h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.login-card p { color: var(--muted); font-size: .9rem; margin: 8px 0 24px; }
.login-note { font-size: .78rem; color: var(--muted); margin-top: 18px; line-height: 1.5; }
.login-note code { background: var(--bg-alt); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar { background: var(--ink); color: #9aa2ad; padding: 22px 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 22px 24px; }
.sidebar .brand-logo { height: 40px; }
.side-nav { list-style: none; display: grid; gap: 2px; }
.side-nav button {
    width: 100%; display: flex; align-items: center; gap: 12px;
    padding: 12px 22px; background: none; border: none; border-left: 3px solid transparent;
    color: #9aa2ad; font-size: .93rem; font-weight: 500; cursor: pointer; text-align: left;
    transition: background .18s ease, color .18s ease;
}
.side-nav button i { width: 18px; text-align: center; }
.side-nav button:hover { background: #1a1f26; color: #fff; }
.side-nav button.active { background: #1a1f26; color: #fff; border-left-color: var(--brand); }
.side-foot { margin-top: auto; padding: 18px 22px 0; border-top: 1px solid #22272e; display: grid; gap: 10px; font-size: .88rem; }
.side-foot a, .side-foot button { color: #9aa2ad; background: none; border: none; padding: 0; text-align: left; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.side-foot a:hover, .side-foot button:hover { color: var(--brand); }

.main { padding: 0 0 60px; min-width: 0; }
.main-head {
    background: #fff; border-bottom: 1px solid var(--line); padding: 20px 32px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    position: sticky; top: 0; z-index: 60;
}
.main-head h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin-right: auto; }
.main-body { padding: 30px 32px; }
/* The admin views are <section> elements, so the storefront's section padding
   has to be cleared here. */
.view { display: none; padding: 0; }
.view.active { display: block; }

/* ---------- Stat cards ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat-card i { color: var(--brand); font-size: 1.1rem; }
.stat-card b { display: block; font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; }
.stat-card span { font-size: .84rem; color: var(--muted); }

/* ---------- Panels & tables ---------- */

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel + .panel { margin-top: 24px; }
.panel-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.02rem; font-weight: 600; margin-right: auto; }
.panel-body { padding: 22px; }

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 760px; }
table.data th, table.data td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; background: var(--bg-alt); white-space: nowrap; }
table.data tbody tr:hover { background: #fcfcfd; }
table.data td.num { text-align: right; white-space: nowrap; }
table.data .thumb { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: var(--bg-alt); }
table.data .row-name { font-weight: 600; }
table.data .row-sub { font-size: .78rem; color: var(--muted); }
table.data .actions { display: flex; gap: 8px; justify-content: flex-end; }
.icon-action {
    width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
    background: #fff; cursor: pointer; display: grid; place-items: center; font-size: .85rem;
    transition: all .18s ease;
}
.icon-action:hover { border-color: var(--brand); color: var(--brand); }
.icon-action.danger:hover { border-color: var(--brand); background: var(--brand); color: #fff; }

.pill { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.pill.live { background: #e9f8ef; color: #12663a; }
.pill.soon { background: #eef0f2; color: var(--ink-2); }
.pill.out { background: #fdecee; color: #a1000a; }
.pill.flag { background: var(--brand-soft); color: var(--brand); }

.empty-row { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ---------- Editor ---------- */

.editor-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 26px; align-items: start; }
.editor-note { font-size: .82rem; color: var(--muted); margin-top: 14px; }
.checkbox-row { display: flex; gap: 10px; align-items: center; font-size: .92rem; margin-bottom: 18px; }
.checkbox-row input { width: 17px; height: 17px; }

.preview-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative; }
.preview-img { height: 210px; width: 100%; object-fit: cover; background: var(--bg-alt); display: block; }
.preview-info { padding: 20px; }
.preview-cat { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.preview-title { font-size: 1.04rem; font-weight: 600; margin: 7px 0 8px; }
.preview-desc { font-size: .86rem; color: var(--muted); margin-bottom: 12px; }
.preview-price { font-size: 1.3rem; font-weight: 700; color: var(--brand); }
.preview-mrp { font-size: .9rem; color: var(--muted); text-decoration: line-through; margin-left: 8px; }

/* ---------- Confirm dialog ---------- */

.confirm-actions { display: flex; gap: 12px; margin-top: 24px; }
.confirm-actions .btn { flex: 1; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .side-nav { display: flex; overflow-x: auto; gap: 0; }
    .side-nav button { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; padding: 12px 16px; }
    .side-nav button.active { border-left-color: transparent; border-bottom-color: var(--brand); }
    .side-foot { display: flex; gap: 18px; padding: 14px 22px 0; }
    .editor-grid { grid-template-columns: 1fr; }
    .main-head, .main-body { padding-left: 20px; padding-right: 20px; }
}
