@import url("reset.css");
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');

:root {
   --main-black-color: #333;
   --main-orange-color: #F58220;
   --main-white-color: #fff; 
   --light-grey-color1: #f5f5f5;
   --light-grey-color2: #ababab;
   --orange-hover-color: #faa65d;
}


html {
   scroll-behavior: smooth;
}

body {
   display: flex;
   justify-content: space-between;
   align-items: center;
   flex-direction: column;
   gap: 25px;
   background-color: var(--light-grey-color1);
   font-family: Roboto, sans-serif;
   font-size: 15px;
   height: 100%;
   overflow-x: hidden;
}
body.modal-open,
body.history-modal-open {
   overflow: hidden;
}

/* Header styling */
header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 20px;
   width: 100%;
   background-color: var(--main-black-color);
   color: var(--main-white-color);
}
.page-title > h1 {
   font-size: 1.2rem;
   font-weight: 500;
}

#main-container {
   display: flex;
   justify-content: flex-start;
   align-items: center;
   flex-direction: column;
   gap: 15px;
   width: 95%;
   height: 100%;
   padding: 20px;
   border-radius: 4px;
   background-color: var(--main-white-color);
   overflow: hidden;
   filter:drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.15));
}

/* Search Section styling */
#search-container {
   display: flex;
   justify-content: space-between;
   align-items: center;
   flex-wrap: wrap;
   gap: 15px;
   padding: 20px 0px;
   width: 100%;
}
.search-bar-wrapper {
   position: relative;
   display: flex;
   justify-content: flex-start;
   align-items: center;
   /* padding: 20px; */
   width: 55%;
}
#search-input {
   background-color: var(--light-grey-color1);
   padding-right: 140px;
   width: 100%;
   height: 44px;
}
#search-btn {
   position: absolute;
   top: 0px;
   right: 0px;
   font-size: 16px;
   font-weight: 600;
   color: var(--main-white-color);
   background-color: var(--main-orange-color);
   border: none;
   padding: 10px;
   border-radius: 0px 4px 4px 0px;
   width: 125px;
   cursor: pointer;
}
#search-btn:hover {
   background-color: var(--orange-hover-color);
   transition: all 0.3s ease-in-out;
}
#new-form-btn {
   font-size: 16px;
   font-weight: 600;
   color: var(--main-white-color);
   background-color: var(--main-orange-color);
   border: none;
   padding: 10px;
   border-radius: 4px;
   width: 240px;
   cursor: pointer;
}
#new-form-btn:hover {
   background-color: var(--orange-hover-color);
   transition: all 0.3s ease-in-out;
}
/* End search section styling */

/* Table styling */
#table-container {
   display: flex;   
   justify-content: flex-start;
   align-items: flex-start;
   width: 100%;
   height: 100%;
   max-height: 700px;
   background-color: var(--light-grey-color1);
   border: 2px solid var(--light-grey-color1);
   overflow-x: auto;
   overflow-y: scroll;
   flex-direction: column;
}
table {
   border-collapse: collapse;
   width: 100%;
   /* height: 650px; */
   padding: 0 20px;
   background-color: var(--main-white-color);
}
thead {
   position: sticky;
   top: 0;
   filter: drop-shadow(0px 1px 5px grey);
}
th {
   padding: 10px 8px;
   background-color: var(--main-white-color);
   cursor: pointer;
}
tr:nth-child(odd) {
   background-color: var(--light-grey-color1);
}
td {
   padding: 20px 10px;
}
#entry-log-num-header-col, .entry-log-num-col {
   display: none;
}

.col-th-wrapper {
   display: flex;
   justify-content: space-between;
   align-items: center;
   gap: 5px;
}
.table-header-text {
   color: grey;
   font-weight: 600;
   line-height: 1.2;
}
.sort-icon-wrapper {
   color: var(--main-orange-color);
}
.edit-col-wrapper {
   display: flex;
   justify-content: flex-start;
   align-items: center;
   /* flex-wrap: wrap; */
   gap: 15px;
}
.edit-log-btn, .delete-log-btn {
   border: none;
   font-size: 20px;
   color: var(--main-orange-color);
   background-color: transparent;
   cursor: pointer;
}
.edit-log-btn:hover {
   color: var(--orange-hover-color);
   cursor: pointer;
   transition: all 0.3s ease-in-out;
}
.delete-log-btn:hover {
   color: red;
   transition: all 0.3s ease-in-out;
}

.service-description-wrapper {
   display: inline;
}
.service-description-wrapper[data-expanded="true"] {
   display: block;
}
.service-description-text {
   display: inline;
   white-space: pre-wrap;
   word-break: break-word;
}
.service-description-wrapper .service-description-text.full {
   display: none;
}
.service-description-wrapper[data-expanded="true"] .service-description-text.full {
   display: block;
}
.service-description-wrapper[data-expanded="true"] .service-description-text.truncated {
   display: none;
}
.toggle-description-btn {
   display: inline;
   padding: 0;
   border: none;
   background: none;
   color: var(--main-orange-color);
   font-weight: 600;
   cursor: pointer;
   margin-left: 4px;
}
.service-description-wrapper[data-expanded="true"] .toggle-description-btn {
   margin-left: 0;
   margin-top: 6px;
   display: inline-block;
}
.service-description-wrapper[data-has-toggle="false"] .toggle-description-btn {
   display: none;
}
.toggle-description-btn:hover {
   text-decoration: underline;
}

.table-pagination-controls {
   display: flex;
   justify-content: space-between;
   align-items: center;
   flex-wrap: wrap;
   gap: 15px;
   /* padding: 15px 20px; */
   width: 100%;
   background-color: var(--main-white-color);
   /* border-top: 1px solid var(--light-grey-color2); */
}
.pagination-size-control {
   display: flex;
   align-items: center;
   gap: 10px;
   font-weight: 500;
   color: var(--main-black-color);
}
#entries-per-page {
   height: 34px;
   padding: 6px 10px;
   border: 1px solid var(--light-grey-color2);
   border-radius: 4px;
   background-color: var(--light-grey-color1);
}
.pagination-nav {
   display: flex;
   align-items: center;
   gap: 10px;
   font-weight: 500;
}
.pagination-btn {
   height: 34px;
   padding: 4px 14px;
   border: 1px solid var(--main-orange-color);
   background-color: var(--main-orange-color);
   color: var(--main-white-color);
   border-radius: 4px;
   cursor: pointer;
}
.pagination-btn:disabled {
   border-color: var(--light-grey-color2);
   background-color: var(--light-grey-color2);
   cursor: not-allowed;
}
/* set width for select table header columns */
#rental-id-header-col {
   width: 170px;
   min-width: 130px;
   max-width: 220px;
}
#equipment-description-header-col {
   width: 300px;
   min-width: 150px;
   max-width: 360px;   
}
#service-type-header-col {
   width: 150px;
}
#service-description-header-col {
   /* width: 40%; */
   width: 500px;
   min-width: 300px;
   /* max-width: 600px; */
}
#hour-meter-header-col {
   width: 50px;
}
#edit-header-col {
   width: 110px;
   min-width: 90px;
}

.rental-id-wrapper {
   display: flex;
   flex-direction: column;
   align-items: flex-start;
   gap: 6px;
}

.rental-id-value {
   font-weight: 600;
   color: var(--main-black-color);
}

.view-history-btn {
   font-size: 0.75rem;
   font-weight: 500;
   color: var(--main-orange-color);
   background-color: transparent;
   border: 1px solid var(--main-orange-color);
   padding: 4px 10px;
   border-radius: 20px;
   cursor: pointer;
   transition: all 0.2s ease-in-out;
   line-height: 1.3;
   width: 100%;
   text-align: center;
}

.view-history-btn:hover,
.view-history-btn:focus-visible {
   color: var(--main-white-color);
   background-color: var(--main-orange-color);
}

.history-modal {
   position: fixed;
   inset: 0;
   background-color: rgba(0, 0, 0, 0.55);
   display: none;
   align-items: center;
   justify-content: center;
   padding: 20px;
   z-index: 1100;
}

.history-modal.open {
   display: flex;
}

.history-modal-dialog {
   width: min(720px, 100%);
   max-height: 90vh;
   display: flex;
   flex-direction: column;
   background-color: var(--main-white-color);
   border-radius: 10px;
   box-shadow: 0px 10px 30px rgba(0,0,0,0.25);
   overflow: hidden;
}

.history-modal-header {
   display: flex;
   justify-content: space-between;
   gap: 15px;
   align-items: flex-start;
   background-color: var(--main-black-color);
   color: var(--main-white-color);
   padding: 20px;
}

.history-modal-heading {
   display: flex;
   flex-direction: column;
   gap: 4px;
}

.history-modal-label {
   font-size: 0.75rem;
   letter-spacing: 1px;
   text-transform: uppercase;
   color: var(--light-grey-color2);
}

.history-modal-title {
   font-size: 1.4rem;
   font-weight: 600;
   color: var(--main-white-color);
}

.history-modal-equipment {
   font-size: 0.95rem;
   color: var(--light-grey-color1);
}

.history-modal-close-btn {
   border: none;
   background: transparent;
   color: var(--main-white-color);
   font-size: 1.4rem;
   cursor: pointer;
}

.history-modal-close-btn:hover {
   color: var(--main-orange-color);
}

.history-modal-body {
   padding: 20px;
   overflow-y: auto;
}

.history-modal-content {
   display: flex;
   flex-direction: column;
   gap: 12px;
}

.history-modal-empty {
   color: var(--light-grey-color2);
   text-align: center;
}

.history-entry-list {
   list-style: none;
   display: flex;
   flex-direction: column;
   gap: 12px;
   padding-left: 0px; /* Remove default list padding */
}

.history-entry-item {
   border: 1px solid var(--light-grey-color2);
   border-radius: 8px;
   padding: 12px 14px;
   background-color: var(--light-grey-color1);
}

.history-entry-header {
   display: flex;
   justify-content: space-between;
   flex-wrap: wrap;
   gap: 10px;
   margin-bottom: 8px;
}

.history-entry-date {
   font-weight: 600;
   color: var(--main-black-color);
}

.history-entry-type {
   font-weight: 500;
   color: var(--main-orange-color);
}

.history-entry-description {
   margin-bottom: 8px;
   color: var(--main-black-color);
}

.history-entry-meta {
   display: flex;
   flex-wrap: wrap;
   gap: 15px;
   font-size: 0.9rem;
   color: var(--light-grey-color2);
}

.history-entry-meta span {
   display: flex;
   align-items: center;
   gap: 6px;
}
/* End Table styling */

/* Form styling */
#entry-form-container {
   position: fixed;
   inset: 0;
   display: none;
   align-items: center;
   justify-content: center;
   background-color: rgba(0, 0, 0, 0.55);
   padding: 20px;
   z-index: 1000;
}
#entry-form-container.open-form-container {
   display: flex;
}
.entry-form-modal {
   width: min(520px, 100%);
   max-height: 90vh;
   overflow-y: auto;
   background-color: var(--main-white-color);
   border-radius: 8px;
   box-shadow: 0px 10px 30px rgba(0,0,0,0.25);
   /* padding: 8px; */
   display: flex;
   flex-direction: column;
   gap: 10px;
   
}
/* For WebKit browsers (Chrome, Safari, Edge, Opera) */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* For Firefox */
.hide-scrollbar {
  scrollbar-width: none;
}

/* For Internet Explorer and older Edge */
.hide-scrollbar {
  -ms-overflow-style: none;
}

#entry-form {
   display: flex;
   flex-direction: column;
   width: 100%;
   gap: 15px;
   padding: 8px;
}
.form-control:nth-last-child(2) {
   margin-bottom: 20px;
}
.form-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   width: 100%;
   background-color: var(--main-black-color);
   padding: 20px;
}
#entry-form-title {
   font-size: 1.1rem;
   color: var(--light-grey-color1);
}
#close-form-btn {
   font-size: 20px;
   color: var(--light-grey-color1);
   background: transparent;
   border: none;
   cursor: pointer;
}
#close-form-btn:hover {
   color: var(--main-orange-color);
   transition: all 0.3s ease-in-out;
}
.form-control {
   display: flex;
   justify-content: flex-start;
   align-items: center;
   flex-wrap: wrap;
   padding: 8px 10px;
   width: 100%;
}
label {
   width: 100%;
   font-weight: 500;
}
/* HIDE NUMBER INPUTS UP/DOWN ARROWS */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}
/* END HIDE NUMBER INPUTS UP/DOWN ARROWS */
input, textarea, select {
   border: 1px solid var(--light-grey-color2);
   background-color: var(--light-grey-color1);
   border-radius: 4px;
   padding: 5px 10px;
   height: 44px;
}
input[type=text]
input::placeholder, textarea::placeholder, select::placeholder {
   color: rgba(158, 158, 158, 0.5);
   font-weight: 500;
}
input:focus, input[type=number]:focus, input[type=text]:focus,  input[type=email]:focus, input[type=date]:focus, textarea:focus, select:focus {
   border: 2px solid #4aa5eb;
   outline: none;
   box-shadow: 0 0 4px 1px rgba(74, 165, 235, 0.8);
}
#equipment-description-input {
   width: 100%;
   text-transform: capitalize;
}
#service-description {
   width: 100%; 
   height: 80px;
}
#name-input {
   text-transform: capitalize;
}
#submit-button {
   padding: 15px 0;
   border-radius: 4px;
   border: none;
   color: var(--main-white-color);
   font-weight: 600;
   font-size: 18px;
   background-color: var(--main-orange-color);
   width: 100%;
}
#submit-button:hover {
   background-color: var(--orange-hover-color);
   transition: all 0.3s ease-in-out;
}
@media (max-width: 750px) {
   .entry-form-modal {
      width: 100%;
      max-height: 95vh;
      /* padding: 16px; */
   }
   .form-header {
      flex-direction: row;
      align-items: flex-start;
      gap: 10px;
   }
   #search-container {
      flex-direction: column;
      /* align-items: stretch; */
   }
   .search-bar-wrapper {
      width: 100%;
   }
   #new-form-btn {
      width: 100%;
   }
}
/* End form styling */

/* Start Success message styling */
.alert-success-container {
   display: flex;
   justify-content: center;
   align-items: center;
   flex-wrap: wrap;
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
   width: 350px;
   height: auto;
   background-color: var(--main-white-color);
   border-radius: 4px;
   border: 2px solid var(--light-grey-color2);
   padding: 18px;
   box-shadow: 0px 4px 15px 9px rgba(0,0,0,0.3);
   -webkit-box-shadow: 0px 4px 15px 9px rgba(0,0,0,0.3);
   -moz-box-shadow: 0px 4px 15px 9px rgba(0,0,0,0.3);
   transition: all 0.3s ease-in-out;
   z-index: 10;
}
.alert-success-title {
   display: block;
   text-align: center;
   font-size: 22px;
   font-weight: bold;
   color: rgb(19, 145, 19);
   margin-bottom: 15px;
   width: 100%;
}
.alert-success-message {
   text-align: center;
   font-weight: 500;
   color: #727272;
   width: 100%
}
.close-popup-btn {
   border-radius: 2px;
   border: none;
   color: #727272;
   font-size: 18px;
   font-weight: 600;  
   width: 100%;
   height: 50px;
   margin-top: 25px;
   cursor: pointer;
}
.close-popup-btn:hover {
   color: var(--main-white-color);
   background-color: var(--orange-hover-color);
   transition: all 0.3s ease-in-out;
}
/* END Success message styling */

/* START FOOTER STYLING */
footer {
   /* position: fixed;
   bottom: 0px; */
   width: 100%;
   height: 50px;
   margin-top: 20px;
   background-color: var(--main-black-color);
}
.footer-wrapper {
   display: flex;
   justify-content: space-between;
   align-items: center;
   width: 100%;
   height: 100%;
   padding: 20px;
}
.footer-col {
   font-size: 14px;
   color: var(--main-white-color);
}
/* ENDT FOOTER STYLING */


/* Responsive Styling */
@media screen and (max-width: 800px) {
   body {
      height: 100vh;
      gap: 0;
   }
   .page-title > h1 {
      font-size: 1rem;
   }
   #search-container {
      /* justify-content: center; */
      justify-content: flex-start;
      flex-direction: row;
   }
   .search-bar-wrapper {
      /* width: 100%; */
      width: 65%;
   }
   #search-input {
      padding-right: 140px;
      width: 100%;
   }
   #new-form-btn {
      /* width: 95%; */
      width: 30%;
}
/* #entry-form-container {
   min-height: 100%;
   } */
   .form-header > h1 {
      padding-left: 10px;
   }
   #entry-form-container {
      width: 100%;
   }
}

@media screen and (max-width: 1024px) {
   #equipment-log-table,
   #equipment-log-table thead,
   #equipment-log-table tbody,
   #equipment-log-table th,
   #equipment-log-table td,
   #equipment-log-table tr {
      display: block;
   }
   #table-container {
      border-radius: 8px;
   }
   #equipment-log-table {
      padding: 0px;
   }
   #equipment-log-table thead {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      border: 0;
      padding: 0;
      clip: rect(0 0 0 0);
      overflow: hidden;
   }

   #equipment-log-table tr {
      margin-bottom: 18px;
      border: 1px solid var(--light-grey-color2);
      border-radius: 10px;
      padding: 14px;
      box-shadow: 0 5px 15px rgba(0,0,0,0.08);
      background-color: var(--main-white-color);
   }

   #equipment-log-table td {
      border: none;
      position: relative;
      padding: 8px 10px 8px 125px;
      text-align: left;
      min-height: 28px;
      margin: 4px 0;
   }

   #equipment-log-table td:last-child {
      margin-bottom: 0;
   }

   #equipment-log-table td::before {
      content: attr(data-label);
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      width: 120px;
      font-weight: 600;
      color: var(--main-black-color);
      text-transform: uppercase;
      font-size: 0.75rem;
      letter-spacing: 0.5px;
   }

   .entry-log-num-col {
      display: none !important;
   }

   .entry-log-num-col,
   .edit-col {
      text-align: left;
   }

   .edit-col {
      margin-top: 12px;
   }

   .rental-id-wrapper {
      flex-direction: row;
      gap: 20px;
      width: 100%;
   }

   .view-history-btn {
      width: auto;
      align-self: flex-start;
   }
}
/* End Responsive Styling */
