/* ====================================================
   AK Mart Price Card Generator - Modern CSS Design System
   Apple Minimalist Aesthetics
   ==================================================== */

/* Primary Palette - Apple Minimalist Light Aesthetics */
:root {
  --bg-main: #f5f5f7;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-secondary: #f0f0f2;
  --border-color: #e5e5ea;
  --border-hover: #d1d1d6;
  
  /* Typography Colors */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #86868b;
  
  /* Accent & System Colors */
  --accent-primary: #0071e3;
  --accent-hover: #0077ed;
  --accent-danger: #ff3b30;
  --accent-success: #34c759;
  --accent-warning: #ff9500;
  --accent-price: #e50914;
  
  /* Shadows & Radius */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout Grid */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 24px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  font-size: 28px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
}

.nav-item:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.user-avatar {
  font-size: 20px;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

.theme-toggle-btn, .logout-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
}

.theme-toggle-btn:hover, .logout-btn:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Main Content Workspace */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* Prevents flex items from overflowing layout */
  width: calc(100% - 260px);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
  min-width: 0;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mobile-toggle-btn {
  display: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.mobile-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.mobile-brand-name {
  display: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.top-title h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.content-body {
  padding: 32px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background-color: var(--border-color);
}

.btn-danger {
  background-color: var(--accent-danger);
  color: #ffffff;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Card Container */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Stats Widgets */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-data {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Form Styling */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Tables (Horizontal Scroll in Mobile View) */
.table-responsive {
  width: 100%;
  max-width: 100%;
  display: block;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  box-sizing: border-box;
  padding-bottom: 6px;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #b0b0b8;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #8e8e93;
}

.data-table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: var(--bg-secondary);
}

/* Badge System */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-active {
  background-color: rgba(52, 199, 89, 0.15);
  color: var(--accent-success);
}

.badge-inactive {
  background-color: rgba(134, 134, 139, 0.15);
  color: var(--text-secondary);
}

.badge-price {
  background-color: rgba(229, 9, 20, 0.1);
  color: var(--accent-price);
}

/* Search & Filter Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-box input {
  padding-left: 38px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Alert Banners */
.alert-container {
  margin-bottom: 20px;
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.alert-success {
  background-color: rgba(52, 199, 89, 0.12);
  border: 1px solid rgba(52, 199, 89, 0.3);
  color: #1b7a34;
}

.alert-error {
  background-color: #fff0f0;
  border: 1px solid #ffcdd2;
  color: #d32f2f;
  font-weight: 600;
}

/* ====================================================
   LIVE PRICE CARD PREVIEW CONTAINER (Reference Spec)
   ==================================================== */
.preview-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.preview-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

/* Single Price Card Visual Render - Reference Store Yellow Card */
.price-card-box {
  width: 100%;
  max-width: 480px;
  background-color: #ffffff;
  border: 2px solid #222222;
  color: #111111;
  border-radius: 4px;
  padding: 16px 28px 16px 20px;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Arial, sans-serif;
  box-sizing: border-box;
}

.card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1.5px solid #222222;
  padding-bottom: 10px;
  margin-bottom: 12px;
  gap: 12px;
}

.card-header-left {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-product-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  color: #111111;
  text-transform: uppercase;
  letter-spacing: -0.2px;
  word-wrap: break-word;
}

.card-qr-box {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-qr-box canvas, .card-qr-box img {
  max-width: 100%;
  max-height: 100%;
}

.card-smart-price-label {
  font-size: 16px;
  font-weight: 800;
  color: #111111;
  margin-top: 6px;
  margin-bottom: 0px;
}

.card-price-display {
  display: flex;
  align-items: baseline;
  margin: 2px 0 8px;
}

.card-currency-symbol {
  font-size: 42px;
  font-weight: 900;
  color: #111111;
  margin-right: 4px;
  line-height: 1;
}

.card-smart-price {
  font-size: 82px;
  font-weight: 900;
  color: #111111;
  line-height: 0.9;
  letter-spacing: -2px;
}

.card-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 4px;
}

.card-mrp {
  font-size: 16px;
  font-weight: 700;
  color: #222222;
}

.card-mrp-val {
  text-decoration: line-through;
}

.card-save-badge {
  font-size: 18px;
  font-weight: 900;
  color: #111111;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card-vertical-text-right {
  position: absolute;
  right: -38px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  font-size: 8.5px;
  font-weight: 700;
  color: #333333;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.card-vertical-text-left {
  position: absolute;
  left: -22px;
  top: 35%;
  transform: translateY(-50%) rotate(-90deg);
  font-size: 8px;
  font-weight: 600;
  color: #555555;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.card-remarks {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #666666;
  font-size: 11px;
  color: #333333;
  line-height: 1.2;
}

/* Hide empty remarks cleanly */
.card-remarks:empty {
  display: none !important;
}

/* Authentication Page Styling */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f7;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  background-color: #ffffff;
  border: 1px solid #e5e5ea;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.auth-logo {
  font-size: 48px;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.auth-form {
  text-align: left;
}

/* Responsive Product Form Grid */
.product-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }
  .main-content {
    margin-left: 220px;
  }
  .product-form-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-toggle-btn {
    display: flex;
  }
  .mobile-brand-name {
    display: block;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: -300px !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 1050 !important;
    background-color: var(--bg-card) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 24px 20px !important;
    box-sizing: border-box !important;
    border-right: 1px solid var(--border-color) !important;
    border-bottom: none !important;
  }

  .sidebar.open {
    transform: translateX(300px) !important;
  }

  .sidebar-brand {
    padding: 0 0 16px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    overflow-y: auto !important;
  }

  .nav-item {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: var(--radius-md);
  }

  .sidebar-footer {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding-top: 16px !important;
    border-top: 1px solid var(--border-color) !important;
  }

  .sidebar-footer .btn {
    width: 100% !important;
  }

  .mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .mobile-drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .top-bar {
    padding: 12px 16px;
    gap: 12px;
  }
  .top-bar h1 {
    font-size: 18px;
  }
  .content-body {
    padding: 16px 12px;
    padding-bottom: 84px !important;
  }
  .action-buttons-wrap {
    flex-wrap: wrap;
    gap: 6px;
  }
  .action-buttons-wrap .btn {
    flex: 1 1 auto;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Native Mobile App Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #8e8e93;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    flex: 1;
    height: 100%;
    transition: color 0.2s ease;
  }

  .mobile-nav-link.active {
    color: var(--accent-primary);
    font-weight: 700;
  }

  .mobile-nav-btn-icon {
    background: var(--accent-primary);
    color: #ffffff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 113, 227, 0.35);
  }

  /* Table Responsive Horizontal Scroll for Mobile & Desktop */
  .table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .mobile-only-card-list {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-product-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.15s ease;
  }

  .mobile-product-card:active {
    transform: scale(0.98);
  }

  .mp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }

  .mp-id {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
  }

  .mp-name {
    font-size: 15px;
    font-weight: 700;
    color: #1c1c1e;
    line-height: 1.3;
  }

  .mp-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9f9fb;
    padding: 10px 12px;
    border-radius: 10px;
  }

  .mp-prices {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .mp-special-price {
    font-size: 18px;
    font-weight: 800;
    color: #d70015;
  }

  .mp-mrp {
    font-size: 13px;
    text-decoration: line-through;
    color: #8e8e93;
  }

  .mp-remarks {
    font-size: 12px;
    color: #636366;
    background: #f2f2f7;
    padding: 6px 10px;
    border-radius: 6px;
  }

  .mp-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
  }

  .mp-actions .btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 8px;
  }
}

.mobile-only-card-list {
  display: none;
}
