:root {
  --bg: #f5f7fa;
  --primary: #ff6b35;
  --secondary: #2ec4b6;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --white: #ffffff;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.has-bg-image {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

a {
  color: inherit;
}

.error-box {
  display: none;
  margin: 12px;
  padding: 12px 14px;
  border: 1px solid #fca5a5;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 12px;
  white-space: pre-wrap;
  font-weight: 700;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.logo {
  font-weight: 900;
  font-size: 20px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.spacer {
  flex: 1;
}

.search {
  display: flex;
  gap: 8px;
  align-items: center;
}

input,
select,
textarea,
button {
  font: inherit;
}

.search input {
  width: 220px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.btn {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: inline-block;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

details.menu {
  position: relative;
}

details.menu summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  white-space: nowrap;
}

details.menu summary::-webkit-details-marker {
  display: none;
}

.menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 260px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 100;
}

.menu-dropdown a,
.menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}

.menu-dropdown a:hover,
.menu-dropdown button:hover {
  background: #f3f4f6;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.hero {
  padding: 36px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.12), rgba(46, 196, 182, 0.16));
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 34px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

h1,
h2,
h3 {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.categories {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  margin-bottom: 28px;
}

.cat-card {
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}

.cat-card:hover {
  border-color: var(--primary);
}

.ads {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.card-img {
  height: 180px;
  background: #e5e7eb center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-weight: 700;
}

.card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.price {
  font-weight: 900;
  color: var(--primary);
  font-size: 18px;
}

.free {
  color: var(--secondary);
}

.meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 12px;
  color: #374151;
}

.form {
  max-width: 760px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.form label {
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="number"],
.form input[type="tel"],
.form input[type="url"],
.form select,
.form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.form textarea {
  min-height: 120px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1;
  min-width: 200px;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.preview {
  max-width: 260px;
  max-height: 260px;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.ad-main-image {
  max-width: 100%;
  max-height: 520px;
  border-radius: 16px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #fff;
}

.profile-header {
  padding: 30px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff center/cover;
  margin-bottom: 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 16px;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

.table th {
  background: #f9fafb;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  margin-bottom: 16px;
}

.alert-info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.alert-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.alert-error {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

.mt {
  margin-top: 16px;
}

.mb {
  margin-bottom: 16px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.loading {
  padding: 20px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .search input {
    width: 140px;
  }

  .header-inner {
    gap: 8px;
  }

  .logo {
    width: 100%;
  }

  .spacer {
    display: none;
  }

  .search {
    width: 100%;
  }

  .search input {
    flex: 1;
    width: auto;
  }
}