/* 
  Стили для мобильного приложения Оптимизатора цен в Израиле
  Современная премиум-эстетика в темных тонах
*/

:root {
  --bg-color: #0c0d12;
  --panel-bg: #161822;
  --panel-border: #242936;
  --text-primary: #ffffff;
  --text-secondary: #9aa1b3;
  --accent-color: #5f3dc4;
  --accent-light: #7048e8;
  --accent-gradient: linear-gradient(135deg, #7048e8 0%, #5c7cfa 100%);
  --success-color: #0ca678;
  --success-bg: rgba(12, 166, 120, 0.15);
  
  --ramilevy-color: #2b8a3e;
  --shufersal-color: #c92a2a;
  --victory-color: #e67e22;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* отключаем синюю подсветку на iOS */
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-size: 14px;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background-color: var(--bg-color);
}

/* HEADER STYLE */
.app-header {
  padding: 18px 16px;
  background-color: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
  z-index: 10;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.user-info h2 {
  font-size: 16px;
  font-weight: 600;
}

.user-info p {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* MAIN CONTENT SCREENS */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px; /* отступ для нижней навигации */
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.section-header h3 {
  font-size: 18px;
  font-weight: 700;
}

/* BUTTONS */
.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-primary);
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.btn-clear {
  background: none;
  border: none;
  color: #fa5252;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

/* PLACEHOLDERS */
.cart-placeholder, .favorites-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 16px;
}

.cart-placeholder .icon, .favorites-placeholder .icon {
  font-size: 48px;
  animation: bounce 2s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.cart-placeholder p, .favorites-placeholder p {
  color: var(--text-secondary);
  font-size: 14px;
}

.favorites-placeholder .subtitle {
  font-size: 11px;
  color: #5c6270;
}

/* CART SCREEN LIST */
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
}

.item-details {
  flex: 1;
  margin-right: 12px;
  min-width: 0;
}

.item-title {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.quantity-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background-color: #242936;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qty-btn:active {
  background-color: #343a40;
}

.qty-val {
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

/* CART FOOTER / SLIDER / OPTIMIZE BUTTON */
.cart-footer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.optimize-control-panel {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
}

.stores-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.count-badge {
  background: var(--accent-gradient);
  color: white;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}

.stores-range-slider {
  width: 100%;
  -webkit-appearance: none;
  background: #242936;
  height: 6px;
  border-radius: 3px;
  outline: none;
}

.stores-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(112, 72, 232, 0.8);
  cursor: pointer;
  border: 2px solid var(--accent-light);
}

.btn-optimize {
  background: var(--accent-gradient);
  color: var(--text-primary);
  border: none;
  border-radius: 16px;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(95, 61, 196, 0.4);
  transition: all 0.2s ease;
  width: 100%;
}

.btn-optimize:active {
  transform: scale(0.98);
  box-shadow: 0 2px 5px rgba(95, 61, 196, 0.2);
}

/* SEARCH SCREEN */
.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 10px 14px;
  gap: 10px;
  margin-bottom: 16px;
  position: relative;
}

.search-icon {
  font-size: 16px;
  color: var(--text-secondary);
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.search-bar input::placeholder {
  color: #5c6270;
}

.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

.btn-scan-barcode {
  background: #242936;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

.btn-scan-barcode:active {
  background-color: #343a40;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* PRODUCT IMAGES AND LAYOUTS */
.product-row {
  display: flex;
  align-items: center;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px 14px;
  justify-content: space-between;
  gap: 10px;
}

.product-content-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0; /* Предотвращает переполнение */
}

.product-img-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background-color: #1c1f2b;
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-right: 12px;
  flex-shrink: 0;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

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

.product-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-meta {
  font-size: 10px;
  color: var(--text-secondary);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-fav {
  background: none;
  border: none;
  font-size: 20px;
  color: #495057;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.btn-fav.active {
  color: #fcc419;
  text-shadow: 0 0 10px rgba(252, 196, 25, 0.4);
}

.btn-add-to-cart {
  background: var(--accent-gradient);
  border: none;
  color: white;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* OPTIMIZATION RESULTS SCREEN */
.results-summary-card {
  background: linear-gradient(135deg, #1a1e2f 0%, #11131c 100%);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.summary-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

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

.cost-value {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.summary-savings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--success-bg);
  border-radius: 12px;
  padding: 10px 14px;
}

.savings-label {
  font-size: 12px;
  color: #12b886;
  font-weight: 600;
}

.savings-value {
  font-size: 14px;
  font-weight: 700;
  color: #12b886;
}

.savings-desc {
  font-size: 10px;
  color: #5c6270;
  margin-top: 10px;
  text-align: center;
}

.result-stores-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.result-store-block {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}

.store-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
}

.store-info-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.store-tag {
  font-size: 10px;
  font-weight: 700;
  color: white;
  border-radius: 6px;
  padding: 2px 6px;
  text-transform: uppercase;
}

.store-tag.ramilevy { background-color: var(--ramilevy-color); }
.store-tag.shufersal { background-color: var(--shufersal-color); }
.store-tag.victory { background-color: var(--victory-color); }
.store-tag.unknown { background-color: #495057; }

.store-name-text {
  font-weight: 600;
  font-size: 13px;
}

.store-sum {
  font-weight: 700;
  font-size: 14px;
}

.store-items-list {
  padding: 8px 16px;
}

.store-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #1c1f2b;
  font-size: 12px;
}

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

.result-item-name {
  flex: 1;
  margin-right: 12px;
  color: #ced4da;
}

.result-item-qty {
  color: var(--text-secondary);
  font-size: 11px;
  margin-right: 16px;
}

.result-item-price {
  font-weight: 500;
}

/* BOTTOM NAVIGATION BAR */
.app-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background-color: var(--panel-bg);
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 10;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  flex: 1;
  height: 100%;
  position: relative;
  transition: color 0.15s ease;
}

.nav-item.active {
  color: var(--accent-light);
}

.nav-icon {
  font-size: 20px;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
}

.cart-badge-count {
  position: absolute;
  top: 6px;
  right: 28%;
  background-color: #fa5252;
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--panel-bg);
}

/* ADMIN PANEL STYLE */
.admin-card {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.admin-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.4;
}

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

.form-group label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.admin-select {
  background-color: #242936;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 100%;
}

.btn-full-width {
  width: 100%;
}

/* DRAG AND DROP ZONE */
.drop-zone {
  border: 2px dashed #3b4252;
  border-radius: 14px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  background-color: #11131c;
  transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-light);
  background-color: rgba(112, 72, 232, 0.05);
}

.drop-zone-icon {
  font-size: 32px;
}

.drop-zone-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* IMPORT PROGRESS */
.import-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.spinner-mini {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin-mini 0.8s linear infinite;
}

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

#admin-status-text {
  font-size: 13px;
  font-weight: 500;
}

.stats-details {
  background-color: #11131c;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 14px;
  font-family: monospace;
  font-size: 11px;
  color: #a5b4fc;
  line-height: 1.5;
}

/* BARCODE SCANNER MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(10, 11, 16, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.scanner-modal {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-slide-in 0.3s ease-out;
}

@keyframes modal-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.scanner-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.scanner-modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close-scanner {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.btn-close-scanner:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.scanner-body {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: #000;
  overflow: hidden;
}

#scanner-reader {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

#scanner-reader video {
  object-fit: cover !important;
  width: 100% !important;
  height: 100% !important;
}

/* Animated red laser scanning line */
.scanner-laser {
  position: absolute;
  top: 15%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ef4444, transparent);
  box-shadow: 0 0 6px #ef4444;
  animation: laser-anim 2s linear infinite;
  z-index: 10;
  pointer-events: none;
}

@keyframes laser-anim {
  0% { top: 15%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 85%; opacity: 0; }
}

.scanner-tip {
  margin: 0;
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  background-color: rgba(0, 0, 0, 0.2);
  line-height: 1.4;
}

