/*── Style.css ── */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;700;900&family=Barlow:wght@300;400;500&display=swap');

/* CSS Variables */
:root {
  --bg-dark:        #111111;
  --bg-section:     #1a1a1a;
  --bg-card:        #222222;
  --accent:         #c8d400;
  --accent-blue:    #6ab0d4;
  --text-primary:   #ffffff;
  --text-muted:     #aaaaaa;
  --border:         #333333;
  --input-bg:       #2a2a2a;
  --input-focus:    #3a3a3a;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Barlow', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  line-height: 1.6;
  padding-top: 64px;
}

/* Navigation */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  height: 52px;
}

nav h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-right: auto;
  white-space: nowrap;
  text-align: left;
}

nav ul {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav ul li {
  display: flex;
  align-items: center;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s;
}

nav a:hover {
  color: var(--accent);
}

/* Page Header */
header {
  background: var(--bg-dark);
  padding: 3.5rem 2rem 2.5rem;
  text-align: center;
  border-bottom: 2px solid var(--border);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 15% 50%, rgba(200, 212, 0, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 70% at 85% 50%, rgba(106, 176, 212, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

header h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  letter-spacing: 0.02em;
  color: var(--text-primary);
  position: relative;
  white-space: nowrap;
}

header p {
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 300;
  position: relative;
}

/* Content Section */
.content {
  max-width: 520px;
  margin: 3rem auto 4rem;
  padding: 0 1.5rem;
}

/* Wide content — used for pages with tables */
.content-wide {
  width: 100vw;
  position: relative;
  left: 50%;
  margin-left: -50vw;
  padding: 3rem 2.5rem 4rem;
  box-sizing: border-box;
}

/* Form Card */
form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 2px;
  padding: 2.5rem 2rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

/* Form Title */
form h2,
form h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Labels */
label {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  margin-top: 1.4rem;
}

label:first-of-type {
  margin-top: 0;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[name="username"],
input[name="email"],
input[name="password"],
input[name="authcode"] {
  display: block;
  width: 100%;
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.65rem 0.9rem;
  font-family: 'Barlow', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[name="username"]:focus,
input[name="email"]:focus,
input[name="password"]:focus,
input[name="authcode"]:focus {
  background: var(--input-focus);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 212, 0, 0.12);
}

input::placeholder {
  color: #555;
}

/* Remove br spacing in favor of label margin-top */
br {
  display: none;
}

/* Submit Button */
input[type="submit"] {
  display: block;
  width: 100%;
  margin-top: 2rem;
  padding: 0.8rem 1.5rem;
  background: var(--accent);
  color: #111;
  border: none;
  border-radius: 2px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

input[type="submit"]:hover {
  background: #d9e600;
  box-shadow: 0 0 20px rgba(200, 212, 0, 0.3);
}

input[type="submit"]:active {
  transform: translateY(1px);
  background: #b0bc00;
}

/* ── Section headings outside of form cards ── */
.section-heading {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--accent);
}

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-card);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Barlow', sans-serif;
  font-size: 0.88rem;
  table-layout: auto;
}

table th {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-section);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

table th:first-child {
  border-left: 3px solid var(--accent);
}

table td {
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover td {
  background: rgba(200, 212, 0, 0.04);
}

table td.device-id {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

table td.session {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  color: var(--accent-blue);
}

table td.date {
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

table td.actions {
  white-space: nowrap;
  width: 1%;
}

/* Forms nested inside table action cells */
table td.actions form {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  margin: 0;
}

table td.actions input[type="submit"] {
  margin-top: 0;
  width: auto;
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  background: transparent;
  color: #e05555;
  border: 1px solid #e05555;
  letter-spacing: 0.1em;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

table td.actions input[type="submit"]:hover {
  background: #e05555;
  color: #fff;
  box-shadow: 0 0 14px rgba(224, 85, 85, 0.35);
}

/* ── Modal field cells (description / settings) ── */
.field-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
}

.field-preview {
  font-family: 'Barlow', sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
  flex-shrink: 1;
}

.field-preview.field-empty {
  color: #444;
}

/* Small edit button that opens the modal */
.edit-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.edit-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200, 212, 0, 0.06);
}

/* ── Modal Overlay ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

/* ── Modal Box ── */
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 2px;
  width: 520px;
  max-width: 95vw;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.modal-header span {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--accent);
}

/* Modal Body */
.modal-body {
  padding: 1.25rem;
}

.modal-body label {
  /* Inherits global label styles — margin-top override for first use in modal */
  margin-top: 0;
}

.modal-body textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.65rem 0.9rem;
  font-family: 'Barlow', sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.modal-body textarea:focus {
  background: var(--input-focus);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 212, 0, 0.12);
}

.modal-body textarea::placeholder {
  color: #555;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* Cancel button */
.modal-footer .btn-cancel {
  padding: 0.5rem 1.2rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.modal-footer .btn-cancel:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

/* Save button — mirrors the accent submit style but auto-width */
.modal-footer .btn-save {
  padding: 0.5rem 1.4rem;
  background: var(--accent);
  color: #111;
  border: none;
  border-radius: 2px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.modal-footer .btn-save:hover {
  background: #d9e600;
  box-shadow: 0 0 20px rgba(200, 212, 0, 0.3);
}

.modal-footer .btn-save:active {
  transform: translateY(1px);
  background: #b0bc00;
}