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

body {
  font-family: "Inter", "Segoe UI", sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* ====== LAYOUT ====== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #1f2937;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 1.5rem;
  font-size: 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo a {
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.logo-mark {
  background: #3b82f6;
  color: #fff;
  font-weight: bold;
  padding: .4rem .6rem;
  border-radius: .4rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem;
}

.nav-label {
  font-size: .75rem;
  font-weight: bold;
  color: #9ca3af;
  margin: 1rem 0 .5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  border-radius: .4rem;
  color: #d1d5db;
  text-decoration: none;
  transition: background .2s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
}

.nav-item.active {
  background: #3b82f6;
  color: #fff;
}

.sidebar-bottom {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-button {
  background: none;
  border: none;
  color: #d1d5db;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: .6rem 1rem;
  border-radius: .4rem;
}

.logout-button:hover {
  background: rgba(255,255,255,0.1);
}

/* ====== MAIN ====== */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
}

.breadcrumb {
  font-size: .9rem;
  color: #6b7280;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.avatar {
  background: #3b82f6;
  color: #fff;
  font-weight: bold;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-content {
  padding: 2rem;
}

/* ====== STAT CARDS ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border-radius: .6rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: transform .2s;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-icon {
  font-size: 1.5rem;
  color: #3b82f6;
}

.stat-content span {
  font-size: .85rem;
  color: #6b7280;
}

.stat-content strong {
  font-size: 1.4rem;
  color: #111827;
}

/* ====== PANELS ====== */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.panel {
  background: #fff;
  border-radius: .6rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.panel-header h2 {
  margin-top: .25rem;
  font-size: 1.2rem;
  color: #111827;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  background: #f9fafb;
  padding: 1rem;
  border-radius: .5rem;
  transition: background .2s;
}

.quick-action:hover {
  background: #e5e7eb;
}

.quick-action span {
  font-size: 1.5rem;
  color: #3b82f6;
}

.system-status {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  margin-right: .5rem;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 1000;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
}


/*products*/
/* =========================================================
   ADMIN GLOBAL
========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: #f6f7fb;
    color: #1f2937;
}

a {
    color: inherit;
    text-decoration: none;
}

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


/* =========================================================
   PAGE HEADER
========================================================= */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0 0 6px;

    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;

    color: #111827;
}

.page-header p {
    margin: 0;

    color: #6b7280;
    font-size: 14px;
}


/* =========================================================
   CARD
========================================================= */

.card {
    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.03);

    overflow: hidden;
}


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

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 18px 20px;

    border-bottom: 1px solid #eef0f3;
}

.table-toolbar strong {
    display: block;

    font-size: 15px;
    font-weight: 600;

    color: #111827;
}

.muted {
    display: inline-block;

    margin-top: 4px;

    color: #9ca3af;
    font-size: 13px;
}


/* =========================================================
   SEARCH
========================================================= */

.search-box {
    position: relative;
}

.search-box::before {
    content: "⌕";

    position: absolute;
    left: 13px;
    top: 50%;

    transform: translateY(-50%);

    color: #9ca3af;
    font-size: 18px;

    pointer-events: none;
}

.search-box input {
    width: 260px;

    padding: 10px 14px 10px 38px;

    border: 1px solid #dfe3e8;
    border-radius: 9px;

    outline: none;

    background: #ffffff;

    color: #111827;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.search-box input::placeholder {
    color: #9ca3af;
}

.search-box input:focus {
    border-color: #6366f1;

    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.10);
}


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

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;

    border-collapse: collapse;

    min-width: 800px;
}

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    padding: 13px 20px;

    text-align: left;

    font-size: 12px;
    font-weight: 600;

    color: #6b7280;

    text-transform: uppercase;
    letter-spacing: 0.04em;

    border-bottom: 1px solid #e5e7eb;
}

.data-table td {
    padding: 16px 20px;

    font-size: 14px;

    color: #374151;

    border-bottom: 1px solid #f0f1f3;

    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

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

.data-table tbody tr:last-child td {
    border-bottom: none;
}


/* =========================================================
   PRODUCT CELL
========================================================= */

.product-cell {
    display: flex;
    align-items: center;

    gap: 12px;

    min-width: 220px;
}

.product-placeholder {
    width: 46px;
    height: 46px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #f1f3f8;

    font-size: 21px;
}

.product-cell strong {
    display: block;

    margin-bottom: 4px;

    font-size: 14px;
    font-weight: 600;

    color: #111827;
}

.product-cell small {
    display: block;

    color: #9ca3af;

    font-size: 12px;
}


/* =========================================================
   BADGE
========================================================= */

.badge {
    display: inline-flex;
    align-items: center;

    padding: 5px 9px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
}

.badge-success {
    background: #ecfdf3;
    color: #15803d;
}

.badge-danger {
    background: #fef2f2;
    color: #dc2626;
}

.badge-warning {
    background: #fffbeb;
    color: #b45309;
}

.badge-info {
    background: #eff6ff;
    color: #2563eb;
}


/* =========================================================
   BUTTON
========================================================= */

.btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    gap: 6px;

    min-height: 40px;

    padding: 9px 15px;

    border: 1px solid transparent;
    border-radius: 9px;

    cursor: pointer;

    font-size: 13px;
    font-weight: 600;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.1s ease,
        box-shadow 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}


/* Primary */

.btn-primary {
    background: #4f46e5;
    color: #ffffff;

    box-shadow:
        0 2px 5px rgba(79, 70, 229, 0.20);
}

.btn-primary:hover {
    background: #4338ca;
}


/* Secondary */

.btn-secondary {
    background: #ffffff;

    border-color: #dfe3e8;

    color: #374151;
}

.btn-secondary:hover {
    background: #f9fafb;

    border-color: #cfd4dc;
}


/* Danger */

.btn-danger {
    background: #ffffff;

    border-color: #fecaca;

    color: #dc2626;
}

.btn-danger:hover {
    background: #fef2f2;
}


/* Small button */

.btn-sm {
    min-height: 34px;

    padding: 6px 11px;

    border-radius: 7px;

    font-size: 12px;
}


/* =========================================================
   ACTION BUTTONS
========================================================= */

.action-buttons {
    display: flex;
    align-items: center;

    gap: 7px;
}

.action-buttons form {
    margin: 0;
}


/* =========================================================
   EMPTY STATE
========================================================= */

.empty-state {
    padding: 65px 30px !important;

    text-align: center !important;

    color: #6b7280;
}

.empty-icon {
    width: 60px;
    height: 60px;

    margin: 0 auto 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: #f3f4f6;

    font-size: 27px;
}

.empty-state h3 {
    margin: 0 0 7px;

    font-size: 16px;
    font-weight: 600;

    color: #374151;
}

.empty-state p {
    margin: 0 auto 20px;

    max-width: 400px;

    font-size: 13px;

    line-height: 1.6;

    color: #9ca3af;
}


/* =========================================================
   FORM
========================================================= */

.admin-form {
    padding: 24px;
}

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 20px;
}

.form-group {
    display: flex;

    flex-direction: column;

    gap: 7px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;

    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    padding: 11px 13px;

    border: 1px solid #dfe3e8;

    border-radius: 9px;

    outline: none;

    background: #ffffff;

    color: #111827;

    font-size: 14px;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.form-group textarea {
    resize: vertical;

    min-height: 120px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #6366f1;

    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.10);
}

.form-group small {
    font-size: 12px;

    color: #9ca3af;
}


/* =========================================================
   FORM FOOTER
========================================================= */

.form-footer {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    gap: 10px;

    margin-top: 28px;
    padding-top: 20px;

    border-top: 1px solid #eef0f3;
}


/* =========================================================
   PAGE CONTENT
========================================================= */

.section-card {
    margin-top: 20px;
}

.card-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 20px 24px;

    border-bottom: 1px solid #eef0f3;
}

.card-header h2 {
    margin: 0 0 5px;

    font-size: 17px;
    font-weight: 650;

    color: #111827;
}

.card-header p {
    margin: 0;

    font-size: 13px;

    color: #9ca3af;
}


/* =========================================================
   BREADCRUMB
========================================================= */

.breadcrumb {
    display: flex;

    align-items: center;

    gap: 8px;

    margin-bottom: 10px;

    font-size: 12px;

    color: #9ca3af;
}

.breadcrumb a {
    color: #6366f1;
}

.breadcrumb a:hover {
    text-decoration: underline;
}


/* =========================================================
   PRODUCT TABS
========================================================= */

.product-tabs {
    display: flex;

    align-items: center;

    gap: 5px;

    margin-bottom: 20px;

    padding: 5px;

    width: fit-content;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 10px;
}

.product-tab {
    padding: 9px 15px;

    border-radius: 7px;

    font-size: 13px;
    font-weight: 600;

    color: #6b7280;

    transition: 0.2s;
}

.product-tab:hover {
    color: #374151;

    background: #f9fafb;
}

.product-tab.active {
    background: #4f46e5;

    color: #ffffff;
}


/* =========================================================
   IMAGE GRID
========================================================= */

.image-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;

    padding: 24px;
}

.image-card {
    position: relative;

    overflow: hidden;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 12px;
}

.image-card img {
    display: block;

    width: 100%;
    height: 180px;

    object-fit: cover;

    background: #f3f4f6;
}

.image-primary {
    position: absolute;

    top: 10px;
    left: 10px;

    padding: 5px 8px;

    border-radius: 6px;

    background: #111827;

    color: #ffffff;

    font-size: 11px;
    font-weight: 600;
}

.image-actions {
    display: flex;

    gap: 7px;

    padding: 10px;
}


/* =========================================================
   INFO CARD
========================================================= */

.info-card {
    padding: 24px;

    height: fit-content;
}

.info-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 14px;

    border-radius: 10px;

    background: #eef2ff;

    font-size: 20px;
}

.info-card h3 {
    margin: 0 0 8px;

    font-size: 16px;
}

.info-card p {
    margin: 0 0 12px;

    font-size: 13px;

    line-height: 1.6;

    color: #6b7280;
}

.info-card ul {
    margin: 0;

    padding-left: 20px;

    color: #6b7280;

    font-size: 13px;

    line-height: 1.9;
}


/* =========================================================
   FORM LAYOUT
========================================================= */

.form-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        280px;

    gap: 20px;

    align-items: start;
}


/* =========================================================
   INPUT PREFIX / SUFFIX
========================================================= */

.input-prefix,
.input-suffix {
    display: flex;

    align-items: center;

    border: 1px solid #dfe3e8;

    border-radius: 9px;

    overflow: hidden;

    background: #ffffff;
}

.input-prefix span,
.input-suffix span {
    padding: 0 12px;

    color: #6b7280;

    font-size: 13px;

    background: #f9fafb;

    align-self: stretch;

    display: flex;

    align-items: center;
}

.input-prefix input,
.input-suffix input {
    border: none !important;

    box-shadow: none !important;

    border-radius: 0 !important;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1000px) {

    .image-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

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


@media (max-width: 768px) {

    .page-header {
        align-items: flex-start;

        flex-direction: column;
    }

    .page-header .btn {
        width: 100%;
    }

    .table-toolbar {
        align-items: stretch;

        flex-direction: column;
    }

    .search-box input {
        width: 100%;
    }

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

    .form-group.full {
        grid-column: auto;
    }

    .image-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .card-header {
        align-items: flex-start;

        flex-direction: column;
    }

    .card-header .btn {
        width: 100%;
    }

    .product-tabs {
        width: 100%;

        overflow-x: auto;
    }

    .product-tab {
        white-space: nowrap;
    }
}


@media (max-width: 480px) {

    .page-header h1 {
        font-size: 24px;
    }

    .card {
        border-radius: 10px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 14px;
    }

    .admin-form {
        padding: 18px;
    }

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

    .form-footer {
        flex-direction: column-reverse;
    }

    .form-footer .btn {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;

        align-items: stretch;
    }
}


/* color palette */
.color-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-preview {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.color-cell strong {
    display: block;
}

.color-cell small {
    display: block;
    margin-top: 3px;
    color: #6b7280;
}

.color-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input input[type="color"] {
    width: 48px;
    height: 42px;
    padding: 3px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
}

.color-input input[type="text"] {
    flex: 1;
}

/* purchase history */
.purchase-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.purchase-items-table select,
.purchase-items-table input {
    width: 100%;
}

.purchase-items-table input {
    min-width: 100px;
}

.item-number {
    text-align: center;
    color: #6b7280;
}

.empty-items {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

.purchase-summary {
    max-width: 520px;
    margin-left: auto;
    margin-top: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.summary-input {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 20px;
    align-items: center;
    padding: 8px 0;
}

.summary-input input {
    width: 100%;
}

.summary-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 12px 0;
}

.summary-row.total {
    font-size: 20px;
    padding-top: 15px;
}

.summary-row.total strong {
    font-size: 24px;
}

.purchase-items-table .btn-danger {
    font-size: 18px;
    line-height: 1;
}