* { box-sizing: border-box; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
:root { --bg:#0b1220; --card:#121a2b; --line:#223; --muted:#a3b3ff; }

html, body { height: 100%; margin: 0; padding: 0; }
body { background: var(--bg); color: #e6edf3; overflow-x: hidden; }

/* Mobile-first responsive design */
#app {
  width: 100%;
  min-height: 100vh;
}

/* Navigation - Mobile optimized */
.nav { 
  position: sticky; 
  top: 0; 
  z-index: 100; 
  display: flex; 
  gap: 2px; 
  padding: 8px; 
  background: rgba(11,18,32,.95); 
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav-btn { 
  flex: 1; 
  padding: 12px 6px; 
  border-radius: 8px; 
  border: 1px solid #2a3a5a; 
  background: #1f2b46; 
  color: #e6edf3; 
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

.nav-btn.active { 
  background: #2a4d8f; 
  border-color: #3e6ef3;
}

.nav-btn:active {
  transform: scale(0.98);
}

/* Cards - Kompakt */
.card { 
  width: 100%; 
  background: var(--card); 
  border-top: 1px solid var(--line);
  padding: 12px; 
  min-height: calc(100vh - 55px);
}

.mini-card { 
  background: #0f1729; 
  border: 1px solid #1b2336; 
  border-radius: 10px; 
  padding: 12px; 
  margin-top: 12px; 
}

.hidden { display: none !important; }

/* Typography - Kompakt */
h2 { margin: 0 0 12px; font-size: 20px; font-weight: 600; }
h3 { margin: 0 0 10px; font-size: 16px; }
h4 { margin: 0 0 6px; font-size: 14px; opacity: 0.9; }

/* Layout helpers - Kompakt */
.row { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  flex-wrap: wrap; 
  margin-bottom: 4px;
}

.wrap { 
  flex-wrap: wrap; 
  gap: 12px;
  align-items: stretch;
}
.space-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* Form elements - Kompakt ama touch friendly */
input, select { 
  padding: 12px; 
  margin: 6px 0; 
  border-radius: 10px; 
  border: 1px solid #2a3a5a; 
  background: #0f1729; 
  color: #e6edf3; 
  width: 100%; 
  font-size: 16px; /* Prevents iOS zoom */
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus {
  outline: 2px solid #3e6ef3;
  border-color: #3e6ef3;
}

button { 
  padding: 12px 16px; 
  border-radius: 10px; 
  border: 1px solid #2a3a5a; 
  background: #1f2b46; 
  color: #e6edf3; 
  cursor: pointer; 
  font-size: 15px;
  min-height: 44px; /* Touch target */
  font-weight: 500;
  touch-action: manipulation;
}

button:active { 
  transform: scale(0.96); 
}

button.secondary { 
  background: #20314f; 
  border-color: #3a4a6a;
}

button.danger { 
  background: #4b1f2b; 
  border-color: #733245; 
}

/* Messages and labels - Kompakt */
.msg { 
  min-height: 20px; 
  color: var(--muted); 
  text-align: center; 
  padding: 6px;
  font-size: 14px;
}

.panel { margin: 12px 0; }

label { 
  font-size: 14px; 
  font-weight: 500;
  color: #b3c0d1;
  margin-bottom: 4px;
}

/* Search Container */
.search-container {
  position: relative;
  margin: 12px 0;
  width: 100%;
}

.search-input {
  width: 100% !important;
  padding: 12px 40px 12px 16px !important;
  font-size: 16px !important;
  border-radius: 12px !important;
  border: 2px solid #2a3a5a !important;
  background: #1a2332 !important;
  color: #e6edf3 !important;
  transition: all 0.2s ease;
  font-weight: 400;
}

.search-input::placeholder {
  color: #6b7785 !important;
  font-style: normal;
}

.search-input:focus {
  border-color: #3e6ef3 !important;
  box-shadow: 0 0 0 3px rgba(62, 110, 243, 0.1) !important;
  outline: none;
}

.clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  color: #a3b3ff !important;
  padding: 4px 8px !important;
  min-height: auto !important;
  font-size: 18px !important;
  cursor: pointer;
  border-radius: 50% !important;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.clear-search:hover {
  opacity: 1;
  background: rgba(163, 179, 255, 0.1) !important;
}

.chip { 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
  padding: 8px 12px; 
  border: 1px solid #2a3a5a; 
  border-radius: 16px; 
  background: #182344; 
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip input[type="radio"]:checked + span,
.chip:has(input:checked) {
  background: #2a4d8f !important;
  border-color: #3e6ef3 !important;
  color: #ffffff !important;
}

.chip input[type="radio"] {
  margin: 0;
  width: auto;
  accent-color: #3e6ef3;
}

/* JavaScript ile checked state'i handle edeceğiz */
.chip.selected {
  background: #2a4d8f;
  border-color: #3e6ef3;
  color: #ffffff;
}

/* Mode ve Warehouse Selector - TEK SATIR YAN YANA */
.controls-row {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  margin-bottom: 12px !important;
  flex-wrap: nowrap !important;
}

.mode-selector {
  display: flex !important;
  gap: 6px !important;
}

.warehouse-selector {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.warehouse-selector label {
  font-size: 13px !important;
  margin-bottom: 0 !important;
}

.warehouse-selector select {
  margin: 0 !important;
  width: 140px !important;
}

/* Tables - Kompakt */
.table-wrap { 
  overflow-x: auto; 
  border: 1px solid var(--line); 
  border-radius: 10px; 
  margin: 12px 0;
  -webkit-overflow-scrolling: touch;
}

table { 
  width: 100%; 
  border-collapse: collapse; 
  font-size: 13px; 
}

th, td { 
  padding: 8px 6px; 
  border-bottom: 1px solid #1b2336; 
  text-align: left; 
  vertical-align: top; 
}

th { 
  background: #0f1729; 
  position: sticky; 
  top: 0; 
  font-size: 12px;
  font-weight: 600;
  color: #a3b3ff;
}

/* Camera Container - Simple and clean */
.camera-container {
  position: relative;
  width: 100%;
  height: 60vh;
  max-height: 400px;
  margin: 20px 0;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* Simple scanning overlay */
.scan-frame {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

/* Darkened edges to focus on center */
.scan-frame::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(to bottom, rgba(0,0,0,0.5) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.5) 75%),
    linear-gradient(to right, rgba(0,0,0,0.5) 20%, transparent 20%, transparent 80%, rgba(0,0,0,0.5) 80%);
}

/* Corner guides */
.scan-corners {
  position: absolute;
  top: 25%;
  left: 20%;
  right: 20%;
  bottom: 25%;
}

.corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid #00ff88;
}

.corner.top-left {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
  border-radius: 6px 0 0 0;
}

.corner.top-right {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
  border-radius: 0 6px 0 0;
}

.corner.bottom-left {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
  border-radius: 0 0 0 6px;
}

.corner.bottom-right {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
  border-radius: 0 0 6px 0;
}

/* Simple scanning line */
.scan-line {
  position: absolute;
  top: 25%;
  left: 20%;
  right: 20%;
  bottom: 25%;
  overflow: hidden;
}

.scan-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ff88, transparent);
  animation: scanning 2s ease-in-out infinite;
  box-shadow: 0 0 4px #00ff88;
}

@keyframes scanning {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(calc(30vh - 20px));
    opacity: 1;
  }
}

/* Success feedback */
.scan-frame.success .corner {
  border-color: #00ff88;
  animation: successFlash 0.4s ease-out;
}

@keyframes successFlash {
  0% { 
    border-color: #00ff88;
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.8);
  }
  50% {
    border-color: #00ff88;
    box-shadow: 0 0 0 8px rgba(0, 255, 136, 0.2);
  }
  100% {
    border-color: #00ff88;
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
  }
}

/* Desktop/Tablet responsive */
@media (min-width: 768px) {
  .card {
    max-width: 900px;
    margin: 16px auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    min-height: auto;
  }
  
  .camera-container {
    max-width: 600px;
    margin: 20px auto;
  }
  
  .nav {
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
    border-radius: 0 0 12px 12px;
  }
  
  .nav-btn {
    max-width: 150px;
  }
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 600px) {
  .camera-container {
    height: 70vh;
  }
}
.scan-frame::after {
  content: '';
  position: absolute; inset: 10% 8%;
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 12px;
  pointer-events: none;
}

/* Mobile-first */
@media (max-width: 640px) {
  .card { max-width: 100%; margin: 0; border-radius: 0; min-height: calc(100vh - 56px); }
  .nav { gap: 6px; }
  button, input, select { font-size: 16px; } /* prevent iOS zoom on focus */
  .video { height: 62vh; border-radius: 10px; }
}
