/* Fullscreen layout setup */
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Background setup */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-image: url("../img/nature.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: sans-serif;
  color: white;
}

/* Navigation Bar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.navbar-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  max-height: 60px;
  width: auto;
  background-color: white;
  border-radius: 12px;
  padding: 4px;
}

/* Nav links */
.nav-links {
  display: flex;
  gap: 24px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(14, 16, 15, 0.85);
}

.nav-links a {
  text-decoration: none;
  font-size: clamp(18px, 2.5vw, 28px);
  color: #cccccc;
  font-weight: bold;
}

.nav-links a:hover {
  color: white;
  text-decoration: underline;
}

/* Main layout */
main {
  flex: 1;
  display: block;
  font-family: "Roboto", sans-serif;
}

main .wrapper {
  width: 100%;
  height: 100%;
  max-width: 1300px;
  margin: 110px auto 0 auto;
  padding: 0 10px;
}

main .landing-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: calc(100vh - 160px); /* Adjust based on navbar height */
}

main .landing h1 {
  font-size: clamp(32px, 6vw, 64px);
  font-weight: bold;
  margin-top: 8px;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

main .landing p {
  margin-top: 24px;
  font-size: clamp(16px, 3vw, 28px);
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

main .landing .btn {
  display: inline-block;
  text-decoration: none;
  margin-top: 24px;
  margin-bottom: 64px;
  padding: 28px;
  color: #ffffff;
  background-color: #245a77;
  font-size: clamp(16px, 2vw, 28px);
  font-weight: bold;
  border-radius: 12px;
}

main .scrollable {
  overflow-y: scroll;
  height: 70vh;
}

main img {
  margin-top: 10px;
  width: 100%;
  max-width: 600px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

main iframe {
  margin-top: 10px;
  width: 42vw;
  height: 40vh;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

main h1 {
  font-size: clamp(32px, 6vw, 64px);
  font-weight: bold;
  margin-top: 8px;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

main p {
  margin-top: 24px;
  font-size: clamp(16px, 3vw, 20px);
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

main a {
  color: orange;
}

main strong {
  font-weight: bold;
}

.card-container {
  display: flex;
  justify-content: center;  /* horizontal center */
  align-items: center;      /* vertical center */
  min-height: calc(100vh - 160px); /* adjust for navbar height */
  box-sizing: border-box;
}

main .card {
  background: rgba(14, 16, 15, 0.85);
  padding: 32px;
  border-radius: 12px;
  max-width: 700px;
  color: white;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
  margin: 0;
}

main .login {
  max-width: 350px;
  width: 90%;
  margin: 0 auto;
  padding: 16px;
}

.login img {
  width: 90%;
  display: block;
  margin: 16px auto;
}

.login .welcome {
  margin: 14px 10px;
  font-size: 16px;
  text-align: center;
  color: white;
}

.login input {
  width: 92%;
  padding: 12px;
  margin-bottom: 8px;
  border: none;
  border-radius: 6px;
  background: #2c2c2c;
  color: #aaa;
}

.login button {
  width: 100%;
  padding: 10px;
  margin-bottom: 20px;
  background: #e54222;
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
}

.login .links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.login .links a {
  font-size: 14px;
  text-decoration: none;
  color: #aaa;
}

.login .links a:hover {
  text-decoration: underline;
  color: white;
}

.login hr {
  background-color: #393838;
  height: 1px;
  border: none;
}

.login .version {
  margin-top: 20px;
  font-size: 16px;
  color: #aaa;
}

/* Manage layout */
.manage {
  display: flex;
  border-radius: 12px;
  color: white;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
  margin: 10vh auto;
  max-width: 800px;
  height: 400px;
}

/* Hide radio buttons */
input[type="radio"] {
  display: none;
}

.manage-container {
  display: flex;
  border-radius: 12px;
  color: white;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
  margin: 10vh auto;
  width: 1000px;
  height: 400px;
}

.sidebar {
  width: 220px;
  background: #151515;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.5rem;
}

.sidebar img {
  display: block;
  margin: 10px auto;
  width: 80%;
}

.tab-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem;
}

.sidebar .tab-row .tab {
  padding: 0.75rem 1rem;
  color: #ccc;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.sidebar .tab:hover {
  background: #222;
  color: #fff;
}

input#tab-users:checked ~ .manage-container .sidebar label[for="tab-users"],
input#tab-companies:checked ~ .manage-container .sidebar label[for="tab-companies"],
input#tab-upload:checked ~ .manage-container .sidebar label[for="tab-upload"],
input#tab-support:checked ~ .manage-container .sidebar label[for="tab-support"],

input#tab-profile:checked ~ .manage-container .sidebar label[for="tab-profile"],
input#tab-company:checked ~ .manage-container .sidebar label[for="tab-company"],
input#tab-facilities:checked ~ .manage-container .sidebar label[for="tab-facilities"],
input#tab-contact:checked ~ .manage-container .sidebar label[for="tab-contact"] {
  background: #e94444;
  color: white;
}

.main-content {
  flex: 1;
  padding: 2rem;
  background: #1b1b1b;
  overflow-y: auto;
}

.content {
  display: none;
  background: #222;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.content h2 {
  font-weight: bold;
  font-size: 24px;
}

input#tab-users:checked ~ .manage-container .main-content #users-content,
input#tab-companies:checked ~ .manage-container .main-content #companies-content,
input#tab-upload:checked ~ .manage-container .main-content #upload-content,
input#tab-support:checked ~ .manage-container .main-content #support-content,

input#tab-profile:checked ~ .manage-container .main-content #profile-content,
input#tab-company:checked ~ .manage-container .main-content #company-content,
input#tab-facilities:checked ~ .manage-container .main-content #facilities-content,
input#tab-contact:checked ~ .manage-container .main-content #contact-content {
  display: block;
}

.users-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.add-user-btn, .add-company-btn {
  background: #e94444;
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.add-user-btn:hover, .add-company-btn:hover {
  background: #c73333;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  background: #2a2a2a;
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 2rem;
}

.users-table th, .users-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #444;
}

.users-table th {
  background: #333;
  font-weight: bold;
  color: #eee;
}

.users-table tr:last-child td {
  border-bottom: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal {
  background: #1e1e1e;
  padding: 2rem;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  color: white;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}

.modal h3 {
  margin-top: 0;
}

.modal input,
.modal select {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: #2c2c2c;
  color: #eee;
  border: none;
  border-radius: 6px;
}

.modal button {
  padding: 0.5rem 1rem;
  margin-right: 0.5rem;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.modal small {
  display: block;
  font-size: 0.8rem;
  text-align: center;
  margin-top: 4px;
  margin-bottom: 8px;
}

.modal button[type="submit"] {
  background-color: #28a745;
  color: white;
}

.modal .close-modal {
  background-color: #dc3545;
  color: white;
}

.split {
  display: flex;
  height: 70vh;
}

.split h2 {
  font-size: 24px;
  font-weight: bold;
  color: #2bb851;
}

.split > div {
  flex: 1;
  overflow-y: auto;   /* scroll container for sticky */
  padding: 1rem;
  box-sizing: border-box;
}

.left, .right {
  background-color: #222;
  margin: 5px;
}

.right table {
  margin-top: 20px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
  color: #333;
  background: #fff;
  border-radius: 8px;
  /* overflow: hidden;  <-- remove this */
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.right th,
.right td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.right thead th {
  position: sticky;
  top: -1rem;
  z-index: 2;
  background: #f9fafb; /* solid bg so rows don’t show through */
  font-weight: 600;
  color: #333;
}

.right tr:last-child td { border-bottom: none; }
.right tbody tr:nth-child(even) td { background: #fcfcfd; }
.right tbody tr:hover td { background: #f0f6ff; transition: background .2s; }
.right td:last-child { text-align: right; font-weight: 500; color: #222; }

/* --- Thumbnail preview --- */
#webmPlayer {
  position: relative;
}

#webmPlayer #webmPreview {
  width: 40vw;
  cursor: pointer;
  border-radius: 8px;
  display: block;
  float: right;
}

/* --- Fullscreen overlay --- */
#webmOverlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* --- WebM Player --- */
.wfs-video-wrap {
  max-width: 80vw;
  margin: 0 auto;
}
.wfs-video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  border-radius: 12px;
}
.wfs-ctrls {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: #111;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

/* --- Play/Pause Button --- */
.wfs-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: pointer;
  background: #000;
}

/* Play icon */
.wfs-btn .tri {
  width: 0;
  height: 0;
  border-left: 12px solid #fff;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 0;
  transform: none;
  display: inline-block;
}

/* Hide triangle when paused */
.wfs-btn.pause .tri {
  display: none;
}

/* Pause icon — perfectly centered */
.wfs-btn.pause::before,
.wfs-btn.pause::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 4px;
  height: 18px;
  background: #fff;
  border-radius: 1px;
  transform: translateY(-50%);
}

/* Slightly reduced spacing for better centering */
.wfs-btn.pause::before { left: 50%; transform: translate(-7px, -50%); }
.wfs-btn.pause::after  { left: 50%; transform: translate( 2px, -50%); }

/* --- Progress bar --- */
.wfs-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: #3b3b3b;
  position: relative;
}
.wfs-range {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  margin: 0;
  background: transparent;
  position: absolute;
  left: 0;
  top: 0;
}
.wfs-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  margin-top: -3px;
}
.wfs-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
}
.wfs-fill,
.wfs-buf {
  position: absolute;
  left: 0;
  top: 0;
  height: 8px;
  border-radius: 4px;
}
.wfs-fill {
  background: #fff;
  width: 0%;
}
.wfs-buf {
  background: #6b6b6b;
  width: 0%;
}
.wfs-time {
  min-width: 90px;
  text-align: right;
  color: #eaeaea;
  font-variant-numeric: tabular-nums;
}
.wfs-speed {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #3d3d3d;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  min-width: 46px;
  text-align: center;
}
.wfs-speed:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}


/* Logs Page */
.logs-container {
  max-width: 1000px;
  margin: 0 auto;
  background: #1e1e1e;
  padding: 1.5rem 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  color: #eee;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.logs-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: #fff;
}

.download-btn {
  background: #e94444;
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.download-btn:hover {
  background: #c73333;
}

.logs-table-wrapper {
  height: 70vh;
  overflow-y: auto;
  border-radius: 0.75rem;
  overflow-x: auto;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  background: #2a2a2a;
  border-radius: 0.75rem;
  overflow: hidden;
}

.logs-table th,
.logs-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #444;
  vertical-align: top;
}

.logs-table th {
  background: #333;
  font-weight: bold;
  color: #eee;
  position: sticky;
  top: 0;
  z-index: 1;
}

.logs-table tr:last-child td {
  border-bottom: none;
}

.logs-table tr:nth-child(even) {
  background: #242424;
}

.logs-table tr:hover {
  background: #383838;
}

.logs-table td pre {
  white-space: pre-wrap;
  margin: 0;
  font-family: monospace;
  font-size: 0.8rem;
  color: #ccc;
}

/* Success/Fail colors */
.logs-table td.success {
  color: #28a745;
  font-weight: bold;
}

.logs-table td.fail {
  color: #dc3545;
  font-weight: bold;
}



/* MEDIA QUERIES */
@media (max-width: 900px) {

  .logo {
    max-height: 40px;
    margin: 10px;
  }

  .manage-container {
    flex-direction: column;
    height: auto;
    width: 95%;
    margin: 2rem auto;
  }

  .sidebar {
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
    padding: 1rem 0;
  }

  .sidebar img {
    max-width: 120px;
    margin-bottom: 0.5rem;
  }

  .sidebar .tab-row .tab {
    white-space: nowrap;
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    flex-shrink: 0;
    background: #222;
    color: #ccc;
  }

  .tab-row {
    flex-direction: row;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.25rem;
    margin: 0.5rem auto;
    padding: 0 0.5rem;
  }

  .main-content {
    padding: 1rem;
  }

  .manage-container .sidebar .tab {
    padding: 0.5rem;
    font-size: 14px;
  }

  .content {
    overflow-x: auto;
  }

  .users-header {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .add-user-btn, .add-company-btn {
    margin: 0 auto;
  }

  .users-table th,
  .users-table td {
    font-size: 14px;
    padding: 0.5rem;
  }
}

@media (max-width: 500px) {
  .login .welcome,
  .login .version {
    font-size: 14px;
  }

  .login button {
    font-size: 16px;
  }
}
