/* ============================================================
   Bärtschi Landmaschinen AG — Admin Panel Styles
   ============================================================ */

/* ── Admin Login Overlay ────────────────────────────────────── */
#admin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 18, 28, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
}
#admin-overlay.open { display: flex; }

.admin-login-box {
  background: rgba(28, 43, 58, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: min(420px, 90vw);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.admin-login-box h2 {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: .05em;
  margin-bottom: .4rem;
}

.admin-login-box p {
  font-size: .88rem;
  color: rgba(255,255,255,.55);
  margin-bottom: 1.5rem;
}

#admin-login-error {
  display: none;
  background: rgba(192,57,43,0.2);
  border: 1px solid rgba(192,57,43,0.45);
  border-radius: 6px;
  padding: .55rem .9rem;
  color: #e88080;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: .75rem;
}

/* ── Admin Panel (Vollbild-Overlay) ─────────────────────────── */
#admin-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(12, 20, 30, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-direction: column;
  overflow: hidden;
}
#admin-panel.open { display: flex; }

/* Header */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.5rem;
  background: rgba(28,43,58,0.8);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-header h1 {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: .05em;
}

/* Body: Sidebar + Content */
.admin-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.admin-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: rgba(20, 32, 44, 0.85);
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 1rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  overflow-y: auto;
}

.admin-sidebar a {
  display: block;
  font-family: var(--font-head);
  font-size: .88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  padding: .6rem .9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all .2s ease;
  white-space: nowrap;
}

.admin-sidebar a:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.10);
}

.admin-sidebar a.active {
  color: #fff;
  background: rgba(45,90,39,.35);
  border-color: rgba(78,158,66,.45);
  box-shadow: 0 0 10px rgba(45,90,39,.3);
}

/* ── Content Area ───────────────────────────────────────────── */
.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  min-width: 0;
}

/* ── Sections ───────────────────────────────────────────────── */
.admin-section { display: none; }
.admin-section.active { display: block; }

.admin-section > h2 {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #fff;
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid rgba(78,158,66,.35);
}

/* ── Admin Form Card ────────────────────────────────────────── */
.admin-form {
  background: rgba(28,43,58,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.admin-form h3 {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: rgba(255,255,255,.8);
  margin-bottom: 1.2rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

/* Form row (2 Spalten) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

/* ── Admin Table ────────────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  background: rgba(20,32,44,.55);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
}

.admin-table thead tr {
  background: rgba(45,90,39,.25);
  border-bottom: 2px solid rgba(78,158,66,.3);
}

.admin-table th {
  font-family: var(--font-head);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.6);
  padding: .7rem 1rem;
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: .65rem 1rem;
  color: rgba(255,255,255,.8);
  border-bottom: 1px solid rgba(255,255,255,.05);
  vertical-align: middle;
}

.admin-table tbody tr:hover { background: rgba(255,255,255,.04); }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* ── Upload Widget ──────────────────────────────────────────── */
.upload-widget {
  position: relative;
  background: rgba(255,255,255,.04);
  border: 2px dashed rgba(255,255,255,.18);
  border-radius: 10px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
  overflow: hidden;
}

.upload-widget:hover {
  border-color: rgba(78,158,66,.6);
  background: rgba(45,90,39,.12);
}

.upload-widget input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-widget-icon { font-size: 1.8rem; margin-bottom: .4rem; }
.upload-widget p {
  font-size: .85rem;
  color: rgba(255,255,255,.5);
  margin: 0;
}

.upload-progress {
  display: none;
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 2px;
  margin-top: .8rem;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green-mid), var(--green-light));
  border-radius: 2px;
  width: 0;
  transition: width .2s ease;
}

.upload-preview {
  display: none;
  margin-top: .75rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  max-width: 220px;
}
.upload-preview img {
  width: 100%;
  display: block;
  max-height: 140px;
  object-fit: cover;
}

.upload-hint {
  font-size: .75rem;
  color: rgba(255,255,255,.35);
  margin-top: .35rem;
}

/* ── Color Grid (Farbschema) ────────────────────────────────── */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.color-field label {
  display: block;
  font-family: var(--font-head);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  margin-bottom: .4rem;
}

.color-field-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
}

.color-field-row input[type="color"] {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
}

.color-field-row input[type="text"] {
  flex: 1;
  padding: .4rem .6rem;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: 6px;
  color: #fff;
  font-size: .9rem;
  font-family: monospace;
  outline: none;
  transition: border-color .2s;
}
.color-field-row input[type="text"]:focus {
  border-color: rgba(78,158,66,.6);
}

.color-preview-bar {
  height: 6px;
  border-radius: 3px;
  width: 100%;
}

/* ── Preset Theme Buttons ───────────────────────────────────── */
.preset-themes {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.preset-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-head);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .4rem .9rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.7);
  cursor: pointer;
  transition: all .2s ease;
}
.preset-btn:hover {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.3);
  color: #fff;
}

/* ── BG Preview ─────────────────────────────────────────────── */
.bg-preview {
  width: 100%;
  height: 120px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.35);
  font-size: .85rem;
  margin-top: .5rem;
}

.bg-overlay-slider {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.bg-overlay-slider input[type="range"] {
  flex: 1;
  min-width: 120px;
  accent-color: var(--green-mid);
}

/* ── Logo Settings Grid ─────────────────────────────────────── */
@media (max-width: 800px) {
  .logo-settings-grid { grid-template-columns: 1fr !important; }
}

/* ── Contacts / Auditlog Filter ─────────────────────────────── */
#contacts-filter,
#audit-filter {
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: .5rem .9rem;
  color: #fff;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
}
#contacts-filter:focus,
#audit-filter:focus {
  border-color: rgba(78,158,66,.6);
}

/* ── Badge (featured) ───────────────────────────────────────── */
.badge-featured {
  background: rgba(200,133,10,.25);
  border: 1px solid rgba(240,164,32,.45);
  color: var(--amber-light);
}

/* ── Responsive Admin ───────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-body { flex-direction: column; }

  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
    padding: .5rem;
    gap: .25rem;
    overflow-x: auto;
  }

  .admin-sidebar a {
    font-size: .75rem;
    padding: .4rem .7rem;
    white-space: nowrap;
  }

  .admin-content { padding: 1.2rem 1rem; }

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

  .admin-header h1 { font-size: .95rem; }
}

@media (max-width: 480px) {
  .admin-content { padding: 1rem .75rem; }
  .admin-form { padding: 1rem; }
  .color-grid { grid-template-columns: 1fr; }
}