/**
 * RIMISH COLLECTIONS - Luxury Admin Portal Stylesheet
 * Brand colors: Charcoal (#111), Gold Accent (#b8860b / #c5a880), Crisp White (#fff), Soft Gray (#f8f9fa)
 */

:root {
  --admin-bg: #f5f6fa;
  --sidebar-bg: #111111;
  --sidebar-hover: #1f1f1f;
  --sidebar-active: #222222;
  --sidebar-text: #a0a0a0;
  --sidebar-text-active: #ffffff;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --border-dark: #262626;
  --text-primary: #1f2937;
  --text-muted: #6b7280;
  --gold-primary: #c5a880;
  --gold-dark: #b8860b;
  --gold-light: #faf5ee;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;
  --color-whatsapp: #25D366;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--admin-bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid var(--border-dark);
  transition: all 0.3s ease;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-dark);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 4px;
  background: #222;
}

.sidebar-brand-title {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-title .brand-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 1px;
  font-weight: 700;
  color: #ffffff;
}

.sidebar-brand-title .brand-subtitle {
  font-size: 0.72rem;
  color: var(--gold-primary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.sidebar-menu {
  list-style: none;
  padding: 20px 12px;
  flex: 1;
  overflow-y: auto;
}

.menu-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #666;
  padding: 12px 14px 6px;
  font-weight: 700;
}

.menu-item {
  margin-bottom: 4px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.menu-link:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.menu-link.active {
  background-color: var(--sidebar-active);
  color: #ffffff;
  border-left-color: var(--gold-primary);
}

.menu-link svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  opacity: 0.85;
}

.menu-badge {
  margin-left: auto;
  background-color: var(--gold-dark);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-dark);
}

.btn-view-store {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: #1f1f1f;
  color: #fff;
  text-decoration: none;
  border: 1px solid #333;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-view-store:hover {
  background: var(--gold-dark);
  color: #fff;
  border-color: var(--gold-dark);
}

/* Main Content Area */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Navbar */
.admin-header {
  height: 68px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--admin-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 7px 16px;
  width: 320px;
  gap: 8px;
}

.header-search input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.85rem;
  font-family: inherit;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #ecfdf5;
  color: #065f46;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #a7f3d0;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sidebar-bg);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.admin-details {
  display: flex;
  flex-direction: column;
}

.admin-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.admin-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Page Body */
.admin-body {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--sidebar-bg);
  color: #fff;
  border-color: var(--sidebar-bg);
}

.btn-primary:hover {
  background-color: #262626;
  border-color: #262626;
}

.btn-gold {
  background-color: var(--gold-dark);
  color: #fff;
  border-color: var(--gold-dark);
}

.btn-gold:hover {
  background-color: #a07409;
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--admin-bg);
}

.btn-whatsapp {
  background-color: var(--color-whatsapp);
  color: #fff;
}

.btn-whatsapp:hover {
  background-color: #1eb857;
}

.btn-danger {
  background-color: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-info .kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-info .kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.kpi-info .kpi-growth {
  font-size: 0.72rem;
  color: var(--color-success);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon.revenue { background: #fef3c7; color: #b45309; }
.kpi-icon.orders { background: #dbeafe; color: #1d4ed8; }
.kpi-icon.pending { background: #fee2e2; color: #b91c1c; }
.kpi-icon.products { background: #f3e8ff; color: #7e22ce; }

/* Content Cards & Tables */
.content-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-bar {
  padding: 16px 24px;
  background: #fafafa;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-select, .filter-input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: #fff;
  font-family: inherit;
  outline: none;
}

.filter-select:focus, .filter-input:focus {
  border-color: #111;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.admin-table th {
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background-color: #fbfbfb;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.product-thumb {
  width: 44px;
  height: 52px;
  border-radius: 4px;
  object-fit: cover;
  background: #f1f1f1;
  border: 1px solid var(--border-color);
}

.product-meta .product-title {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.product-meta .product-sku {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.in-stock { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.status-badge.low-stock { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-badge.out-of-stock { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.processing { background: #dbeafe; color: #1e40af; }
.status-badge.shipped { background: #e0e7ff; color: #4338ca; }
.status-badge.delivered { background: #ecfdf5; color: #065f46; }
.status-badge.cancelled { background: #fee2e2; color: #991b1b; }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #ffffff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
}

.btn-close-modal {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 4px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #fafafa;
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: #111;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Chart Styles */
.chart-container {
  padding: 20px 24px;
  height: 240px;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  border-bottom: 1px solid var(--border-color);
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 8px;
}

.chart-bar {
  width: 100%;
  max-width: 42px;
  background: linear-gradient(180deg, var(--gold-primary), #a68456);
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
  position: relative;
  cursor: pointer;
}

.chart-bar:hover {
  background: linear-gradient(180deg, var(--gold-dark), #8c6307);
}

.chart-bar-val {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.chart-bar-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Invoice Print Layout */
@media print {
  body * {
    visibility: hidden;
  }
  #printable-invoice, #printable-invoice * {
    visibility: visible;
  }
  #printable-invoice {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    background: #fff !important;
  }
  .no-print {
    display: none !important;
  }
}

/* Responsive */
@media (max-width: 992px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .mobile-toggle {
    display: block;
  }
}



/* --- Media Library & Dropzone --- */
.media-dropzone {
  border: 2px dashed #d1d5db;
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.media-dropzone:hover, .media-dropzone.dragover {
  border-color: var(--gold-dark);
  background: var(--gold-light);
}

.media-dropzone svg {
  color: var(--gold-dark);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.media-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.media-thumb-wrap {
  width: 100%;
  height: 180px;
  background: #f4f4f4;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.media-card:hover .media-thumb-img {
  transform: scale(1.05);
}

.media-size-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  backdrop-filter: blur(2px);
}

.media-card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.media-filename {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.media-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.media-actions {
  display: flex;
  gap: 6px;
}

/* Toast Notification */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111111;
  color: #ffffff;
  border-left: 4px solid var(--gold-dark);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 99999;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Media Picker Modal */
.media-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 10px;
}

.media-picker-item {
  height: 120px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.media-picker-item:hover {
  border-color: var(--gold-dark);
  transform: scale(1.02);
}

.media-picker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-picker-item.selected {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 2px var(--gold-dark);
}

/* Policy Card Styles */
.policy-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.policy-card:hover {
  border-color: var(--gold-dark);
  box-shadow: var(--shadow-md);
}

.policy-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.policy-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--gold-light);
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.policy-details h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.policy-details p {
  font-size: 0.8rem;
  color: var(--text-muted);
}
