/* =========================================================
   F1IT – Global styles.css (admin + frontend)
   ========================================================= */

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

html, body {
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------
   Base
   --------------------------------------------------------- */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937, #020617);
  color: #e5e7eb;
  line-height: 1.4;
}

/* Wrapper */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* Card */
.card {
  background: rgba(15, 23, 42, 0.96);
  border-radius: 1.5rem;
  padding: 2rem;
  width: 100%;
  max-width: 980px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Bred version (list.php) */
.card.wide {
  max-width: 1400px !important;
}

/* ---------------------------------------------------------
   Typography
   --------------------------------------------------------- */

h1 {
  margin: 0 0 0.75rem 0;
  font-size: 1.6rem;
}

h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
}

p {
  margin: 0 0 1rem 0;
  color: #cbd5f5;
}

.small {
  font-size: 0.85rem;
  color: #9ca3af;
}

.mono {
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* ---------------------------------------------------------
   Logo / Header (admin sider)
   --------------------------------------------------------- */

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.logo-img {
  width: 42px;
  height: 42px;
  border-radius: 0.75rem;
  background: #ffffff;
  object-fit: contain;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-title {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ---------------------------------------------------------
   Topbar / navigation
   --------------------------------------------------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

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

/* ---------------------------------------------------------
   Forms
   --------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .label {
  flex: 1 1 200px;
}

input,
select,
textarea {
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  padding: 0.6rem 0.75rem;
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.7);
}

.hint {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

.button {
  display: inline-block;
  background-color: #F53F57;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: #ffffff;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.button:hover {
  background-color: #D33449;
}

.button.secondary {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
}

.button.secondary:hover {
  background: rgba(148, 163, 184, 0.25);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------------------------------------------------------
   Message / info boxes
   --------------------------------------------------------- */

.secret-box {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 0.75rem;
  padding: 1rem;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  margin-bottom: 1rem;
}

/* ---------------------------------------------------------
   Table (admin list.php)
   --------------------------------------------------------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  margin-top: 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

th,
td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: left;
  font-size: 0.9rem;
}

th {
  background: rgba(15, 23, 42, 0.98);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   Pagination
   --------------------------------------------------------- */

.pager {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ---------------------------------------------------------
   Key/Value table (desktop/tablet device.php)
   --------------------------------------------------------- */

.kv-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  margin-top: 0.75rem;
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0 !important; /* vigtigt: slår global table min-width ihjel */
  table-layout: fixed;
}

.kv-table th,
.kv-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: left;
  font-size: 0.95rem;
  white-space: normal;
  word-break: break-word;
}

.kv-table th {
  width: 160px;
  background: transparent;
  position: static;
  color: #cbd5f5;
  font-weight: 600;
}

/* ---------------------------------------------------------
   Device detail - MOBILE first (vis kun én udgave ad gangen)
   --------------------------------------------------------- */

/* Default = mobil: vis compact cards, skjul tabel */
.device-detail {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.65rem;
}

.device-table-desktop {
  display: none;
}

.device-item {
  padding: 0.65rem 0.8rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.55);
}

.device-item .k {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-bottom: 0.2rem;
}

.device-item .v {
  font-size: 0.98rem;
  color: #e5e7eb;
  line-height: 1.25;
  word-break: break-word;
}

.device-item .v.mono {
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

/* Desktop/tablet: skjul cards, vis tabel */
@media (min-width: 601px) {
  .device-detail { display: none; }
  .device-table-desktop { display: block; }
}

/* Mobil-kompakt */
@media (max-width: 600px) {
  .device-card.card { padding: 1.1rem; }
  .device-card h1 { font-size: 1.2rem; margin-bottom: 0.4rem; }
  .device-card .secret-box { padding: 0.75rem; margin-bottom: 0.8rem; }
  .device-card .button { padding: 0.6rem 1.0rem; font-size: 0.9rem; }

  /* Lidt mindre key/values hvis de bruges i andre views */
  .kv-table th { width: 120px; }
}

/* ---------------------------------------------------------
   Responsive generelt
   --------------------------------------------------------- */

@media (max-width: 768px) {
  .page {
    align-items: flex-start;
  }

  .card,
  .card.wide {
    padding: 1.5rem;
    max-width: 100%;
    border-radius: 1.2rem;
  }

  h1 {
    font-size: 1.35rem;
  }
}
