:root {
  --bg-main: #f9fafb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent: #0f172a;
  --accent-text: #ffffff;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 8px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Menlo", "Monaco", monospace;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 1200px;
  height: 100vh;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Base minimalist panels */
.glass-nav, .glass-sidebar, .main-panel, .glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* Header */
.glass-nav {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo i {
  color: var(--text-primary);
  width: 20px;
  height: 20px;
}

.logo h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo h1 span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: 8px;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-main);
}

/* Layout */
.content-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  flex-grow: 1;
  min-height: 0;
}

/* Sidebar */
.glass-sidebar {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-spacer {
  flex-grow: 1;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
}

.step:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.step.active {
  color: var(--accent);
  background: var(--bg-main);
  border-color: var(--border);
  cursor: default;
}

.step-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.6;
}

.step.active .step-number {
  opacity: 1;
}

.step-info h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.step-info p {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Accordion (API Config) */
.config-accordion {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: auto;
}

.config-accordion summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  padding: 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.config-accordion summary::-webkit-details-marker {
  display: none;
}

.config-accordion summary:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.config-accordion summary i {
  width: 16px;
  height: 16px;
}

.config-content {
  padding: 16px 8px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-group label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.config-group input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  transition: border-color 0.2s;
}

.config-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.btn-small {
  margin-top: 8px;
  padding: 8px;
  font-size: 0.75rem;
  justify-content: center;
}

/* Main Panel */
.main-panel {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.view {
  display: none;
  flex-direction: column;
  padding: 32px;
  height: 100%;
}

.view.active {
  display: flex;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Inputs and Search */
.search-bar {
  position: relative;
  margin-bottom: 24px;
}

.search-bar i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 18px;
  height: 18px;
}

.search-bar input {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 14px 44px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.05);
}

/* Lists and Grids */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  overflow-y: auto;
  align-content: flex-start;
  flex-grow: 1;
}

.store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.store-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.store-card.selected {
  border-color: var(--accent);
  border-width: 2px;
  background: var(--bg-main);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.05);
}

.store-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.store-card p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* File Upload */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.upload-card {
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: var(--radius);
  background: var(--bg-main);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.card-header i {
  width: 18px;
  color: var(--text-secondary);
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.drop-zone {
  height: 160px;
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.drop-zone:hover {
  border-color: var(--accent);
  background: #f8fafc;
}

.drop-zone-content {
  text-align: center;
  z-index: 1;
}

.drop-zone-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.preview-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  z-index: 2;
}

.preview-area:empty {
  display: none;
}

.preview-area img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
}

/* Tables */
.product-table-wrapper {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 14px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  background: var(--bg-main);
  z-index: 10;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.product-link {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.product-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.product-link::after {
  content: "↗";
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.product-link:hover::after {
  opacity: 0.6;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-main);
}

/* Checkboxes */
input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-hover);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  display: grid;
  place-content: center;
  transition: all 0.2s;
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em var(--accent-text);
  background-color: var(--accent-text);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}

/* Footer / Actions */
.view-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Buttons */
button {
  background: transparent;
  border: 1px solid transparent;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-icon {
  padding: 8px;
  color: var(--text-secondary);
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-main);
}

.btn-primary, .btn-action, .btn-action-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover, .btn-action:hover, .btn-action-primary:hover {
  background: #334155;
  transform: translateY(-1px);
}

.btn-secondary, .btn-back {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover, .btn-back:hover {
  border-color: var(--border-hover);
  background: var(--bg-main);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Progress Overlay */
.overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.progress-card {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 500px;
  padding: 32px;
  text-align: center;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.progress-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.progress-bar-container {
  height: 6px;
  background: var(--bg-main);
  margin: 24px 0;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

#progress-status {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.log-console {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 16px;
  margin-top: 20px;
  height: 160px;
  color: var(--text-secondary);
  text-align: left;
  overflow-y: auto;
}

.log-success { color: var(--success); font-weight: 500; }
.log-error { color: var(--danger); font-weight: 500; }

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Alert Box */
.alert-box {
  display: none;
}
