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

:root {
  --primary:       #ff5722;
  --primary-dark:  #e64a19;
  --primary-glow:  rgba(255, 87, 34, 0.28);
  --primary-soft:  #fff4f1;
  --blue:          #1a237e;
  --text:          #1e1e2d;
  --text-sub:      #6b7280;
  --bg:            #f4f6fb;
  --white:         #ffffff;
  --border:        #e5e7eb;
  --shadow-sm:     0 2px 10px rgba(0,0,0,0.07);
  --shadow:        0 6px 24px rgba(0,0,0,0.09);
  --radius:        16px;
  --radius-sm:     10px;
  --transition:    0.22s ease;
}

body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
}

/* ===== Container ===== */
.app-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 18px 14px 60px;
}

/* ===== Header ===== */
.app-header {
  background: linear-gradient(140deg, #ff5722 0%, #ff8c5a 60%, #ffb347 100%);
  border-radius: var(--radius);
  padding: 30px 24px 26px;
  text-align: center;
  color: white;
  margin-bottom: 18px;
  box-shadow: 0 10px 32px var(--primary-glow);
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: -50px; left: -20px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.header-logo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
}

.header-sub {
  font-size: 14px;
  opacity: 0.88;
  margin-top: 5px;
  position: relative;
  z-index: 1;
}

/* ===== Tabs ===== */
.tabs-bar {
  display: flex;
  background: var(--white);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  gap: 6px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
  color: var(--text-sub);
  font-family: inherit;
}

.tab-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.tab-btn:hover:not(.active) {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ===== Tab Content ===== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeUp 0.28s ease;
}

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

/* ===== Search Card ===== */
.search-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.card-hint {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 16px;
  line-height: 1.6;
}

.form-row {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
}

/* ===== Inputs & Selects ===== */
input[type="text"],
select {
  width: 100%;
  padding: 12px 15px;
  font-size: 15px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  font-family: inherit;
  direction: rtl;
  appearance: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--primary);
  background: var(--white);
}

select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ===== Search Button ===== */
.search-btn {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, #ff8a50 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 14px var(--primary-glow);
  font-family: inherit;
}

.search-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px var(--primary-glow);
}

.search-btn:active:not(:disabled) {
  transform: translateY(0);
}

.search-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ===== Autocomplete ===== */
.autocomplete-wrap {
  position: relative;
  margin-bottom: 14px;
}

.autocomplete-wrap input {
  padding-left: 40px;
}

.clear-btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), color var(--transition);
  width: auto;
  box-shadow: none;
  margin: 0;
}

.clear-btn.visible {
  opacity: 1;
  pointer-events: all;
}

.clear-btn:hover {
  color: var(--primary);
  transform: translateY(-50%);
  box-shadow: none;
}

.autocomplete-drop {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  max-height: 230px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: var(--shadow);
}

.autocomplete-drop.open {
  display: block;
  animation: fadeUp 0.18s ease;
}

.ac-item {
  padding: 11px 15px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
}

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

.ac-item:hover {
  background: var(--primary-soft);
}

.ac-ref {
  background: var(--primary);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ac-brand {
  color: var(--text-sub);
  font-size: 13px;
}

/* ===== Results ===== */
.results-header {
  background: var(--white);
  border-radius: var(--radius);
  padding: 15px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.results-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.results-badge {
  background: var(--primary);
  color: white;
  padding: 4px 13px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Brand Card ===== */
.brand-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border-right: 4px solid var(--primary);
  animation: fadeUp 0.3s ease both;
}

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

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.brand-name::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
}

.brand-count {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.models-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.model-chip {
  background: var(--bg);
  color: var(--text);
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.model-chip:hover {
  background: var(--primary-soft);
  border-color: rgba(255, 87, 34, 0.3);
  color: var(--primary-dark);
}

/* ===== Empty / Error State ===== */
.state-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.state-box .state-icon {
  font-size: 44px;
  margin-bottom: 12px;
  line-height: 1;
}

.state-box p {
  color: var(--text-sub);
  font-size: 15px;
}

/* ===== Scrollbar ===== */
.autocomplete-drop::-webkit-scrollbar { width: 5px; }
.autocomplete-drop::-webkit-scrollbar-track { background: transparent; }
.autocomplete-drop::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .app-container { padding: 12px 10px 50px; }
  .tab-btn { font-size: 13px; padding: 10px 8px; gap: 5px; }
  .tab-btn svg { width: 15px; height: 15px; }
  .results-title { font-size: 13px; }
}
