@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

:root {
  --admin-bg: #f4f6fb;
  --admin-surface: #ffffff;
  --admin-surface-elevated: #f8fafc;
  --admin-border: #e2e8f0;
  --admin-text: #0f172a;
  --admin-text-muted: #64748b;
  --admin-primary: #1e293b;
  --admin-secondary: #334155;
  --admin-success: #16a34a;
  --admin-warning: #d97706;
  --admin-danger: #dc2626;
  --admin-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --admin-radius: 14px;
  --sidebar-width: 278px;
  --header-height: 64px;
}

html[data-theme='dark'] {
  --admin-bg: #0b1220;
  --admin-surface: #111827;
  --admin-surface-elevated: #1f2937;
  --admin-border: #334155;
  --admin-text: #e5e7eb;
  --admin-text-muted: #94a3b8;
  --admin-primary: #60a5fa;
  --admin-secondary: #818cf8;
  --admin-success: #22c55e;
  --admin-warning: #f59e0b;
  --admin-danger: #f87171;
  --admin-shadow: 0 14px 36px rgba(2, 6, 23, 0.45);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }

.admin-shell { display: flex; min-height: 100vh; background: var(--admin-bg); }
.admin-main,
.admin-content,
.admin-sidebar,
.admin-header,
.card,
.nav-item,
.nav-group-header,
.nav-filter,
.sidebar-toggle,
.dropdown-menu,
.balance-chip,
.product-panel,
.product-panel-image,
.btn-product-buy,
.btn-order { transition: all .22s ease; }

.admin-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
}
.admin-shell.sidebar-collapsed .admin-sidebar { width: 82px; min-width: 82px; }

.sidebar-header {
  height: var(--header-height);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--admin-border);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--admin-border); background: var(--admin-surface-elevated); display: grid; place-items: center; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-title { font-size: 15px; font-weight: 800; white-space: nowrap; }
.admin-shell.sidebar-collapsed .brand-text { display: none; }

.sidebar-toggle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface-elevated);
  color: var(--admin-text);
  cursor: pointer;
}
.sidebar-toggle:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(15,23,42,.12); }
.sidebar-toggle:active { transform: translateY(0); }

.sidebar-nav { padding: 12px 10px; overflow-y: auto; }
.nav-section { margin-bottom: 12px; }
.nav-item,
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--admin-text);
}
.nav-item:hover,
.nav-group-header:hover,
.nav-filter:hover { background: var(--admin-surface-elevated); transform: translateX(2px); }
.nav-item.active { background: var(--admin-primary); color: #fff; box-shadow: 0 6px 14px rgba(15,23,42,.18); }
.nav-icon,
.nav-group-icon { width: 20px; text-align: center; font-size: 15px; }
.nav-text { flex: 1; min-width: 0; }
.nav-label { white-space: nowrap; }

.admin-shell.sidebar-collapsed .nav-text,
.admin-shell.sidebar-collapsed .nav-group-title,
.admin-shell.sidebar-collapsed .nav-badge,
.admin-shell.sidebar-collapsed .nav-group-arrow,
.admin-shell.sidebar-collapsed .nav-group-content,
.admin-shell.sidebar-collapsed .sidebar-cart-label { display: none !important; }

.nav-group { margin-bottom: 8px; }
.nav-group-title-main { flex: 1; font-size: 13px; font-weight: 700; }
.nav-badge,
.nav-filter-badge {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--admin-surface-elevated);
  border: 1px solid var(--admin-border);
}
.nav-group-arrow { font-size: 12px; transition: transform .22s ease; }
.nav-group-content { display: none; margin: 6px 0 10px 20px; animation: fadeInUp .2s ease; }
.nav-group.open .nav-group-content { display: block; }
.nav-group.open .nav-group-arrow { transform: rotate(180deg); }
.nav-filter { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-radius: 8px; color: var(--admin-text-muted); }

.sidebar-cart { margin: auto 10px 10px; border-top: 1px solid var(--admin-border); padding-top: 10px; }
.sidebar-cart-button { display: flex; justify-content: space-between; align-items: center; background: var(--admin-surface-elevated); border: 1px solid var(--admin-border); border-radius: 12px; padding: 10px 12px; }
.sidebar-cart-count { min-width: 22px; height: 22px; border-radius: 999px; background: var(--admin-primary); color: #fff; display: grid; place-items: center; font-size: 12px; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--admin-border);
  background: var(--admin-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-header-left,
.header-right,
.user-info { display: flex; align-items: center; gap: 10px; }

.balance-chip { background: var(--admin-surface-elevated); border: 1px solid var(--admin-border); border-radius: 12px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 8px; }
.balance-label { display: block; font-size: 11px; color: var(--admin-text-muted); }
.balance-value { display: block; font-size: 13px; font-weight: 700; }

.dropdown-container { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px; background: var(--admin-surface); border: 1px solid var(--admin-border); border-radius: 12px; box-shadow: var(--admin-shadow); display: none; overflow: hidden; transform-origin: top right; }
.dropdown-container.is-active .dropdown-menu { display: block; animation: fadeInScale .16s ease; }
.dropdown-header { padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--admin-border); }
.dropdown-item { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.dropdown-item:hover { background: var(--admin-surface-elevated); }
.dropdown-item.danger { color: var(--admin-danger); }

.profile-toggle { border: 1px solid var(--admin-border); background: var(--admin-surface-elevated); border-radius: 12px; width: 40px; height: 40px; display: grid; place-items: center; }
.profile-avatar-ring { width: 28px; height: 28px; border-radius: 8px; background: var(--admin-primary); display: grid; place-items: center; color: #fff; font-weight: 700; position: relative; }
.profile-status-dot { position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--admin-success); border: 2px solid var(--admin-surface); }

.admin-content { padding: 24px; flex: 1; overflow-y: auto; animation: fadeInUp .26s ease; }
.page-transition-out .admin-content { opacity: 0; transform: translateY(8px); }

.card { background: var(--admin-surface); border: 1px solid var(--admin-border); border-radius: 14px; box-shadow: var(--admin-shadow); }
.card__title { padding: 14px 16px; border-bottom: 1px solid var(--admin-border); font-weight: 800; }

/* Product panel shared polish */
.products-grid-modern,
.products-grid { display: grid; gap: 12px; }
.product-panel,
.product-card {
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--admin-surface);
  box-shadow: 0 8px 20px rgba(15,23,42,.04);
}
.product-panel:hover,
.product-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(15,23,42,.12); border-color: var(--admin-primary); }
.product-panel-image,
.product-image,
.product-image-wrapper { background: var(--admin-surface-elevated); }
.product-panel-image img,
.product-image img,
.product-image-wrapper img { width: 100%; height: 100%; object-fit: cover; }

.btn-product-buy,
.btn-buy,
.btn-order {
  border: 1px solid var(--admin-primary);
  background: var(--admin-primary);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.btn-product-buy:hover,
.btn-buy:hover,
.btn-order:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(15,23,42,.2); }
.btn-product-buy:active,
.btn-buy:active,
.btn-order:active { transform: translateY(0); }

.sidebar-overlay { display: none; }

/* News page (public/news.php) */
.news-page{max-width:1200px;margin:0 auto;padding:24px}
.news-header{margin-bottom:16px}
.news-header h1{margin:0 0 6px}
.news-header p{margin:0;color:var(--admin-text-muted)}
.news-featured{display:grid;grid-template-columns:1.2fr 1fr;gap:14px;margin-bottom:16px}
.news-card{background:var(--admin-surface);border:1px solid var(--admin-border);border-radius:14px;overflow:hidden;box-shadow:var(--admin-shadow)}
.news-featured img{width:100%;height:100%;object-fit:cover;min-height:260px}
.news-featured-body{padding:16px}
.news-badge{display:inline-flex;height:24px;padding:0 10px;border-radius:999px;background:var(--admin-surface-elevated);border:1px solid var(--admin-border);align-items:center;font-size:12px;font-weight:700}
.news-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.news-item img{width:100%;height:160px;object-fit:cover;background:var(--admin-surface-elevated)}
.news-item-body{padding:12px}
.news-item-title{margin:0 0 6px;font-size:16px;line-height:1.35}
.news-item-excerpt{margin:0;color:var(--admin-text-muted);font-size:13px;line-height:1.5}
.news-meta{margin-top:10px;display:flex;justify-content:space-between;font-size:12px;color:var(--admin-text-muted)}
.news-btn{height:36px;padding:0 12px;border-radius:10px;border:1px solid var(--admin-border);background:var(--admin-primary);color:#fff;font-weight:700;cursor:pointer}
.news-empty{padding:36px;text-align:center;color:var(--admin-text-muted)}
.news-modal-backdrop{display:none;position:fixed;inset:0;background:rgba(2,6,23,.55);z-index:1000;align-items:center;justify-content:center;padding:16px}
.news-modal-backdrop.active{display:flex}
.news-modal{width:min(920px,100%);max-height:90vh;overflow:auto;background:var(--admin-surface);border:1px solid var(--admin-border);border-radius:14px}
.news-modal-head{padding:14px 16px;border-bottom:1px solid var(--admin-border);display:flex;justify-content:space-between;align-items:center}
.news-modal-body{padding:16px}
.news-modal-body img{width:100%;max-height:380px;object-fit:cover;border-radius:10px;border:1px solid var(--admin-border)}

/* Support page (public/support.php) */
.support-page{max-width:1200px;margin:0 auto;padding:24px;display:flex;flex-direction:column;gap:14px}
.support-card{background:var(--admin-surface);border:1px solid var(--admin-border);border-radius:14px;box-shadow:var(--admin-shadow)}
.support-head{padding:16px;border-bottom:1px solid var(--admin-border)}
.support-head h1{margin:0 0 4px;font-size:24px}
.support-head p{margin:0;color:var(--admin-text-muted)}
.support-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.support-body{padding:16px}
.support-field{display:flex;flex-direction:column;gap:6px;margin-bottom:10px}
.support-field input,
.support-field textarea,
.support-field select{border:1px solid var(--admin-border);background:var(--admin-surface-elevated);height:40px;border-radius:10px;color:var(--admin-text);padding:0 12px}
.support-field textarea{height:120px;padding:10px 12px;resize:vertical}
.support-btn{height:40px;padding:0 14px;border-radius:10px;border:1px solid var(--admin-border);background:var(--admin-surface-elevated);color:var(--admin-text);font-weight:700;cursor:pointer}
.support-btn.support-btn-primary{background:var(--admin-primary);border-color:var(--admin-primary);color:#fff}
.support-alert{padding:12px 14px;border-radius:10px;margin-bottom:10px;font-size:14px}
.support-alert.ok{background:rgba(22,163,74,.12);color:#15803d;border:1px solid rgba(22,163,74,.24)}
.support-alert.err{background:rgba(220,38,38,.12);color:#b91c1c;border:1px solid rgba(220,38,38,.24)}
.support-contact-item{padding:10px;border:1px solid var(--admin-border);border-radius:10px;background:var(--admin-surface-elevated);display:flex;gap:10px;align-items:flex-start;margin-bottom:8px}
.support-contact-item i{width:20px;margin-top:2px;color:var(--admin-primary)}
.support-tickets{padding:16px}
.support-ticket{padding:12px;border:1px solid var(--admin-border);border-radius:10px;background:var(--admin-surface);display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:8px}
.support-ticket-title{font-weight:700}
.support-ticket-meta{font-size:12px;color:var(--admin-text-muted);margin-top:4px}
.support-ticket-status{height:24px;padding:0 10px;border-radius:999px;font-size:12px;font-weight:700;display:inline-flex;align-items:center;white-space:nowrap}
.support-ticket-status.open{background:rgba(245,158,11,.14);color:#b45309}
.support-ticket-status.closed{background:rgba(22,163,74,.14);color:#15803d}
.support-ticket-status.pending{background:rgba(59,130,246,.14);color:#1d4ed8}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
  .admin-sidebar { position: fixed; left: -100%; top: 0; bottom: 0; z-index: 40; transition: left .2s ease; }
  .admin-shell.sidebar-open .admin-sidebar { left: 0; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.45); z-index: 30; }
  .admin-shell.sidebar-open + .sidebar-overlay,
  .admin-shell.sidebar-open .sidebar-overlay { display: block; }
  .balance-chip { display: none; }
  .admin-content { padding: 14px; }
}

.page-fade-enter { animation: pageFadeEnter .28s ease both; }
.page-fade-out { animation: pageFadeOut .18s ease both; }

@keyframes pageFadeEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pageFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}
