@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Sora:wght@400;600;700&display=swap');

:root {
  --bg: #070711;
  --surface: rgba(255,255,255,0.04);
  --surface2: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --accent: #7c6fcd;
  --accent2: #4fc3f7;
  --text: #e8e8f0;
  --text-muted: #6b6b8a;
  --success: #4ade80;
  --warning: #fb923c;
  --danger: #f87171;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="0.05"/%3E%3C/svg%3E');
    min-height: 100vh;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

h1, h2, h3, h4, h5, h6 { font-family: 'Sora', sans-serif; }
a { color: var(--accent); text-decoration: none; transition: 0.2s ease; }
a:hover { color: var(--accent2); }

.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar .logo { font-size: 24px; font-weight: 700; color: #fff; margin-bottom: 40px; display: flex; align-items: center; gap: 10px;}
.sidebar .nav-links { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.sidebar .nav-links li a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
}
.sidebar .nav-links li a:hover, .sidebar .nav-links li a.active {
    background: var(--surface2); color: #fff;
}
.sidebar .nav-links li a.active { border-left: 3px solid var(--accent); }

.main-content {
    margin-left: var(--sidebar-w);
    padding: 24px;
    transition: margin-left 0.3s ease;
}

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 30px;
    padding: 16px 24px;
    background: var(--surface);
    border-radius: 12px; border: 1px solid var(--border);
    backdrop-filter: blur(20px);
}
.topbar-right { display: flex; align-items: center; gap: 20px; }
.clock { font-family: monospace; color: var(--accent2); }
.hamburger { display: none; background: none; border: none; color: #fff; cursor: pointer; }

.glass-card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}
.stat-card {
    display: flex; flex-direction: column; gap: 10px;
    position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.stat-card .icon { color: var(--accent); margin-bottom: 10px; }
.stat-card .value { font-size: 32px; font-weight: 700; color: #fff; font-family: 'Sora', sans-serif;}
.stat-card .label { color: var(--text-muted); font-size: 14px; }

.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 24px;}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 24px; margin-bottom: 24px;}

.table-responsive { overflow-x: auto; width: 100%; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 16px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.data-table td { padding: 16px; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.data-table tr:hover td { background: var(--surface2); }

.btn {
    padding: 10px 20px; border-radius: 8px; font-weight: 600;
    cursor: pointer; transition: 0.2s ease; border: none; display: inline-flex; align-items: center; gap: 8px;
    text-decoration: none; font-size: 14px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #685cc7; box-shadow: 0 0 15px rgba(124,111,205,0.4); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #000; }
.btn-ghost { background: var(--surface); color: #fff; border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); }

.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.pending { background: rgba(251,146,60,0.2); color: var(--warning); }
.badge.success { background: rgba(74,222,128,0.2); color: var(--success); }
.badge.failed { background: rgba(248,113,113,0.2); color: var(--danger); }
.badge.processing { background: rgba(79,195,247,0.2); color: var(--accent2); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 14px; }
.form-input {
    width: 100%; padding: 12px 16px; border-radius: 8px;
    background: var(--surface); border: 1px solid var(--border);
    color: #fff; transition: 0.2s ease;
}
.form-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 10px rgba(124,111,205,0.2); }
.search-bar { width: 300px; }

.login-page {
    height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% -20%, #2e266f, var(--bg));
}
.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card h2 { margin: 20px 0; }

.mb-4 { margin-bottom: 24px; }
.mt-4 { margin-top: 24px; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }

.flash { padding: 16px; border-radius: 8px; margin-bottom: 24px; text-align: center; font-weight: 600; }
.flash.success { background: rgba(74,222,128,0.2); color: var(--success); border: 1px solid var(--success); }
.flash.error { background: rgba(248,113,113,0.2); color: var(--danger); border: 1px solid var(--danger); }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
}

/* ── PRODUCTS PAGE ──────────────────────────────── */
.page-grid { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .page-grid { grid-template-columns: 1fr; } }

.add-product-panel { position: sticky; top: 24px; }

.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-form .form-input { flex: 1; min-width: 130px; }

.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

.product-card-admin {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.product-card-admin:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.product-card-admin.inactive { opacity: .5; }

.product-card-img {
  position: relative;
  height: 140px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-img-placeholder { color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; }
.product-img-placeholder i { width: 40px; height: 40px; }
.product-img-placeholder.large i { width: 80px; height: 80px; }

.product-type-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 10px; padding: 2px 8px; border-radius: 99px; font-weight: 600; text-transform: uppercase;
}
.badge-premium { background: linear-gradient(135deg,#7c6fcd,#a855f7); color: #fff; }
.badge-smm { background: linear-gradient(135deg,#4fc3f7,#0ea5e9); color: #fff; }
.badge-custom { background: linear-gradient(135deg,#fb923c,#ea580c); color: #fff; }

/* Toggle Switch on Card */
.toggle-switch { position: absolute; bottom: 8px; right: 8px; display: inline-flex; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-slider {
  width: 36px; height: 20px; background: rgba(255,255,255,.2); border-radius: 99px;
  transition: .3s; position: relative;
}
.toggle-slider::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: .3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::after { left: 18px; }

.product-card-body { padding: 12px; }
.product-card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.product-card-cat { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.product-card-cat i { width: 12px; height: 12px; }
.product-card-price { font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.product-card-actions { display: flex; gap: 6px; }
.product-card-actions .inline { margin: 0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Edit Product Page */
.back-bar { margin-bottom: 20px; }
.edit-product-grid { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
@media (max-width: 800px) { .edit-product-grid { grid-template-columns: 1fr; } }

.current-product-img {
  position: relative; margin-bottom: 16px;
  border-radius: 12px; overflow: hidden;
  background: var(--surface); aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.current-product-img img { width: 100%; height: 100%; object-fit: cover; }
.img-badge { position: absolute; top: 8px; right: 8px; }
.webp-badge { background: #4ade80; color: #000; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 99px; display: flex; align-items: center; gap: 3px; }
.webp-badge i { width: 12px; height: 12px; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px; padding: 24px 16px;
  text-align: center; cursor: pointer;
  transition: .2s; display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-muted);
}
.upload-zone:hover { border-color: var(--accent); color: var(--accent); background: rgba(124,111,205,.05); }
.upload-zone i { width: 32px; height: 32px; }
.upload-zone span { font-size: 13px; font-weight: 500; }
.upload-zone small { font-size: 11px; }

.upload-info {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: rgba(124,111,205,.1); border-radius: 8px; margin-top: 10px;
  font-size: 12px; color: var(--text);
}
.badge-webp { background: var(--success); color: #000; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; }

.danger-zone { border-top: 1px solid rgba(248,113,113,.2); padding-top: 16px; }
.danger-zone h4 { color: var(--danger); display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 12px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 400px) { .form-row { grid-template-columns: 1fr; } }

.img-preview { width: 100%; border-radius: 12px; margin-top: 10px; object-fit: cover; max-height: 200px; }

.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.mb-4 { margin-bottom: 16px; }
.btn-full { width: 100%; justify-content: center; }

/* Toast Notif */
.toast-notif {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(60px);
  background: var(--surface2); border: 1px solid var(--border); backdrop-filter: blur(20px);
  color: var(--text); padding: 12px 20px; border-radius: 99px;
  font-size: 13px; font-weight: 500; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  transition: transform .3s ease; z-index: 9999; white-space: nowrap;
}
.toast-notif.show { transform: translateX(-50%) translateY(0); }

/* Flash Message */
.flash-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: 12px; margin-bottom: 20px;
  font-size: 14px; font-weight: 500;
}
.flash-success { background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.3); color: var(--success); }
.flash-error { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--danger); }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { width: 48px; height: 48px; margin: 0 auto 12px; display: block; }
.empty-state p { font-size: 14px; }

.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; margin-bottom: 20px; color: var(--text);
}
.card-title i { width: 18px; height: 18px; color: var(--accent); }

/* Activity Feed */
.activity-feed { max-height: 400px; overflow-y: auto; padding-right: 8px; }
.activity-feed::-webkit-scrollbar { width: 4px; }
.activity-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.activity-item { 
    display: flex; gap: 12px; padding: 12px 0; 
    border-bottom: 1px solid var(--border);
    animation: slideUp 0.3s ease forwards;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-order { background: rgba(124,111,205,0.1); color: #7c6fcd; }
.icon-deposit { background: rgba(74,222,128,0.1); color: #4ade80; }
.activity-content { flex: 1; font-size: 13px; line-height: 1.4; color: var(--text); }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.spin { animation: spin 2s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
