/* ===== ADMIN PANEL STYLES ===== */

/* Login Gate */
.admin-login {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  display: flex; align-items: center; justify-content: center; z-index: 99999;
}
.admin-login-card {
  background: #ffffff; border-radius: 20px; padding: 48px 40px;
  max-width: 400px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.admin-login-logo {
  width: 70px; height: 70px; margin: 0 auto 20px; border-radius: 16px;
  background: linear-gradient(135deg, #c9a84c, #a8882e); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: 2.5rem; font-weight: 700;
}
.admin-login-card h1 { font-family: 'Cormorant Garamond', serif; font-size: 2rem; color: #0a0a0a; }
.admin-login-card p { color: #6b6b6b; font-size: 0.9rem; margin-bottom: 28px; }
.admin-login-card .form-group { margin-bottom: 16px; text-align: left; }
.admin-login-card label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: #0a0a0a; }
.admin-login-card input { width: 100%; padding: 14px 16px; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; font-family: inherit; }
.admin-login-hint { display: block; margin-top: 20px; font-size: 0.8rem; color: #a0a0a0; }
.admin-login-hint strong { color: #c9a84c; }

/* Admin Layout */
.admin-app { display: flex; min-height: 100vh; background: #f5f0e8; }
.admin-sidebar {
  width: 250px; min-width: 250px; background: #0a0a0a; color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.admin-brand-logo {
  width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #c9a84c, #a8882e);
  display: flex; align-items: center; justify-content: center; font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem; font-weight: 700;
}
.admin-brand-title { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 600; }
.admin-brand-sub { font-size: 0.7rem; color: #c9a84c; text-transform: uppercase; letter-spacing: 1px; }
.admin-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.admin-nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 8px;
  color: rgba(255,255,255,0.7); font-size: 0.9rem; transition: all 0.3s ease; cursor: pointer;
}
.admin-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-nav a.active { background: #c9a84c; color: #fff; }
.admin-nav a i { width: 20px; text-align: center; }
.admin-sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; gap: 8px; }
.admin-sidebar-footer a, .admin-sidebar-footer button {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 8px;
  color: rgba(255,255,255,0.7); font-size: 0.85rem; transition: all 0.3s ease; background: none; border: none; cursor: pointer; text-align: left;
}
.admin-sidebar-footer a:hover, .admin-sidebar-footer button:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Topbar */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
  background: #fff; padding: 16px 32px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 100;
}
.admin-topbar h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; color: #0a0a0a; }
.admin-topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-badge { padding: 4px 12px; background: #c9a84c; color: #fff; border-radius: 20px; font-size: 0.7rem; font-weight: 700; letter-spacing: 1px; }
.admin-avatar { width: 40px; height: 40px; border-radius: 50%; background: #c9a84c; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.admin-menu-toggle { display: none; background: none; border: none; font-size: 1.3rem; color: #0a0a0a; cursor: pointer; }

/* Content */
.admin-content { padding: 32px; flex: 1; }
.admin-tab { display: none; }
.admin-tab.active { display: block; }

/* Cards */
.admin-card {
  background: #fff; border-radius: 16px; padding: 24px; margin-bottom: 24px;
  border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.admin-card-title { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; color: #0a0a0a; margin-bottom: 20px; }
.admin-card-footer { margin-top: 16px; display: flex; justify-content: center; }

/* Stats */
.admin-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.admin-stat {
  background: #fff; border-radius: 16px; padding: 24px; border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04); position: relative; overflow: hidden;
}
.admin-stat i { font-size: 1.8rem; color: #c9a84c; margin-bottom: 12px; display: block; }
.admin-stat .stat-value { font-family: 'Cormorant Garamond', serif; font-size: 2rem; font-weight: 700; color: #0a0a0a; }
.admin-stat .stat-label { font-size: 0.8rem; color: #6b6b6b; margin-top: 4px; }
.admin-stat .stat-trend { font-size: 0.75rem; margin-top: 8px; font-weight: 600; }
.admin-stat .stat-trend.up { color: #2ecc71; }
.admin-stat .stat-trend.down { color: #e74c3c; }

/* Grid */
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Chart */
.admin-chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding-top: 10px; }
.chart-bar { flex: 1; background: #c9a84c; border-radius: 6px 6px 0 0; position: relative; min-height: 4px; transition: all 0.3s ease; opacity: 0.85; }
.chart-bar:hover { opacity: 1; }
.chart-bar-label { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-size: 0.65rem; color: #6b6b6b; }
.chart-bar-value { position: absolute; top: -22px; left: 0; right: 0; text-align: center; font-size: 0.65rem; color: #0a0a0a; font-weight: 600; }

/* Toolbar */
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-toolbar input, .admin-toolbar select { width: auto; min-width: 220px; padding: 10px 14px; flex: 1; }

/* Table */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 12px 14px; background: #f5f0e8; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6b6b6b; }
.admin-table td { padding: 12px 14px; border-top: 1px solid rgba(0,0,0,0.05); font-size: 0.88rem; color: #0a0a0a; vertical-align: middle; }
.admin-table tr:hover td { background: #faf8f5; }
.admin-table .product-cell { display: flex; align-items: center; gap: 12px; }
.admin-table .product-cell img { width: 40px; height: 50px; object-fit: cover; border-radius: 6px; }
.admin-table .product-cell .pname { font-weight: 600; }
.admin-table .product-cell .pbrand { font-size: 0.75rem; color: #6b6b6b; }

/* Status badges */
.status-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.status-PENDING { background: rgba(243,156,18,0.15); color: #f39c12; }
.status-PROCESSING { background: rgba(52,152,219,0.15); color: #3498db; }
.status-PACKED { background: rgba(155,89,182,0.15); color: #9b59b6; }
.status-SHIPPED { background: rgba(201,168,76,0.15); color: #c9a84c; }
.status-OUT_FOR_DELIVERY { background: rgba(230,126,34,0.15); color: #e67e22; }
.status-DELIVERED { background: rgba(46,204,113,0.15); color: #2ecc71; }
.status-CANCELLED { background: rgba(231,76,60,0.15); color: #e74c3c; }
.status-REFUNDED { background: rgba(108,122,137,0.15); color: #6c7a89; }

/* Action buttons */
.admin-action-btn { padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; border: 1px solid rgba(0,0,0,0.1); background: #fff; cursor: pointer; transition: all 0.3s ease; margin: 2px; }
.admin-action-btn:hover { border-color: #c9a84c; color: #c9a84c; }
.admin-action-btn.view { color: #3498db; border-color: rgba(52,152,219,0.3); }
.admin-action-btn.edit { color: #c9a84c; border-color: rgba(201,168,76,0.3); }
.admin-action-btn.delete { color: #e74c3c; border-color: rgba(231,76,60,0.3); }
.admin-action-btn.delete:hover { background: #e74c3c; color: #fff; }

/* Form */
.admin-modal .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0; }
.admin-modal .form-group { margin-bottom: 16px; }
.admin-modal .form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
.admin-modal .form-group input, .admin-modal .form-group select, .admin-modal .form-group textarea { width: 100%; padding: 12px 14px; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; font-family: inherit; }
.admin-settings-form { max-width: 480px; }
.admin-settings-form .form-group { margin-bottom: 16px; }
.admin-settings-form .form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
.admin-settings-form .form-group input { width: 100%; padding: 12px 14px; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; font-family: inherit; }
.admin-settings-form button { margin-top: 8px; }

/* Modal */
.admin-modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center; z-index: 2000; padding: 24px;
}
.admin-modal.open { display: flex; }
.admin-modal-box { background: #fff; border-radius: 16px; max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto; }
.admin-modal-lg { max-width: 900px; }
.admin-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid rgba(0,0,0,0.08); }
.admin-modal-header h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; color: #0a0a0a; }
.admin-modal-body { padding: 24px; }
.admin-modal-footer { padding: 16px 24px; border-top: 1px solid rgba(0,0,0,0.08); display: flex; justify-content: flex-end; gap: 12px; }

/* Order detail */
.order-detail-info { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.order-detail-field { padding: 12px; background: #f5f0e8; border-radius: 8px; }
.order-detail-field label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6b6b6b; display: block; margin-bottom: 4px; }
.order-detail-field span { font-weight: 600; color: #0a0a0a; }
.order-detail-items { border: 1px solid rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.order-detail-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.order-detail-item:last-child { border-bottom: none; }
.order-detail-item img { width: 48px; height: 60px; object-fit: cover; border-radius: 6px; }
.order-detail-item .od-name { flex: 1; font-weight: 600; }
.order-detail-item .od-qty, .order-detail-item .od-price { color: #6b6b6b; font-size: 0.85rem; }
.order-status-update { display: flex; gap: 12px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.order-status-update select, .order-status-update input { padding: 10px 14px; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; font-family: inherit; }

/* Recent orders */
.recent-order { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.recent-order:last-child { border-bottom: none; }
.recent-order .ro-number { font-weight: 600; font-size: 0.88rem; flex: 1; }
.recent-order .ro-customer { font-size: 0.8rem; color: #6b6b6b; }
.recent-order .ro-total { font-weight: 700; color: #c9a84c; }

/* Stock level bar */
.stock-bar { width: 120px; height: 8px; background: #f0ede6; border-radius: 4px; overflow: hidden; }
.stock-bar-fill { height: 100%; border-radius: 4px; }
.stock-bar-fill.low { background: #e74c3c; }
.stock-bar-fill.mid { background: #f39c12; }
.stock-bar-fill.high { background: #2ecc71; }

/* Empty states */
.admin-empty { text-align: center; padding: 40px 20px; color: #a0a0a0; font-size: 0.9rem; }
.admin-empty i { font-size: 2.5rem; display: block; margin-bottom: 12px; color: #d4d4d4; }

/* Responsive */
@media (max-width: 1024px) {
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-sidebar { position: fixed; left: -250px; transition: left 0.3s ease; z-index: 500; }
  .admin-sidebar.open { left: 0; }
  .admin-menu-toggle { display: block; }
  .admin-content { padding: 20px; }
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .admin-stat { padding: 16px; }
  .admin-stat .stat-value { font-size: 1.5rem; }
  .admin-modal .form-row { grid-template-columns: 1fr; }
  .order-detail-info { grid-template-columns: 1fr; }
  .admin-toolbar input, .admin-toolbar select { min-width: 100%; }
}
