:root {
  --bg: #040404;
  --surface: #101010;
  --surface-2: #161616;
  --surface-3: #1d1d1d;
  --line: #313131;
  --text: #f3f3f3;
  --muted: #b8b8b8;
  --brand: #ff7a00;
  --brand-strong: #ff4f00;
  --brand-soft: #ffc38d;
  --ok: #8ef0c3;
  --warn: #ffe09f;
  --danger: #ffc3c3;
  --radius-xl: 1.2rem;
  --radius-lg: 0.95rem;
  --radius-md: 0.72rem;
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.32);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 122, 0, 0.18), transparent 28%),
    radial-gradient(circle at 88% 7%, rgba(255, 79, 0, 0.16), transparent 24%),
    linear-gradient(180deg, #020202, #070707);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Sora", "Trebuchet MS", sans-serif;
  line-height: 1.14;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.admin-wrap {
  width: min(100% - 2rem, 1450px);
  margin-inline: auto;
  padding: 1.3rem 0 2rem;
}

.auth-view {
  min-height: calc(100vh - 3rem);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(590px, 100%);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: linear-gradient(160deg, #111, #171717);
  box-shadow: var(--shadow-lg);
  padding: 1.35rem;
  text-align: center;
}

.auth-card img {
  width: 132px;
  height: 132px;
  margin-inline: auto;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2px solid rgba(255, 140, 42, 0.45);
  box-shadow: 0 0 30px rgba(255, 122, 0, 0.45);
}

.auth-card h1 {
  margin-top: 0.88rem;
  font-size: 1.5rem;
}

.auth-card p {
  margin: 0.7rem auto 0;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.6;
}

.auth-form {
  margin-top: 0.95rem;
  text-align: left;
  display: grid;
  gap: 0.48rem;
}

label {
  color: #d5d5d5;
  font-size: 0.79rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #3b3b3b;
  border-radius: 0.72rem;
  background: #1c1c1c;
  color: #f0f0f0;
  padding: 0.72rem 0.8rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(255, 122, 0, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.16);
}

input::placeholder,
textarea::placeholder {
  color: #9d9d9d;
}

textarea {
  resize: vertical;
  min-height: 112px;
}

.auth-hint {
  margin-top: 0.86rem;
  font-size: 0.84rem;
}

.auth-hint strong {
  color: #ffba82;
}

.alert {
  margin: 0;
  border-radius: 0.72rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.alert-success {
  border: 1px solid rgba(39, 195, 119, 0.45);
  background: rgba(39, 195, 119, 0.14);
  color: var(--ok);
}

.alert-warning {
  border: 1px solid rgba(255, 196, 91, 0.5);
  background: rgba(255, 196, 91, 0.14);
  color: var(--warn);
}

.alert-error {
  border: 1px solid rgba(255, 95, 95, 0.5);
  background: rgba(255, 95, 95, 0.12);
  color: var(--danger);
}

.btn-primary,
.btn-outline {
  border: 0;
  border-radius: 0.75rem;
  padding: 0.7rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn-primary:hover,
.btn-outline:hover,
.btn-primary:focus-visible,
.btn-outline:focus-visible {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 90, 0, 0.32);
}

.btn-outline {
  border: 1px solid #424242;
  background: #1b1b1b;
  color: #f1f1f1;
}

.inline-form {
  margin: 0;
}

.panel-view {
  display: grid;
  gap: 1rem;
}

.panel-header {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(155deg, #101010, #181818);
  box-shadow: var(--shadow-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel-brand {
  display: flex;
  gap: 0.72rem;
  align-items: center;
}

.panel-brand img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2px solid rgba(255, 140, 42, 0.45);
  box-shadow: 0 0 20px rgba(255, 122, 0, 0.35);
}

.panel-brand h1 {
  font-size: clamp(1.12rem, 2vw, 1.35rem);
}

.panel-brand p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.panel-actions {
  display: flex;
  gap: 0.48rem;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.72rem;
}

.stats-grid article {
  border: 1px solid var(--line);
  border-radius: 0.92rem;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 0.82rem 0.9rem;
}

.stats-grid span {
  color: var(--muted);
  font-size: 0.8rem;
}

.stats-grid strong {
  margin-top: 0.3rem;
  display: block;
  font-size: 1.24rem;
}

.account-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, #101010, #171717);
  box-shadow: var(--shadow-md);
  padding: 1rem;
}

.account-card h2 {
  font-size: 1.08rem;
}

.account-card p {
  margin-top: 0.44rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.account-form {
  margin-top: 0.78rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.64rem 0.78rem;
}

.account-form input[readonly] {
  opacity: 0.9;
  cursor: default;
  background: #181818;
}

.account-actions {
  margin-top: 0.18rem;
  display: flex;
  gap: 0.52rem;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(360px, 500px) minmax(0, 1fr);
  gap: 0.92rem;
  align-items: start;
}

.editor-card,
.list-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, #101010, #171717);
  box-shadow: var(--shadow-md);
  padding: 1rem;
}

.editor-card {
  position: sticky;
  top: 1rem;
}

.editor-card h2,
.list-card h2 {
  font-size: 1.1rem;
}

.list-card {
  display: grid;
  gap: 0.68rem;
}

.list-card > * {
  margin-top: 0;
}

.editor-subtitle,
.list-card p {
  margin-top: 0.44rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.car-form {
  margin-top: 0.78rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.64rem 0.78rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.field-full {
  grid-column: 1 / -1;
}

.field-hint {
  color: #b7b7b7;
  font-size: 0.74rem;
  margin-top: 0.18rem;
}

.form-actions {
  margin-top: 0.2rem;
  display: flex;
  gap: 0.52rem;
  flex-wrap: wrap;
}

.current-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 0.48rem;
}

.media-chip {
  border: 1px solid #3a3a3a;
  border-radius: 0.7rem;
  background: var(--surface-3);
  padding: 0.44rem;
  display: grid;
  gap: 0.36rem;
  cursor: pointer;
}

.media-chip input {
  width: auto;
  margin: 0;
}

.media-thumb {
  border-radius: 0.58rem;
  overflow: hidden;
  border: 1px solid #454545;
  background: #111;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.media-chip-text {
  color: #d6d6d6;
  font-size: 0.75rem;
  font-weight: 700;
}

.list-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.admin-search-form {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
  width: min(100%, 500px);
}

.admin-search-form input {
  flex: 1;
  min-width: 220px;
}

.list-counter {
  margin-top: 0.7rem;
  color: #d6d6d6;
  font-size: 0.84rem;
}

.list-counter strong {
  color: #fff;
}

.cars-list {
  margin-top: 0.72rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(295px, 1fr));
  gap: 0.72rem;
  max-height: none;
  overflow: visible;
}

.car-item {
  border: 1px solid #3a3a3a;
  border-radius: 0.86rem;
  background: var(--surface-2);
  overflow: hidden;
}

.car-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.car-item-content {
  padding: 0.78rem;
}

.car-item h3 {
  font-size: 0.98rem;
}

.car-item p {
  margin: 0.45rem 0 0;
  color: #cdcdcd;
  font-size: 0.84rem;
  line-height: 1.52;
}

.car-meta {
  margin-top: 0.54rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.34rem;
}

.car-meta span {
  border: 1px solid #454545;
  border-radius: 0.54rem;
  background: #222;
  color: #dedede;
  padding: 0.26rem 0.42rem;
  font-size: 0.74rem;
}

.car-actions {
  margin-top: 0.64rem;
  display: flex;
  gap: 0.44rem;
}

.car-actions button,
.car-actions a {
  flex: 1;
  border: 0;
  border-radius: 0.58rem;
  padding: 0.52rem 0.62rem;
  font-size: 0.79rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.btn-edit {
  background: #272727;
  color: #fff;
  border: 1px solid #4a4a4a;
}

.btn-delete {
  background: rgba(255, 95, 95, 0.16);
  color: #ffc5c5;
  border: 1px solid rgba(255, 95, 95, 0.45);
}

.empty-state {
  border: 1px dashed #575757;
  border-radius: 0.84rem;
  background: #171717;
  color: #cacaca;
  padding: 1rem;
  text-align: center;
  font-size: 0.85rem;
}

@media (max-width: 1200px) {
  .account-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-card {
    position: static;
  }
}

@media (max-width: 980px) {
  .account-form {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .car-form {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: 1;
  }
}

@media (max-width: 700px) {
  .admin-wrap {
    width: min(100% - 1rem, 1450px);
  }

  .auth-card,
  .panel-header,
  .editor-card,
  .list-card {
    padding: 0.86rem;
  }

  .panel-actions {
    width: 100%;
  }

  .panel-actions .btn-outline,
  .panel-actions .btn-primary {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .list-head {
    align-items: stretch;
  }

  .admin-search-form {
    width: 100%;
  }

  .admin-search-form input {
    min-width: 0;
  }

  .car-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .auth-card img {
    width: 106px;
    height: 106px;
  }

  .panel-brand img {
    width: 70px;
    height: 70px;
  }

  .car-meta {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
