* {
  box-sizing: border-box;
}

header {
  margin: 0;
  padding: 0;
}

span {
  /* Weird phone number detection fix */
  user-select: text;
  -webkit-touch-callout: none;
  -webkit-user-select: text;
  -webkit-tap-highlight-color: transparent;
}

h1.subheader {
  font-size: 1.75rem;
  margin: 0;
  padding: 0px 0px 1vh;
}

h2.subheader {
  font-size: 1.5rem;
  margin: 0;
  padding-bottom: 8px;
}

h2.subheader-no-pad {
  font-size: 1.5rem;
  margin: 0;
  padding: 0;
}

button {
  min-width: 200px;

  margin-top: 16px;
  padding: 14px 16px;

  min-width: 200px;

  background: #1e1e1e;
  color: #ffffff;

  border: none;
  border-radius: 12px;

  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.3px;

  cursor: pointer;

  box-shadow: 0 1px 16px rgba(0, 0, 0, 0.2);

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

body {
  margin: 0;
  padding: 24px 16px 72px; /* space for header + footer */
  text-align: center;

  display: flex;
  flex-direction: column;
  align-items: center;

  min-height: 100vh;

  color: #f1f1f1;
  background-color: #1a1a1a;
}

/* #region Cards */


.card {
  background: #1e1e1e;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  text-decoration: none;
  color: white;
  max-width: 1500px;
  
  width: 100%;
  padding: 16px;
}

div.table {
  margin: 16px;
}

table.table-card {
  font-size: 0.9rem;
  border-collapse: collapse;
  background: #1e1e1e;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  
  width: 100%;
  max-width: 1500px;
  max-height: 940px;

  display: block;
  overflow-y: auto;
  overflow-x: auto;
}

table.table-card thead {
  background: #2a2a2a;
}

table.table-card th,
table.table-card td {
  padding: 8px 16px;
  text-align: left;
}

table.table-card th {
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #bbb;
}

table.table-card td {
  font-size: 1.25rem;
  color: #eee;
  border-top: 1px solid #2f2f2f;
  padding: 7px 16px;
}

table.table-card tbody tr:hover {
  background: #262626;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.4);
}
/* #endregion */

/* #region Profile button */
a.profile-button {
  position: fixed;
  top: 10px;    /* distance from the top */
  right: 10px;  /* distance from the right */
  z-index: 100; /* ensures it stays above other content */
  text-decoration: none;
}

button.back-button {
  min-width: 125px;
  position: fixed;
  margin-top: 0px;
  padding: 10px 14px;
  top: 10px;    /* distance from the top */
  left: 10px;  /* distance from the right */
  z-index: 100; /* ensures it stays above other content */
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 0;
}

/* #endregion */

/* #region Footer */

div.footer-box {
  background-color: #1a1a1a;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
}

ul.nav {
  display: flex;
  justify-content: center;
  list-style-type: none;
  margin: 0;
  padding: 0;
}

/* Style links in topnav */
ul.nav li a {
  display: block;
  color: #f1f1f1;
  padding: 14px 16px;
  text-decoration: none;
}

ul.nav li a:hover {
  background-color: #cfcfcf;
  color: black;
}

/* #endregion */

/* #region Forms */

form {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: left;
  padding: 10px;
}

form button {
  display: inline-block;
  width: 200px;
  margin-top: 12px;
}

div.dropdown select {
  padding: 8px;
  background: #1e1e1e;
  color: #eee;
  border: 1px solid #2f2f2f;
  border-radius: 6px;
  font-size: 1rem;

  min-width: 150px;
  width: 20vw;
  max-width: 280px;
}

div.dropdown {
  display: flex;
  flex-direction: row;
  margin-bottom: 12px;
  padding: 0;
}

div.dropdown * {
  display: inline-block;
  vertical-align: top;
  width: 170px;
}

div.field {
  display: flex;
  flex-direction: row;
  margin-bottom: 12px;
  padding: 0;
}

div.field * {
  display: inline-block;
  vertical-align: top;
  width: 170px;
}

div.field textarea {
  min-height: 22px;
  min-width: 150px;
  width: 20vw;
  max-width: 280px;
  
  resize: vertical;
  padding: 8px;
  background: #1e1e1e;
  color: #eee;
  border: 1px solid #2f2f2f;
  border-radius: 6px;
  font-size: 1rem;
}

div.field input {
  min-width: 150px;
  width: 20vw;
  max-width: 280px;

  padding: 8px;
  background: #1e1e1e;
  color: #eee;
  border: 1px solid #2f2f2f;
  border-radius: 6px;
  font-size: 1rem;
}

p.success-message {
  color: rgb(0, 170, 0);
  margin: 0;
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 0;
}

p.error-message {
  color: rgb(225, 0, 0);
  margin: 0;
  margin-bottom: 12px;
  padding: 0;
}

/* #endregion */

/* #region Shift Timeline */

div.timeline-outer-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: auto auto;
  padding: 0;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

h2.timeline-date {
  font-size: 1.5rem;
  margin: 0;
  padding: 0;
  margin-bottom: 40px;
}

button.add-shift {
  margin-top: 20px;
}

div.timeline-wrapper {
  display: flex;
  flex-direction: row;
  width: 100%;
  margin: auto auto;
  padding: 0;
  align-items: center;
  justify-content: center;
}

div.timeline-wrapper a.arrow {
  color: #f1f1f1;
  padding: 16px;
  text-decoration: none;
  font-size: xx-large;
}

div.timeline-wrapper p {
  width: 80%;
  max-width: 80%;
}

div.timeline-wrapper a.arrow:active {
  color: #ff0000;
}

div.timeline {
  display: flex;
  flex-direction: column;
  width: 80%;
  margin: 20px 0;
  max-width: 80%;
  min-width: 612px;
  padding-right: 5px;
  box-sizing: border-box;
}

div.timeline div.time-labels {
  position: relative;
  width: 100% - 120px;
  height: 30px;
  margin-bottom: 5px;
  margin-left: 120px;
  margin-right: 0;
}

div.timeline div.time-labels span {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%); /* center horizontally and vertically */
}

div.timeline div.employee-row {
  display: flex;
  position: relative;
  height: 30px;
  margin-bottom: 5px;
  box-sizing: border-box;
}

div.timeline div.employee-row div.employee-name {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  flex-shrink: 0;
  padding-left: 10px;
  padding-right: 10px;
  font-weight: bold;
  box-sizing: border-box;
}

div.timeline div.employee-row div.timeline-bar {
  position: relative;
  flex-grow: 1;
  background-color: #f9f9f9;
  height: 100%;
  box-sizing: border-box;
}

div.timeline div.employee-row div.timeline-bar div.shift {
  position: absolute;
  height: 100%;
  border-radius: 4px;
  box-sizing: border-box;
}

div.shift {
  /* Centre text */
  display: flow-root;
  align-items: center;
  justify-content: center;
  padding: 5px 2px;
}

div.shift-label {
  position: relative;
  display: inline-block;
  cursor: pointer;

  /* Prevent text from wrapping */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

div.shift-label span.extra-info {
  display: block;
  visibility: hidden;
  background-color: #333;
  color: #fff;
  text-align: center;
  padding: 5px 10px;
  border-radius: 4px;
  white-space: pre-line;

  /* Position */
  position: fixed;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 250px;

  /* Fade-in effect */
  opacity: 0;
  transition: opacity 0.3s;

  pointer-events: none;
}

div.shift:hover div.shift-label span.extra-info {
  visibility: visible;
  opacity: 1;
}


/* tiny date input */
form.tiny-form-right {
  /* position: absolute;
  left: 100%;
  top: 0; */

  padding: 0;
  margin: 0 0 0 10px;
}

input.tiny-date {
  width: 30px;
}

/* #endregion */

/* #region Transactions */

form.delete-form {
  padding: 10px 0px 10px;
}

button.delete-button {
  min-width: 0px;
  width: 40px;
  height: 40px;

  margin: 0px;
  padding: 0px;

  color: #f44336;
  font-size: 1.5rem;
}  

button.delete-button:hover {
  color: #910000;
  background: #ff2f0a;
}

/* #endregion */

/* #region Cars */

div.car-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 15px;
}

img.gallery-item {
  width: 100%;
  max-width: 650px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  
  cursor: pointer;
  transition: transform 0.25s ease;
}

img.car-image {
  width: 100%;
  max-width: 600px;
  border-radius: 8px;
}

.car-stats {
  display: grid;
  grid-template-areas:
    "finance-stats hours-stats transaction-table"
    "set-sold add-hours add-transaction";
  gap: 20px;
  margin-top: 20px;
}

.car-stats button.set-sold { grid-area: set-sold; }
.car-stats button.add-hours { grid-area: add-hours; }
.car-stats button.add-transaction { grid-area: add-transaction; }

.car-stats .finance-stats {
  grid-area: finance-stats;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  
}

.car-stats .hours-stats {
  grid-area: hours-stats;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  max-width: 360px;
}

.car-stats .transaction-table {
  grid-area: transaction-table;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}


/* #endregion */

/* #region Tasks */

tr.task-complete {
  opacity: 0.45;
  text-decoration: line-through;
  background: #1e1e1e;
}

/* #endregion */

/* #region Dashboard */

form.toggle-form input[type="checkbox"] {
  padding: 0px 0px;
  margin: 0px 0px;
  width: 23px;
  height: 23px;
  accent-color: #2a2a2a;
  cursor: pointer;
}

p.profit-loss-bar {
  padding: 10px 10px;
  border-radius: 6px;
}

p.profit-loss-bar.profit {
  background-color: #2e7d32; /* green */
  color: #ffffff;
}

p.profit-loss-bar.loss {
  background-color: #c62828; /* red */
  color: #ffffff;
}

img.gallery-item:hover {
  transform: scale(1.05);
}

div.car-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  margin-left: auto;
  margin-right: auto;

  max-width: 1500px;
  width: 100%;
}

div.car-grid > * {
  flex: 1 0 175px;
}

/* #endregion */

/* Mobile Adjustments */

@media (max-width: 500px) {
  div.car-stats {
    display: block;
  }

  div.hours-stats {
    margin-top: 20px;
  }

  div.transaction-table {
    margin-top: 20px;
  }

  button.set-sold {
    width: 100%;
  }
  
  button.add-hours {
    width: 100%;
  }
  
  button.add-transaction {
    width: 100%;
  }
}