﻿/* =============================================
   MKTRADE — Dashboard Styles
   ============================================= */

body.dashboard-body { background: #f0f4f8; margin: 0; padding: 0; }

.dashboard-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 255px; background: #0a0e1a; color: var(--white);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  overflow-y: auto; transition: var(--transition);
}
.sidebar-head { padding: 22px 18px; border-bottom: 1px solid rgba(255,255,255,0.07); display: flex; align-items: center; gap: 10px; }
.sidebar-head img { height: 40px; }
.sidebar-head .logo-fallback { font-size: 1.3rem; font-weight: 900; }
.sidebar-head .logo-fallback .m { color: var(--blue); }
.sidebar-head .logo-fallback .k { color: var(--red); }
.sidebar-head .logo-fallback .trade { color: rgba(255,255,255,0.6); font-size: 0.7rem; letter-spacing: 2px; }
.sidebar-sub { font-size: 0.72rem; color: rgba(255,255,255,0.35); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 18px 10px; }
.nav-section-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: rgba(255,255,255,0.28); padding: 8px 10px 6px; margin-top: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border-radius: 9px; color: rgba(255,255,255,0.62); font-weight: 500; font-size: 0.88rem;
  transition: var(--transition); cursor: pointer; background: none; border: none;
  width: 100%; text-align: left; font-family: var(--font); margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.sidebar-link.active { background: rgba(21,101,192,0.22); color: #7cb9ff; }
.sidebar-link i { width: 16px; text-align: center; }
.sidebar-link .n-count { margin-left: auto; background: var(--blue); color: var(--white); font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 12px; }
.sidebar-link .n-count.red { background: var(--red); }

.sidebar-foot { padding: 14px 10px; border-top: 1px solid rgba(255,255,255,0.07); }
.sidebar-user { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 9px; background: rgba(255,255,255,0.05); }
.s-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--blue-light)); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; flex-shrink: 0; }
.s-user-info h4 { font-size: 0.85rem; font-weight: 700; color: var(--white); }
.s-user-info p  { font-size: 0.72rem; color: rgba(255,255,255,0.38); }

/* Main */
.dash-main { flex: 1; margin-left: 255px; min-width: 0; }
.dash-topbar {
  background: var(--white); padding: 15px 26px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 10px rgba(0,0,0,0.07); position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle { background: var(--light); border: none; width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; cursor: pointer; display: none; }
.topbar-title { font-size: 1.12rem; font-weight: 800; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search { display: flex; align-items: center; gap: 8px; background: var(--light); border: 2px solid var(--gray-light); border-radius: 9px; padding: 7px 14px; }
.topbar-search input { border: none; background: none; font-family: var(--font); font-size: 0.88rem; color: var(--dark); outline: none; width: 180px; }
.topbar-search i { color: var(--gray); font-size: 0.85rem; }
.topbar-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--light); display: flex; align-items: center; justify-content: center; color: var(--gray); font-size: 1rem; cursor: pointer; border: none; position: relative; transition: var(--transition); }
.topbar-icon:hover { background: var(--blue); color: var(--white); }
.topbar-icon .dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid var(--white); }
.t-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--blue-light)); display: flex; align-items: center; justify-content: center; color: var(--white); font-weight: 800; font-size: 0.85rem; cursor: pointer; }

/* Dashboard Content */
.dash-content { padding: 26px; }
.dash-section { display: none; }
.dash-section.active { display: block; }

/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, var(--dark), #1a2744);
  border-radius: var(--radius-lg); padding: 26px 30px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; color: var(--white);
}
.welcome-banner h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; }
.welcome-banner p  { font-size: 0.85rem; color: rgba(255,255,255,0.58); }

/* Stat Cards */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 22px 20px; box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 16px; transition: var(--transition); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.sc-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.sc-icon.blue  { background: rgba(21,101,192,0.1); color: var(--blue); }
.sc-icon.red   { background: rgba(198,40,40,0.1);  color: var(--red); }
.sc-icon.green { background: rgba(22,163,74,0.1);  color: var(--success); }
.sc-icon.dark  { background: rgba(17,24,39,0.08);  color: var(--dark); }
.sc-info h3 { font-size: 1.7rem; font-weight: 900; color: var(--dark); line-height: 1.1; }
.sc-info p  { font-size: 0.82rem; color: var(--gray); margin-top: 4px; }
.sc-change { margin-top: 7px; font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.sc-change.up   { color: var(--success); }
.sc-change.down { color: var(--red); }

/* Charts */
.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 22px; }
.chart-box { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; }
.chart-box h3 { font-size: 0.95rem; font-weight: 800; color: var(--dark); margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.chart-box h3 i { color: var(--blue); }
.bar-chart { display: flex; align-items: flex-end; justify-content: center; gap: 8px; height: 180px; padding: 8px 0; }
.bar { flex: 1; max-width: 38px; border-radius: 6px 6px 0 0; transition: height 1s ease; cursor: pointer; }
.bar.blue-bar { background: linear-gradient(180deg, var(--blue), rgba(21,101,192,0.35)); }
.bar.red-bar  { background: linear-gradient(180deg, var(--red),  rgba(198,40,40,0.35)); }
.bar:hover { opacity: 0.8; }
.bar-labels { display: flex; justify-content: space-between; padding: 0 4px; margin-top: 8px; font-size: 0.7rem; color: var(--gray); }
.donut-wrap { display: flex; flex-direction: column; align-items: center; }
.donut { width: 130px; height: 130px; border-radius: 50%; background: conic-gradient(var(--blue) 0deg 162deg, var(--red) 162deg 234deg, #fbbf24 234deg 306deg, var(--gray-light) 306deg 360deg); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.donut-hole { width: 85px; height: 85px; border-radius: 50%; background: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-hole h4 { font-size: 1.2rem; font-weight: 900; color: var(--dark); }
.donut-hole p  { font-size: 0.68rem; color: var(--gray); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.dl-item { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--gray); }
.dl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Table */
.table-wrap { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 22px; }
.table-head { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-light); }
.table-head h3 { font-size: 0.95rem; font-weight: 800; color: var(--dark); display: flex; align-items: center; gap: 8px; }
.table-head h3 i { color: var(--blue); }
.table-head a { font-size: 0.82rem; font-weight: 700; color: var(--blue); }
table.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th { padding: 11px 16px; text-align: left; font-size: 0.78rem; font-weight: 700; color: var(--gray); background: var(--light); border-bottom: 1px solid var(--gray-light); text-transform: uppercase; letter-spacing: 0.5px; }
.dash-table td { padding: 13px 16px; font-size: 0.88rem; color: var(--dark); border-bottom: 1px solid var(--gray-light); }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: rgba(21,101,192,0.03); }
.status { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.status.delivered  { background: rgba(22,163,74,0.1);  color: var(--success); }
.status.processing { background: rgba(21,101,192,0.1); color: var(--blue); }
.status.pending    { background: rgba(251,191,36,0.15); color: #b45309; }
.status.cancelled  { background: rgba(198,40,40,0.1);  color: var(--red); }

/* Product grid in dashboard */
.dash-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px,1fr)); gap: 16px; }
.dp-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: var(--transition); }
.dp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.dp-img { height: 110px; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.dp-img.blue-bg { background: linear-gradient(135deg, #e3f2fd, #bbdefb); color: var(--blue); }
.dp-img.red-bg  { background: linear-gradient(135deg, #ffebee, #ffcdd2); color: var(--red); }
.dp-body { padding: 12px 14px; }
.dp-body h4 { font-size: 0.85rem; font-weight: 700; color: var(--dark); margin-bottom: 6px; }
.dp-foot { display: flex; justify-content: space-between; align-items: center; }
.dp-price { font-size: 0.92rem; font-weight: 900; color: var(--blue); }
.dp-stock { font-size: 0.72rem; color: var(--gray); }

/* Settings form */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-box { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; }
.settings-box h3 { font-size: 0.95rem; font-weight: 800; color: var(--dark); margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.settings-box h3 i { color: var(--blue); }
.sf { margin-bottom: 16px; }
.sf label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.sf input, .sf select { width: 100%; padding: 9px 12px; border: 2px solid var(--gray-light); border-radius: 8px; font-family: var(--font); font-size: 0.88rem; color: var(--dark); }
.sf input:focus { outline: none; border-color: var(--blue); }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 9999; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--white); border-radius: var(--radius-lg); padding: 32px; width: 90%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal-head h3 { font-size: 1.1rem; font-weight: 800; color: var(--dark); }
.modal-close { width: 34px; height: 34px; border-radius: 50%; background: var(--light); border: none; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; color: var(--gray); transition: var(--transition); }
.modal-close:hover { background: var(--red); color: var(--white); }
.mf { margin-bottom: 16px; }
.mf label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.mf input, .mf select, .mf textarea { width: 100%; padding: 10px 13px; border: 2px solid var(--gray-light); border-radius: 8px; font-family: var(--font); font-size: 0.88rem; }
.mf input:focus, .mf textarea:focus { outline: none; border-color: var(--blue); }
.mf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Responsive dashboard */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .dash-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .chart-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-cards { grid-template-columns: 1fr 1fr; }
  .dash-content { padding: 14px; }
  .topbar-search { display: none; }
}
