@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --yellow: #ffd400;
  --black: #111;
  --card: #fff;
  --border: #e8e8e8;
  --bg: var(--yellow);
  --text: var(--black);
  --input-bg: #f7f7f7;
  --input-border: #ddd;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
}

body.dark {
  --card: #1a1a1a;
  --border: #2e2e2e;
  --bg: #111;
  --text: #f0f0f0;
  --input-bg: #242424;
  --input-border: #383838;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===============================
   HEADER
=============================== */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px 18px;
  border-bottom: 2px solid #111;
  background: var(--yellow);
  text-align: center;
  position: relative;
}

.logo {
  height: 40px;
  max-width: 100%;
}

.header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #111;
}

.dark-toggle {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #111;
  color: #ffd400;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0;
  transition: all 0.2s;
}

body.dark .dark-toggle {
  background: #ffd400;
  color: #111;
}

/* ===============================
   LAYOUT
=============================== */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===============================
   CARD
=============================== */
.card {
  background: var(--card);
  padding: 22px 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 14px;
}

body.dark .card h2 {
  color: #666;
}

/* ===============================
   HIDDEN
=============================== */
.hidden {
  display: none !important;
}

/* ===============================
   FORM
=============================== */
label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

label:first-of-type {
  margin-top: 0;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  background: var(--input-bg);
  color: var(--text);
  transition: border 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

body.dark input:focus,
body.dark textarea:focus,
body.dark select:focus {
  border-color: #ffd400;
  box-shadow: 0 0 0 3px rgba(255,212,0,0.1);
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  margin-top: 0;
  accent-color: #111;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===============================
   RADIO LABELS
=============================== */
.card label:has(input[type="radio"]),
.card label:has(input[type="checkbox"]) {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  margin-top: 8px;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}

.card label:has(input[type="radio"]):hover,
.card label:has(input[type="checkbox"]):hover {
  border-color: #111;
}

body.dark .card label:has(input[type="radio"]):hover,
body.dark .card label:has(input[type="checkbox"]):hover {
  border-color: #ffd400;
}

/* ===============================
   BUTTONS
=============================== */
button {
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

button:hover {
  border-color: #111;
}

body.dark button:hover {
  border-color: #ffd400;
}

button.primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

button.primary:hover {
  background: #333;
}

body.dark button.primary {
  background: #ffd400;
  color: #111;
  border-color: #ffd400;
}

body.dark button.primary:hover {
  background: #e6bf00;
}

/* ===============================
   ACTIONS
=============================== */
.actions {
  display: flex;
  justify-content: flex-end;
}

.actions button {
  padding: 12px 32px;
  font-size: 14px;
}

/* ===============================
   LISTS
=============================== */
ul {
  list-style: none;
  padding: 0;
  margin-top: 8px;
}

ul li {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

ul li:last-child {
  border-bottom: none;
}

/* ===============================
   ADMIN LAYOUT
=============================== */
.layout {
  display: flex;
  min-height: calc(100vh - 100px);
}

.sidebar {
  width: 220px;
  background: #111;
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar h2 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 8px;
}

.sidebar button {
  background: transparent;
  color: #aaa;
  border: none;
  text-align: left;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 0;
  transition: all 0.15s;
}

.sidebar button:hover {
  background: #1e1e1e;
  color: #fff;
  border-color: transparent;
}

.sidebar button.active {
  background: #ffd400;
  color: #111;
  font-weight: 600;
}

.content {
  flex: 1;
  padding: 28px;
  background: var(--bg);
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* ===============================
   ADMIN TABLE
=============================== */
.admin-table,
#deviceTable,
#vehicleDeviceTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.admin-table th,
.admin-table td,
#deviceTable th,
#deviceTable td,
#vehicleDeviceTable th,
#vehicleDeviceTable td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  color: var(--text);
}

.admin-table th,
#deviceTable th,
#vehicleDeviceTable th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #999;
  background: var(--input-bg);
}

.admin-table tr:hover td,
#deviceTable tr:hover td {
  background: var(--input-bg);
}

/* ===============================
   LOGIN OVERLAY
=============================== */
.login-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.login-box {
  background: var(--card);
  color: var(--text);
  padding: 36px 32px;
  border-radius: 16px;
  width: 340px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  border: 1px solid var(--border);
}

.login-box h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

.login-box input {
  width: 100%;
  margin-top: 10px;
  font-size: 14px;
}

.login-box button {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  font-size: 14px;
}

.password-wrapper {
  position: relative;
}

.eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-30%);
  cursor: pointer;
  font-size: 16px;
}

/* ===============================
   RESPONSIVE
=============================== */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
  }

  .sidebar h2 {
    display: none;
  }

  .sidebar button {
    flex: 1;
    text-align: center;
  }

  .content {
    padding: 16px;
  }
}