// ── Variables ─────────────────────────────────────────────────
$orange:      #f26522;
$orange-dark: #d4551a;
$bg:          #f0f0f0;
$white:       #ffffff;
$border:      #e0e0e0;
$text:        #1a1a1a;
$muted:       #888;
$danger:      #e53935;
$success:     #2e7d32;
$radius-sm:   6px;
$radius-md:   10px;
$radius-lg:   16px;
$transition:  0.2s ease;

// ── Login ─────────────────────────────────────────────────────
.loginWrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  padding: 20px;
}

.loginCard {
  background: $white;
  border-radius: $radius-lg;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.loginLogo  { font-size: 3rem; margin-bottom: 16px; }

.loginTitle {
  font-family: "Segoe UI", sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: $text;
  margin: 0 0 6px;
}

.loginSub {
  font-family: "Segoe UI", sans-serif;
  font-size: 0.82rem;
  color: $muted;
  margin: 0 0 28px;
}

.loginForm { display: flex; flex-direction: column; gap: 12px; }

.loginInput {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid $border;
  border-radius: $radius-md;
  font-size: 0.95rem;
  font-family: "Segoe UI", sans-serif;
  outline: none;
  transition: border-color $transition;
  box-sizing: border-box;

  &:focus         { border-color: $orange; }
  &.inputError    { border-color: $danger; }
}

.errorMsg {
  font-family: "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: $danger;
  margin: -4px 0 0;
  text-align: left;
}

.loginBtn {
  padding: 12px;
  background: $orange;
  color: $white;
  border: none;
  border-radius: $radius-md;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background $transition;

  &:hover { background: $orange-dark; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}

.shake { animation: shake 0.45s ease; }

// ── Loading ───────────────────────────────────────────────────
.loadingScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI", sans-serif;
  font-size: 1rem;
  color: $muted;
}

// ── Admin layout ──────────────────────────────────────────────
.adminWrapper {
  font-family: "Segoe UI", sans-serif;
  min-height: 100vh;
  background: $bg;
  color: $text;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
}

// ── Header ────────────────────────────────────────────────────
.adminHeader {
  background: $white;
  border-bottom: 1px solid $border;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  flex-wrap: wrap;
}

.adminHeaderLeft {
  display: flex;
  align-items: center;
  gap: 14px;
}

.adminHeaderIcon  { font-size: 1.8rem; }

.adminHeaderTitle {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
}

.adminHeaderSub {
  font-size: 0.72rem;
  color: $muted;
  margin: 0;
}

.adminHeaderRight {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.savedBadge {
  background: lighten($success, 58%);
  color: $success;
  border: 1px solid lighten($success, 40%);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 700;
}

.btnSaveHeader {
  padding: 8px 18px;
  background: $orange;
  color: $white;
  border: none;
  border-radius: $radius-sm;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background $transition;

  &:hover { background: $orange-dark; }
}

.btnLogout {
  padding: 8px 18px;
  background: $white;
  color: $muted;
  border: 1.5px solid $border;
  border-radius: $radius-sm;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color $transition, border-color $transition;

  &:hover { color: $danger; border-color: $danger; }
}

// ── Tab bar ───────────────────────────────────────────────────
.tabBar {
  display: flex;
  gap: 0;
  background: $white;
  border-bottom: 2px solid $border;
  padding: 0 28px;
}

.tabBtn {
  padding: 12px 24px;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: $muted;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color $transition, border-color $transition;

  &:hover { color: $orange; }

  &.tabActive {
    color: $orange;
    border-bottom-color: $orange;
  }
}

// ── Products tab body ─────────────────────────────────────────
.adminBody {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;

  @media (max-width: 700px) { grid-template-columns: 1fr; }
}

// ── Sidebar ───────────────────────────────────────────────────
.sidebar {
  background: $white;
  border-right: 1px solid $border;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: calc(100vh - 200px);
}

.sidebarLabel {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: $muted;
  margin: 0 0 8px 6px;
}

.sidebarItem {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: $radius-sm;
  font-size: 0.8rem;
  font-weight: 500;
  color: $text;
  cursor: pointer;
  transition: background $transition;

  &:hover { background: $bg; }

  &.sidebarActive {
    background: lighten($orange, 44%);
    color: $orange;
    font-weight: 700;
    border-left: 3px solid $orange;
    padding-left: 9px;
  }
}

// ── Content ───────────────────────────────────────────────────
.content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

// ── Field ─────────────────────────────────────────────────────
.fieldRow {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fieldLabel {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: $muted;
  white-space: nowrap;
  min-width: 120px;
}

.fieldInput {
  flex: 1;
  max-width: 360px;
  padding: 9px 14px;
  border: 1.5px solid $border;
  border-radius: $radius-sm;
  font-size: 0.88rem;
  font-family: "Segoe UI", sans-serif;
  outline: none;
  box-sizing: border-box;
  transition: border-color $transition;

  &:focus { border-color: $orange; }
}

// ── Body type pills row ───────────────────────────────────────
.bodyTypeRow {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.bodyTypePills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.bodyPill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid $border;
  background: $bg;
  color: $text;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color $transition, background $transition, color $transition;

  &:hover { border-color: $orange; }

  &.bodyPillActive {
    border-color: $orange;
    background: lighten($orange, 44%);
    color: $orange;
  }
}

.bodyPillIcon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  object-fit: contain;
}

.bodyPillEmoji {
  margin-right: 8px;
}

// ── Package tabs ──────────────────────────────────────────────
.pkgTabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid $border;
  padding-bottom: 0;
}

.pkgTab {
  padding: 8px 20px;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  background: none;
  color: $muted;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color $transition, border-color $transition;

  &:hover { color: $orange; }
  &.pkgActive { color: $orange; border-bottom-color: $orange; }
}

// ── Table ─────────────────────────────────────────────────────
.tableWrapper {
  background: $white;
  border-radius: $radius-md;
  border: 1px solid $border;
  overflow: hidden;
}

.table   { width: 100%; border-collapse: collapse; }

.th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: $muted;
  padding: 10px 14px;
  background: $bg;
  border-bottom: 2px solid $border;
}

.thNum   { width: 110px; }

.tr {
  &:not(:last-child) { border-bottom: 1px solid $border; }
  &:hover { background: rgba($orange, 0.025); }
}

.td { padding: 8px 10px; font-size: 0.82rem; vertical-align: middle; }

.tdTotal { font-weight: 700; color: $orange-dark; white-space: nowrap; }

.cellInput {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid $border;
  border-radius: $radius-sm;
  font-size: 0.82rem;
  font-family: "Segoe UI", sans-serif;
  outline: none;
  box-sizing: border-box;
  transition: border-color $transition;

  &:focus { border-color: $orange; }
}

.cellNum { text-align: right; }

.emptyRow {
  text-align: center;
  padding: 24px;
  font-size: 0.82rem;
  color: $muted;
  font-style: italic;
}

.btnAdd {
  align-self: flex-start;
  background: none;
  border: 2px dashed $orange;
  color: $orange;
  border-radius: $radius-md;
  padding: 9px 20px;
  font-weight: 700;
  font-size: 0.82rem;
  font-family: "Segoe UI", sans-serif;
  cursor: pointer;
  transition: background $transition;

  &:hover { background: lighten($orange, 46%); }
}

.btnDel {
  background: none;
  border: none;
  color: $danger;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: $radius-sm;
  transition: background $transition;

  &:hover { background: lighten($danger, 46%); }
}

// ── Body Types tab ────────────────────────────────────────────
.bodyTypesPage {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bodyTypesHeader { display: flex; flex-direction: column; gap: 6px; }

.bodyTypesTitle {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
}

.bodyTypesSub {
  font-size: 0.82rem;
  color: $muted;
  margin: 0;
  max-width: 540px;
}

.bodyTypesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.bodyTypeCard {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.imageUploader {
  position: relative;
  background: #f9f9f9;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
}

.iconPreview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  font-size: 48px;
}

.uploadLabel {
  position: absolute;
  bottom: 8px;
  right: 8px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.imageUploader:hover .uploadLabel {
  opacity: 1;
}

// ── FIX: bodyTypeCardBottom — input görünür + delete butonu hizalı ──
.bodyTypeCardBottom {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;

  // Global .fieldInput'taki max-width:360px'i burada ezip
  // flex container içinde düzgün genişlemesini sağlıyoruz
  .fieldInput {
    flex: 1;
    min-width: 0;      // flex shrink için zorunlu
    max-width: none;   // ← Ana sorun buydu
  }

  // Silme butonu sabit genişlikte, flex'ten etkilenmesin
  .btnDel {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
  }
}

.bodyTypeAddCard {
  background: none;
  border: 2px dashed $border;
  border-radius: $radius-md;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: $muted;
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color $transition, color $transition;
  min-height: 100px;

  span:first-child { font-size: 1.8rem; }

  &:hover { border-color: $orange; color: $orange; }
}

// ── Save hint ─────────────────────────────────────────────────
.saveHint {
  background: lighten($orange, 46%);
  border: 1px solid lighten($orange, 30%);
  border-radius: $radius-md;
  padding: 14px 18px;
  font-size: 0.82rem;
  color: darken($orange, 10%);
  max-width: 600px;

  p { margin: 0; line-height: 1.6; }
  code {
    background: rgba($orange, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
  }
}

// ── Floating save button ──────────────────────────────────────
.floatSave {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
}

.btnSaveFloat {
  padding: 12px 24px;
  background: $orange;
  color: $white;
  border: none;
  border-radius: $radius-lg;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: "Segoe UI", sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba($orange, 0.45);
  transition: background $transition, transform $transition;

  &:hover {
    background: $orange-dark;
    transform: translateY(-2px);
  }
}