
/* =========================================
   WBTW ADMIN DASHBOARD
   Complete CSS
========================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f1f0eb;
  color: #171717;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* =========================================
   GLOBAL HIDDEN FIX
   Prevent login and dashboard overlap
========================================= */

[hidden] {
  display: none !important;
}

/* =========================================
   LOGIN VIEW
========================================= */

#loginView {
  min-height: 100vh;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  padding: 45px;
}

.brand {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.09em;
  text-decoration: none;
  color: #111;
  display: block;
}

.brand small {
  display: block;
  font-size: 8px;
  letter-spacing: 0.2em;
  margin-top: 2px;
}

.eyebrow,
.side-label {
  font-size: 9px;
  letter-spacing: 0.17em;
  color: #777;
  font-weight: bold;
}

.login-card .eyebrow {
  margin-top: 20px;
}

.login-card h1 {
  font-size: 34px;
  letter-spacing: -0.06em;
  margin: 10px 0 30px;
}

.login-card label,
.editor label {
  display: grid;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 0.12em;
  font-weight: bold;
  margin: 15px 0;
}

.login-card input,
.editor input:not([type="checkbox"]),
.editor select,
.editor textarea {
  width: 100%;
  border: 1px solid #d7d5ce;
  background: #fff;
  padding: 13px;
  outline-color: #171717;
  font-size: 12px;
}

.login-card input:focus,
.editor input:focus,
.editor select:focus,
.editor textarea:focus {
  border-color: #171717;
}

.primary,
.secondary {
  border: 1px solid #171717;
  padding: 13px 18px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.primary {
  background: #171717;
  color: #fff;
}

.primary:hover {
  background: #333;
}

.secondary {
  background: transparent;
  color: #171717;
}

.secondary:hover {
  background: #e3e1da;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-card .primary {
  width: 100%;
  margin-top: 12px;
}

.back {
  display: block;
  margin-top: 25px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #777;
  text-decoration: none;
}

.back:hover {
  color: #171717;
}

.error {
  color: #b42318;
  font-size: 11px;
  min-height: 15px;
}

/* =========================================
   ADMIN APP LAYOUT
========================================= */

#appView.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

/* =========================================
   SIDEBAR
========================================= */

.sidebar {
  background: #171717;
  color: white;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sidebar .brand {
  color: white;
  margin-bottom: 45px;
}

.side-label {
  color: #777;
  margin: 0 10px 10px;
}

.side-link {
  display: block;
  text-align: left;
  background: none;
  border: 0;
  color: #aaa;
  padding: 13px 10px;
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.side-link.active,
.side-link:hover {
  background: #2b2b2b;
  color: #fff;
}

.logout {
  margin-top: auto;
}

/* =========================================
   MAIN CONTENT
========================================= */

.main {
  min-width: 0;
  padding: 35px 4vw;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #d7d5ce;
  padding-bottom: 22px;
}

.topbar h2 {
  font-size: 32px;
  letter-spacing: -0.06em;
  margin: 6px 0;
}

.admin-user {
  font-size: 9px;
  letter-spacing: 0.15em;
  background: #e3e1da;
  padding: 10px;
}

/* =========================================
   TOOLBAR
========================================= */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 22px;
}

.toolbar h3 {
  font-size: 15px;
  letter-spacing: 0.08em;
  margin: 0;
}

.toolbar p {
  font-size: 11px;
  color: #777;
}

/* =========================================
   STATISTICS
========================================= */

.stats {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}

.stat {
  background: white;
  padding: 18px 20px;
  min-width: 150px;
}

.stat span {
  display: block;
  color: #777;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.stat strong {
  display: block;
  font-size: 25px;
  margin-top: 8px;
}

/* =========================================
   TABLE
========================================= */

.table-wrap {
  background: white;
  overflow: auto;
  width: 100%;
}

table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  min-width: 680px;
}

th {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #777;
  background: #f8f7f4;
}

th,
td {
  padding: 15px;
  border-bottom: 1px solid #eceae5;
}

td {
  font-size: 11px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item img {
  width: 44px;
  height: 54px;
  object-fit: cover;
  background: #eee;
}

.item strong {
  display: block;
}

.item small {
  color: #777;
}

/* =========================================
   STATUS
========================================= */

.status {
  display: inline-block;
  font-size: 9px;
  background: #ecebe6;
  padding: 6px 8px;
}

/* =========================================
   ROW ACTIONS
========================================= */

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  border: 0;
  background: none;
  text-decoration: underline;
  font-size: 10px;
  cursor: pointer;
  color: #171717;
}

.row-actions button:hover {
  color: #777;
}

/* =========================================
   ORDER SELECT
========================================= */

td select {
  border: 1px solid #d7d5ce;
  background: white;
  padding: 8px;
  font-size: 10px;
  max-width: 130px;
}

/* =========================================
   PRODUCT EDITOR MODAL
========================================= */

.modal {
  position: fixed;
  inset: 0;
  background: #0008;
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 100;
}

.modal.open {
  display: grid;
}

.editor {
  position: relative;
  background: #f1f0eb;
  width: min(700px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 32px;
}

.editor h2 {
  font-size: 30px;
  letter-spacing: -0.06em;
  margin: 8px 0 25px;
}

.x {
  position: absolute;
  right: 20px;
  top: 18px;
  border: 0;
  background: none;
  font-size: 24px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.grid .wide {
  grid-column: 1 / -1;
}

.editor small {
  font-size: 9px;
  color: #777;
}

.editor .check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor .check input {
  width: auto;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* =========================================
   RESPONSIVE TABLET AND MOBILE
========================================= */

@media (max-width: 760px) {

  #appView.app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .sidebar .brand {
    font-size: 25px;
    margin: 0 auto 0 0;
  }

  .sidebar .brand small {
    font-size: 6px;
  }

  .side-label {
    display: none;
  }

  .side-link {
    padding: 10px;
  }

  .logout {
    margin: 0;
  }

  .main {
    padding: 22px 4vw;
  }

  .stats {
    flex-wrap: wrap;
  }

  .stat {
    flex: 1;
    min-width: 120px;
  }

  .toolbar {
    align-items: flex-start;
    gap: 12px;
  }

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

  .grid .wide {
    grid-column: auto;
  }

  .editor {
    padding: 25px 18px;
  }
}

/* =========================================
   SMALL MOBILE
========================================= */

@media (max-width: 480px) {

  .login-card {
    padding: 30px 24px;
  }

  .login-card h1 {
    font-size: 28px;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .admin-user {
    padding: 8px;
  }

  .toolbar {
    flex-direction: column;
  }

  .stats {
    gap: 8px;
  }

  .stat {
    padding: 15px;
  }

  .stat strong {
    font-size: 22px;
  }

  .sidebar .brand {
    width: 100%;
    margin-bottom: 8px;
  }

  .side-link {
    font-size: 10px;
  }
}
