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

:root {
  --primary: #fed557;
  --primary-dark: #e6b800;
  --primary-light: #fff8dc;
  --text-dark: #333;
  --text-medium: #666;
  --text-light: #999;
  --border: #e5e5e5;
  --bg-light: #fafafa;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8f9fa;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Unauthorized State */
.unauthorized {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
}

.unauthorized-message {
  font-size: 1.25rem;
    color: var(--text-medium);
  text-align: center;
  padding: 2rem;
  background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Loading State */
.loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  gap: 1rem;
  color: var(--text-medium);
}

.loading-spinner {
  width: 44px;
    height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* App Container */
.app-container {
  display: flex;
  height: 100vh;
  gap: 1rem;
  padding: 1rem;
  background: white;
}

/* Control Panel (Left) */
.control-panel {
  width: 340px;
    min-width: 300px;
    max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: white;
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border);
}

/* Search Section */
.search-section {
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 0.7rem 1rem;
    font-size: 0.95rem;
    border: 2px solid var(--border);
    border-radius: 8px;
  outline: none;
  transition: all 0.2s;
    background: var(--bg-light);
}

.search-input:focus {
  border-color: var(--primary);
    background: white;
}

/* Select All Section */
.select-all-section {
  flex-shrink: 0;
  padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
    color: var(--text-dark);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-dark);
}

/* Bulk Qty Section */
.bulk-qty-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
    background: var(--primary-light);
    border-radius: 8px;
    border: 1px solid var(--primary);
}

.bulk-qty-label {
  font-size: 0.85rem;
    color: var(--text-dark);
    font-weight: 500;
}

.bulk-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.bulk-qty-btn {
  width: 32px;
  height: 32px;
  border: none;
    background: var(--primary);
    border-radius: 6px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--text-dark);
}

.bulk-qty-btn:hover {
  background: var(--primary-dark);
}

.bulk-qty-btn:active {
  transform: scale(0.95);
}

.bulk-qty-input {
  width: 48px;
  height: 32px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
    border: 2px solid var(--primary);
    border-radius: 6px;
  outline: none;
  background: white;
}

.bulk-qty-input:focus {
  border-color: var(--primary-dark);
}

/* Items List */
.items-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
    padding-right: 0.25rem;
  }
  
  .items-list::-webkit-scrollbar {
    width: 6px;
  }
  
  .items-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
  }
  
  .items-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }
  
  .items-list::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-light);
    border-radius: 8px;
    border: 2px solid transparent;
  transition: all 0.15s;
}

.item-row:hover {
  background: #f5f5f5;
    border-color: var(--border);
}

.item-row.selected {
  background: var(--primary-light);
    border-color: var(--primary);
}

.item-checkbox {
  flex-shrink: 0;
}

.item-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-dark);
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-code {
  font-weight: 600;
  color: var(--primary-dark);
    font-size: 0.85rem;
}

.item-name {
  color: var(--text-dark);
    font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-nickname {
  color: var(--text-medium);
    font-size: 0.8rem;
}

.item-qty {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.original-qty {
  font-size: 0.7rem;
    color: var(--text-light);
    margin-right: 0.15rem;
}

.item-qty label {
  font-size: 0.8rem;
    color: var(--text-medium);
}

.qty-input {
  width: 46px;
    padding: 0.35rem;
    font-size: 0.85rem;
  text-align: center;
  border: 1px solid var(--border);
    border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.qty-input:focus {
  border-color: var(--primary);
}

/* Empty Items State */
.items-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
    font-size: 0.9rem;
}

/* Summary Section */
.summary-section {
  flex-shrink: 0;
  padding: 0.75rem;
    border-radius: 8px;
    background: var(--bg-light);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.summary-row span:first-child {
  color: var(--text-medium);
}

.summary-row span:last-child {
  font-weight: 600;
  color: var(--text-dark);
}

/* Preview Panel (Right) */
.preview-panel {
  flex: 1;
  background: #f0f0f0;
    border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-panel iframe {
  width: 100%;
  height: 100%;
  border: none;
}
