/* =====================
   BLOOM ATELIER – ADMIN
   Admin Portal, Dashboard
   ===================== */

/* ===================== ADMIN PORTAL ===================== */
.admin-header { background: #fff; padding: 20px 40px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.admin-container { display: flex; min-height: calc(100vh - 81px); }
.admin-sidebar { width: 250px; background: #fff; border-right: 1px solid #eee; padding: 20px 0; }
.admin-sidebar a { display: block; padding: 15px 30px; color: #333; text-decoration: none; border-left: 3px solid transparent; transition: all 0.3s ease; }
.admin-sidebar a:hover,
.admin-sidebar a.active { background: #f5f5f5 !important; border-left-color: #c9847c; font-weight: 600; color: #2c1810 !important; }
.admin-main { flex: 1; padding: 40px; }
.admin-card { background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.05); }
.btn-logout { background: #333; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-family: inherit; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.btn-add { background: #5e2d28; color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-add:hover { background: #5e2d28; }

/* Product Table */
.product-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.product-table th,
.product-table td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
.product-table th { background: #fafafa; font-weight: 600; color: #333; }
.product-table tr:hover { background: #fcfcfc; }
.product-img-small { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; background: #eee; }

.actions { display: flex; gap: 10px; }
.btn-edit { color: #0a3a66; background: none; border: none; cursor: pointer; font-weight: 600; }
.btn-delete { color: #6b1810; background: none; border: none; cursor: pointer; font-weight: 600; }

/* Admin Modal */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); overflow-y: auto; }
.modal-content { background: #fff; margin: 5% auto; padding: 30px; width: 50%; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.close { font-size: 24px; cursor: pointer; color: #333; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #333; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea,
.form-group select { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-family: inherit; color: #333; }
.form-group input::placeholder,
.form-group textarea::placeholder { color: #666; }
.form-group textarea { height: 80px; resize: vertical; }
.checkbox-group { display: flex; align-items: center; gap: 10px; }
.checkbox-group input { width: auto; }

.modal-footer { margin-top: 30px; display: flex; justify-content: flex-end; gap: 15px; }
.btn-cancel { background: #eee; color: #222; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; }
.btn-save { background: #333; color: white; border: none; padding: 10px 30px; border-radius: 6px; cursor: pointer; }

.alert { padding: 15px; border-radius: 6px; margin-bottom: 20px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ===================== DASHBOARD ===================== */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }

.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  border: 1px solid #ede4e0;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card.rose::before  { background: linear-gradient(90deg, #c9847c, #e8a09a); }
.stat-card.sage::before  { background: linear-gradient(90deg, #8aaa8a, #a8c8a8); }
.stat-card.lav::before   { background: linear-gradient(90deg, #9b8ab8, #b8a8d8); }
.stat-card.gold::before  { background: linear-gradient(90deg, #c2933a, #d4a84a); }
.stat-card.ink::before   { background: linear-gradient(90deg, #3d2b2b, #6a4e4e); }
.stat-card.teal::before  { background: linear-gradient(90deg, #5aabab, #7ec8c8); }

.stat-label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: #3d2b2b; margin-bottom: 0.5rem; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: #3d2b2b; line-height: 1.1; }
.stat-icon  { position: absolute; right: 1.25rem; top: 1.25rem; font-size: 1.6rem; opacity: 0.3; }

.dash-row { display: grid; gap: 1.5rem; margin-bottom: 1.5rem; }
.dash-row.col-2 { grid-template-columns: 1fr 1fr; }
.dash-row.col-3 { grid-template-columns: 2fr 1fr; }

@media (max-width: 860px) {
  .dash-row.col-2,
  .dash-row.col-3 { grid-template-columns: 1fr; }
}

.panel { background: #fff; border-radius: 16px; border: 1px solid #ede4e0; padding: 1.5rem; overflow: hidden; }
.panel-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #3d2b2b; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; }
.panel-title span { font-size: 1rem; }

.bar-chart { display: flex; align-items: flex-end; gap: 0.75rem; height: 130px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.2rem; height: 100%; }
.bar-fill { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #c9847c, #e8b0a8); transition: height 0.6s cubic-bezier(0.4,0,0.2,1); min-height: 4px; }
.bar-label { font-size: 0.65rem; color: #3d2b2b; text-align: center; white-space: nowrap; }
.bar-val { font-size: 0.65rem; font-weight: 600; color: #3d2b2b; }

.rank-list { list-style: none; }
.rank-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0; border-bottom: 1px solid #ede4e0; }
.rank-item:last-child { border-bottom: none; }
.rank-num  { width: 22px; height: 22px; border-radius: 50%; background: #f5ece9; color: #5e2d28; font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rank-name { flex: 1; font-size: 0.85rem; font-weight: 500; color: #333; }
.rank-meta { font-size: 0.75rem; color: #3d2b2b; }
.rank-revenue { font-size: 0.85rem; font-weight: 600; color: #5e2d28; }

.cat-list { display: flex; flex-direction: column; gap: 0.65rem; }
.cat-item  { display: flex; flex-direction: column; gap: 0.3rem; }
.cat-row   { display: flex; justify-content: space-between; font-size: 0.82rem; color: #333; }
.cat-bar-bg { height: 6px; background: #f5ece9; border-radius: 99px; overflow: hidden; }
.cat-bar-fill { height: 100%; background: linear-gradient(90deg, #c9847c, #e8b0a8); border-radius: 99px; transition: width 0.7s; }

.orders-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.orders-table th { text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #3d2b2b; padding: 0 0.75rem 0.75rem; }
.orders-table td { padding: 0.7rem 0.75rem; border-top: 1px solid #ede4e0; }

.badge { display: inline-block; font-size: 0.65rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 99px; text-transform: capitalize; }
.badge.completed { background: #d4edda; color: #2d6a4f; }
.badge.pending   { background: #fff3cd; color: #664d03; }
.badge.preparing { background: #cce5ff; color: #004085; }

/* Blog Management */
.blog-content-preview { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.color-swatch { display: inline-block; width: 40px; height: 20px; border-radius: 4px; vertical-align: middle; }

#blogForm textarea {
  width: 100%;
  min-height: 200px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}

/* ===================== MANAGE USERS ===================== */
.vip-tag {
  background: #fff0f0;
  color: #5e2d28;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid #ffcccb;
  margin-left: 10px;
}
.user-table th { cursor: pointer; }
.btn-award {
  background: #fff4f0;
  border: 1px solid #c9847c;
  color: #5e2d28;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-award:hover {
  background: #7e3d37;
  color: white;
}
.action-group { display: flex; gap: 5px; flex-wrap: wrap; }

/* Modal Styles */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: white; padding: 25px; border-radius: 12px; max-width: 800px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.modal-title { font-size: 1.25rem; font-weight: 700; color: #3d2b2b; }
.close-modal { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #555; }
.history-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem; }
.history-table th { text-align: left; background: #fafafa; padding: 12px; color: #333; font-weight: 600; }
.history-table td { padding: 12px; border-bottom: 1px solid #f5f5f5; vertical-align: top; }
.source-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; background: #eee; color: #333; }
.source-badge.Loyalty { background: #e8f5e9; color: #2e7d32; }
.source-badge.Wallet { background: #e3f2fd; color: #1565c0; }
.txn-type { font-weight: 600; text-transform: capitalize; color: #333; }
.txn-reason { color: #333; font-style: italic; font-size: 0.85rem; margin-top: 2px; }
.btn-view-history { background: #f0f4f8; border: 1px solid #d1d9e0; color: #1d3557; }
.btn-view-history:hover { background: #d1d9e0; }

/* Reward Modal Styles */
#rewardModal .modal-box { max-width: 450px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #3d2b2b; }
.form-control { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; margin-bottom: 15px; font-family: inherit; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; border-top: 1px solid #eee; padding-top: 15px; }
.btn-submit-reward { background: #5e2d28; color: white; border: none; padding: 10px 20px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.btn-submit-reward:hover { background: #5e2d28; }

/* Toast Notification */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: #333; color: white; padding: 12px 24px;
  border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  opacity: 0; transform: translateY(20px);
  transition: all 0.3s ease; z-index: 2000;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #2e7d32; }
.toast.error { background: #d32f2f; }