/* ============================================
   AERONEX | DJI Enterprise - Inventory System
   Public Query Page Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --black: #0d0d0d;
  --dark-gray: #1a1a1a;
  --mid-gray: #3a3a3a;
  --light-gray: #8a8a8a;
  --border-gray: #e0e0e0;
  --bg-light: #f7f7f7;
  --bg-white: #ffffff;
  --accent: #0d0d0d;
  --success-green: #16a34a;
  --danger-red: #dc2626;
  --warning-orange: #ea580c;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.13);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--black);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Header ---- */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-gray);
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-logo {
  display: flex;
  align-items: center;
}

.header-logo img {
  height: 36px;
  width: auto;
  display: block;
}

.header-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--light-gray);
  text-transform: uppercase;
  border: 1px solid var(--border-gray);
  padding: 4px 10px;
  border-radius: 20px;
}

.admin-entry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mid-gray);
  text-decoration: none;
  border: 1.5px solid var(--border-gray);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  transition: all var(--transition);
}

.admin-entry-btn:hover {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}

/* ---- Hero Section ---- */
.hero-section {
  background: var(--black);
  color: #fff;
  padding: 56px 24px 48px;
  text-align: center;
}

.hero-section h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.hero-section p {
  font-size: 15px;
  color: rgba(255,255,255,0.65);
  max-width: 480px;
  margin: 0 auto;
  font-weight: 400;
}

/* ---- Main Content ---- */
.main-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---- Search Card ---- */
.search-card {
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
}

.search-card h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-gray);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-card h2 .icon {
  width: 28px;
  height: 28px;
  background: var(--black);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--mid-gray);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.form-label span.req {
  color: var(--danger-red);
  margin-left: 3px;
}

.search-input-wrapper {
  position: relative;
}

.search-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--light-gray);
  pointer-events: none;
  font-size: 15px;
}

.form-input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1.5px solid var(--border-gray);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--black);
  background: var(--bg-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(13,13,13,0.08);
}

.form-input::placeholder { color: #bbb; }

/* ---- Autocomplete Dropdown ---- */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1.5px solid var(--border-gray);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.autocomplete-dropdown.active { display: block; }

.autocomplete-item {
  padding: 11px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background var(--transition);
}

.autocomplete-item:last-child { border-bottom: none; }

.autocomplete-item:hover,
.autocomplete-item.highlighted { background: var(--bg-light); }

.autocomplete-item .item-model {
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-item .item-ean {
  font-size: 11px;
  color: var(--light-gray);
  margin-top: 2px;
  font-family: 'Courier New', monospace;
}

.autocomplete-no-result {
  padding: 16px;
  text-align: center;
  color: var(--light-gray);
  font-size: 13px;
}

/* ---- Selected Product Tag ---- */
.selected-product-tag {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--bg-light);
  border: 1.5px solid var(--border-gray);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  margin-top: 6px;
}

.selected-product-tag.visible { display: flex; }

.selected-product-tag .tag-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-product-tag .tag-ean {
  font-size: 11px;
  color: var(--light-gray);
  font-family: 'Courier New', monospace;
}

.tag-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--light-gray);
  font-size: 16px;
  padding: 2px;
  line-height: 1;
  border-radius: 50%;
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
}

.tag-clear-btn:hover { color: var(--danger-red); background: #fee2e2; }

/* ---- Warehouse Radio ---- */
.warehouse-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.warehouse-radio {
  flex: 1;
  min-width: 120px;
}

.warehouse-radio input[type="radio"] { display: none; }

.warehouse-radio label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-gray);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--mid-gray);
  background: var(--bg-white);
  transition: all var(--transition);
  text-align: center;
  user-select: none;
}

.warehouse-radio input[type="radio"]:checked + label {
  border-color: var(--black);
  background: var(--black);
  color: #fff;
}

.warehouse-radio label:hover {
  border-color: var(--mid-gray);
  background: var(--bg-light);
}

.warehouse-radio input[type="radio"]:checked + label:hover {
  background: var(--dark-gray);
}

/* ---- Query Button ---- */
.btn-query {
  width: 100%;
  padding: 14px;
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

.btn-query:hover { background: var(--dark-gray); transform: translateY(-1px); }
.btn-query:active { transform: translateY(0); }
.btn-query:disabled { background: #ccc; cursor: not-allowed; transform: none; }

/* ---- Loading Spinner ---- */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

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

/* ---- Results Section ---- */
.results-section {
  display: none;
}

.results-section.visible { display: block; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.results-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--mid-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-subtitle {
  font-size: 12px;
  color: var(--light-gray);
}

/* ---- Product Info Card ---- */
.product-info-card {
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.product-info-card .product-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 5px;
  line-height: 1.4;
}

.product-info-card .product-ean {
  font-size: 12px;
  color: var(--light-gray);
  font-family: 'Courier New', monospace;
}

/* ---- Inventory Result Cards ---- */
.inventory-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.inventory-card {
  background: var(--bg-white);
  border: 1px solid var(--border-gray);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

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

.inventory-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.inventory-card.in-stock::before { background: var(--success-green); }
.inventory-card.out-of-stock::before { background: var(--danger-red); }

.inventory-card .warehouse-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--light-gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.warehouse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.warehouse-dot.dubai { background: #2563eb; }
.warehouse-dot.saudi { background: #16a34a; }

.inventory-card .qty-display {
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.inventory-card.in-stock .qty-display { color: var(--black); }
.inventory-card.out-of-stock .qty-display {
  font-size: 22px;
  color: var(--danger-red);
  font-weight: 700;
}

.inventory-card .qty-label {
  font-size: 12px;
  color: var(--light-gray);
  font-weight: 400;
}

.inventory-card.in-stock .qty-label { color: var(--success-green); font-weight: 500; }
.inventory-card.out-of-stock .qty-label { color: var(--danger-red); }

/* ---- Error / Warning Message ---- */
.alert-box {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
}

.alert-box.warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: var(--warning-orange);
}

.alert-box.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-red);
}

.alert-box.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--bg-white);
  border-top: 1px solid var(--border-gray);
  padding: 20px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--light-gray);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .site-header { padding: 0 16px; }
  .hero-section { padding: 36px 16px 32px; }
  .main-content { padding: 24px 16px 60px; }
  .search-card { padding: 22px 18px; }
  .warehouse-options { flex-direction: column; }
  .warehouse-radio { min-width: unset; }
  .inventory-results { grid-template-columns: 1fr; }
}
