/**
 * SOFTENG 350 Assignment 3, Group 1
 * Oliver Chamberlain, Tait Fuller, Di Kun Ong, Alex Verkerk
 */

/**
 * The decision was made to NOT use w3.css, as the library did not reflect the aesthetic
 * we wished to create with our prototype.
 * Using w3.css would have required the restyling of many of their provided classes,
 * which would have quickly gotten out of control as w3.css already does not respect
 * the cascade with its many !important statements.
 * 
 * Thus, the following CSS has been written entirely from scratch. No external libraries have been used.
 * Classes appear in the order that they are first used in the HTML document.
 * CSS classes have been separated by the purpose of their component, and there is as little
 * cross-dependency between components as possible to prevent cascade-related issues when
 * modifying classes.
 */

body {
  background-color: #FFF;
  color: #222;
  font-family: Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
}

/*------------------------------------*\
    #COMPONENTS
\*------------------------------------*/

/* Buttons */

button {
  align-items: center;
  background-color: transparent;
  border: 1px solid #9e9e9e;
  border-radius: 4px;
  display: flex;
  font: 1rem Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
  padding: 10px;
  text-align: center;
}

button:hover {
  background-color: rgba(158, 158, 158, 0.2);
  cursor: pointer;
}

/* User inputs */

input[type=search],
input[type=text] {
  background-color: rgba(158, 158, 158, 0.2);
  border: none;
  border-radius: 4px;
  font: 0.9rem Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
  padding: 12px;
}

select {
  background-color: rgba(158, 158, 158, 0.2);
  border-radius: 4px;
  border: none;
  font: 1rem Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
  padding: 0 12px;
}

select > option {
  background-color: #fff;
  color: #222;
}

textarea {
  background-color: rgba(158, 158, 158, 0.2);
  border: none;
  border-radius: 4px;
  font: 0.9rem Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
  padding: 12px;
  resize: none;
}

/* Icons - this is to ensure all Font Awesome icons are square */

.fa {
  padding: 4px;
}

/* People - the icons that appear to represent another user */

.persons-container {
  align-items: center;
  display: flex;
}

.person {
  background-color: #dfe1e6;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: bold;
  height: 24px;
  line-height: 24px;
  margin-left: 4px;
  width: 24px;
  text-align: center;
}

.person-large {
  height: 32px;
  line-height: 32px;
  margin: 0 8px 0 0;
  width: 32px;
}

.person-separator {
  border-right: 1px solid #9e9e9e;
  margin-right: 8px;
}

/* Progress bars - used for individual file progress tracking */

.progress-container {
  align-items: center;
  display: flex;
  flex-direction: row;
  grid-column: 2;
  grid-row: 2;
  padding: 8px;
  white-space: nowrap;
}

.progress-bar {
  background-color: #a6ccff;
  border-radius: 3px;
  height: 6px;
  margin: 0 8px;
  position: relative;
  width: 100%;
}

.progress-icon {
  color: #444;
}

.progress-bar-fill {
  background-color: #1a73e8;
  border-radius: 3px;
  display: block;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Tags */

.tag { /* Tag: Code */
  background-color: #1a73e8;
  border-radius: 4px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  padding: 1px 8px;
}

.tag-add { /* Tag: Add tag */
  background-color: transparent;
  border: 1px solid #9e9e9e;
  color: #222;
  padding: 1px 8px 1px 4px;
}

.tag-purple { /* Tag: Deliverable */
  background-color: #7b1fa2;
}

.tag-teal { /* Tag: Asset */
  background-color: #0097a7;
}

.tag-orange { /* Tag: In progress */
  background-color: #ffa000;
}

.tag-red { /* Tag: Needs review */
  background-color: #d32f2f;
}

.tag-green { /* Tag: Done */
  background-color: #388e3c;
}

/*------------------------------------*\
    #DIALOGS
\*------------------------------------*/

.dialog {
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.35);
  left: 50%;
  position: fixed;
  top: 50%;
  z-index: 15;
}

.dialog-share {
  animation: dialog--fadein 0.4s ease;
  display: none;
  height: 692px;
  margin: -346px 0 0 -350px;
  width: 700px;
}

.dialog-background {
  animation: dialog-background--fadein 0.4s ease;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 13;
}

/* Success toast/pop-up */

.dialog-success {
  animation: dialog-success--fadein 1s ease;
  background-color: #343a40;
  color: #fff;
  display: none;
  top: 90%;
  padding: 4px;
}

.dialog-success-container {
  align-items: center;
  display: flex;
  flex-direction: row;
}

.dialog-success-msg {
  margin: 0 16px;
}

.dialog-success-closebtn {
  border: none;
  border-radius: 50%;
  color: #fff;
  height: 48px;
  width: 48px;
}

.dialog-success-closebtn > .fa {
  padding: 1px 0 3px 6px;
}

/* The following classes are dynamically applied via JS to handle dialogs appearing/disappearing */

.dialog__show {
  display: block;
}

.dialog-share__hide {
  animation: dialog--fadeout 0.2s ease;
  margin-top: -316px;
  opacity: 0;
}

.dialog-background__hide {
  animation: dialog-background--fadeout 0.2s ease;
  opacity: 0;
}

.dialog-success__hide {
  animation: dialog-success--fadeout 0.2s ease;
  margin-top: 100px;
  opacity: 0;
}

.dialog-header {
  margin: 12px 0;
}

/*------------------------------------*\
    #SHARE
\*------------------------------------*/

.share-header {
  align-items: center;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.share-header-closebtn {
  border: none;
  border-radius: 50%;
  height: 48px;
  width: 48px;
}

.share-header-closebtn > .fa {
  padding: 1px 0 3px 6px;
}

/* Share with someone */

.share-block {
  align-items: center;
  border-bottom: 1px solid #9e9e9e;
  display: grid;
  gap: 12px 12px;
  grid-template-columns: 432px 216px;
  grid-template-rows: 48px 120px 48px;
  padding-bottom: 12px;
}

.share-block-last {
  border: none;
}

.share-input-person {
  grid-column: 1;
  grid-row: 1;
}

.share-input-person > input {
  width: 100%;
}

.share-input-permission {
  grid-column: 2;
  grid-row: 1;
}

.share-input-permission > select {
  height: 42px;
  width: 100%;
}

.share-input-permission > select:hover {
  background-color: rgba(158, 158, 158, 0.35);
}

.share-message > textarea {
  height: 120px;
  width: 100%;
}

.share-addsuggested {
  align-self: flex-start;
  font-size: 0.85rem;
}

.share-addsuggested-heading {
  margin: 0 0 16px 0;
}

.share-addsuggested-file {
  border-radius: 4px;
  cursor: pointer;
  padding: 8px;
}

.share-addsuggested-file:hover {
  background-color: rgba(158, 158, 158, 0.2);
}

.share-sharebtn {
  display: flex;
  grid-column: 2;
  grid-row: 3;
  justify-content: flex-end;
}

/* Manage access */

.manage-block {
  align-items: center;
  border-bottom: 1px solid #9e9e9e;
  display: grid;
  gap: 12px 12px;
  grid-template-columns: repeat(3, 212px);
  grid-template-rows: 20px 150px;
  padding-bottom: 12px;
}

.manage-list {
  background-color: rgba(158, 158, 158, 0.2);
  border-radius: 4px;
  font-size: 0.8rem;
  height: 100%;
  overflow-y: auto;
  padding: 8px;
  text-align: center;
}

/* Custom scrollbar styling - only works on Chrome unfortunately */
.manage-list::-webkit-scrollbar {
  width: 8px;
}

.manage-list::-webkit-scrollbar-track {
  background: transparent;
}

.manage-list::-webkit-scrollbar-thumb {
  background: #9e9e9e;
  border-radius: 4px;
}

.manage-list::-webkit-scrollbar-thumb:hover {
  background: #757575;
}

.manage-list::-webkit-scrollbar-thumb:active {
  background: #343a40;
}

.manage-list-placeholder {
  line-height: 134px;
  user-select: none;
}

.manage-list-person {
  align-items: center;
  border-radius: 4px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-bottom: 2px;
  padding: 4px;
}

.manage-list-person:hover {
  background-color: rgba(158, 158, 158, 0.35);
}

.manage-list-name {
  align-items: center;
  display: flex;
  flex-direction: row;
}

.manage-list-delete {
  border-radius: 50%;
  cursor: pointer;
  margin-right: 4px;
}

.manage-list-delete:hover {
  background-color: rgba(158, 158, 158, 0.5);
}

.manage-list-delete:active {
  background-color: rgba(158, 158, 158, 0.65);
}

.manage-list-delete > .fa {
  padding: 3px 5.8px 5px 5.8px;
}

/* Link sharing */

.link-block {
  align-items: center;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.link-config {
  height: 42px;
  margin-left: 8px;
}

/*------------------------------------*\
    #NAVBAR
\*------------------------------------*/

header {
  background-color: #343a40;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.28);
  color: #fff;
  display: flex;
  height: 60px;
  justify-content: space-between;
  position: fixed;
  width: 100%;
  z-index: 10;
}

.nav-zone {
  align-items: center;
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding: 0 20px;
}

.nav-item {
  margin-left: 24px;
}

.nav-btn {
  border: none;
  color: #fff;
}

.nav-dropdown {
  background-color: transparent;
  color: #fff;
  height: 48px;
}

.nav-dropdown:hover {
  background-color: rgba(158, 158, 158, 0.2);
}

.nav-dropdown > option {
  background-color: #fff;
  color: #222;
}

.nav-search {
  color: #fff;
  flex-grow: 1;
  max-width: 560px;
}

/*------------------------------------*\
    #PAGE LAYOUT
\*------------------------------------*/

/* The page is laid out using grid. The outer panes are a fixed size, while the middle Files pane
 * grows and shrinks 
 * While not truly responsive, this design works at any screen resolution above 1155 x 700.
 * The grid is as follows:
 *    project   timeline    timeline
 *    toolbar   toolbar     details
 *    tags      files       details
 */

main {
  align-content: stretch;
  display: grid;
  grid-template-columns: 350px minmax(420px, auto) 350px;
  grid-template-rows: 150px 54px auto;
  height: 100vh;
  padding-top: 60px;
}

/* Used to bind the top row (info and timeline) sections to cast a unified box-shadow */
main::before {
  box-shadow: 0 2px 4px 0px rgba(0, 0, 0, 0.28);
  content: "";
  grid-row: 1;
  grid-column: 1 / 4;
}

/* Used to hide horizontal scrollbars appearing due to minor overflow caused by element borders */
.column {
  overflow-x: hidden;
}

/* Custom scrollbar styling - only works on Chrome unfortunately */

.column::-webkit-scrollbar {
  width: 8px;
}

.column::-webkit-scrollbar-track {
  background: transparent;
}

.column::-webkit-scrollbar-thumb {
  background: #9e9e9e;
  border-radius: 4px;
}

.column::-webkit-scrollbar-thumb:hover {
  background: #757575;
}

.column::-webkit-scrollbar-thumb:active {
  background: #343a40;
}

.row-project {
  border-bottom: 1px solid #9e9e9e;
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
}

.row-timeline {
  border-left: 1px solid #9e9e9e;
  border-bottom: 1px solid #9e9e9e;
  grid-column: 2 / 4;
  grid-row: 1;
  z-index: 1;
}

.row-toolbar-tags {
  border-bottom: 1px solid #9e9e9e;
  grid-column: 1;
  grid-row: 2;
}

.row-toolbar-files {
  border-bottom: 1px solid #9e9e9e;
  grid-column: 2;
  grid-row: 2;
}

.col-tags {
  grid-column: 1;
  grid-row: 3;
}

.col-files {
  border-left: 1px solid #9e9e9e;
  grid-column: 2;
  grid-row: 3;
}

.col-details {
  background-color: #fff;
  border-left: 1px solid #9e9e9e;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.28);
  grid-column: 3;
  grid-row: 2 / 4;
}

/* Used in all rows/columns to space content away from the sides */
.container {
  margin: 0 20px;
}

/*------------------------------------*\
    #TIMELINE
\*------------------------------------*/

.timeline {
  display: flex;
  position: relative;
  justify-content: space-between;
}

.timeline-line {
  background-color: #5094ed;
  border-radius: 3px;
  height: 6px;
  left: 0;
  margin-top: 24px;
  position: absolute;
  top: -19px;
  width: 100%;
  z-index: 1;
}

.timeline-item {
  align-items: center;
  display: flex;
  flex-direction: column;
  z-index: 2;
}

.timeline-item-start {
  align-items: flex-start;
}

.timeline-item-end {
  align-items: flex-end;
  margin-top: -5px;
}

.timeline-marker {
  border-radius: 8px;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.35);
  background: #1a73e8;
  width: 16px;
  height: 16px;
  transition: ease 0.3s;
}

.timeline-marker:hover {
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.35);
  transition: ease 0.3s;
}

.timeline-marker-end {
  border-radius: 12px;
  width: 24px;
  height: 24px;
}

.timeline-label {
  margin-top: 8px;
}

.timeline-label-end {
  font-weight: bold;
}

/*------------------------------------*\
    #TOOLBAR
\*------------------------------------*/

.toolbar-container {
  align-items: center;
  display: flex;
  flex-direction: row;
  height: 100%;
  justify-content: space-between;
  padding: 0 8px;
}

.toolbar-actions {
  align-items: center;
  display: flex;
  flex-direction: row;
}

.toolbar-btn {
  border: none;
  color: #1a73e8;
  font-weight: bold;
}

/*------------------------------------*\
    #TAGS
\*------------------------------------*/

/* The list of filter tags is really an HTML unordered list styled to contain buttons */
.tags-list {
  align-content: stretch;
  display: flex;
  flex-direction: column;
  list-style: none;
  padding: 0;
}

.tags-item {
  margin-bottom: 12px;
}

.tags-btn {
  background-color: #fff;
  border: 1px solid #9e9e9e;
  font-size: 0.9rem;
  padding: 12px 16px;
  width: 100%;
}

.tags-btn-icon {
  padding-right: 16px;
}

.tags-btn-last {
  height: 50px;
  padding-left: 52px;
}

.tags-btn__selected {
  background-color: #e8f0fe;
  border: 1px solid #1a73e8;
}

.tags-btn__selected:hover {
  background-color: #edf3fe;
}

/*------------------------------------*\
    #FILES
\*------------------------------------*/

/* Files are laidout using inline-grid so that they reflow to fill as the screen changes size.
 * The grid is as follows:
 *    img   header
 *    img   progress-bar
 *    img   tags
 */
.file-card {
  animation: file--fadein 0.4s ease;
  border: 1px solid #9e9e9e;
  border-radius: 4px;
  cursor: pointer;
  display: inline-grid;
  grid-template-columns: 121px auto;
  grid-template-rows: repeat(3, 1fr);
  height: 122px;
  margin: 0 8px 12px 0px;
  transition: ease 0.3s;
  width: 380px;
}

.file-card:hover {
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.28);
  transition: ease 0.3s;
}

.file-card__selected {
  background-color: #e8f0fe;
  border: 1px solid #1a73e8;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.35);
}

.file-card__selected:hover {
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.35);
}

.file-img {
  border: none;
  border-right: 1px solid #9e9e9e;
  grid-column: 1;
  grid-row: 1 / 4;
}

.file-img > img {
  border-radius: 3px 0 0 3px;
  display: block;
  max-height: 100%;
  max-width: 100%;
}

/* The file header contains both the filename text, and the persons with access to that file */
.file-header {
  align-items: center;
  display: flex;
  flex-direction: row;
  font-size: 0.9rem;
  font-weight: bold;
  grid-column: 2;
  grid-row: 1;
  justify-content: space-between;
  padding: 10px;
}

.file-tag-container {
  align-items: center;
  display: flex;
  flex-direction: row;
  grid-column: 2;
  grid-row: 3;
  justify-content: flex-end;
  padding: 8px;
}

.file-tag-container > .tag {
  margin-left: 6px;
}

/*------------------------------------*\
    #DETAIL
\*------------------------------------*/

/* The detail pane is a sequence of block elements. As the column width is fixed, 
 * we can trust that there will be no unexpected overflow issues.
 */

.detail-preview {
  border-bottom: 1px solid #9e9e9e;
  height: 200px;
  line-height: 200px;
  text-align: center;
  user-select: none;
  width: 350px;
}

.detail-preview > img {
  display: block;
  max-height: 100%;
  width: 100%;
}

/* Used to separate "sections" of the detail pane. */
.detail-block {
  border-bottom: 1px solid #9e9e9e;
  padding-bottom: 18px;
}

.detail-block-last {
  border: none;
}

.detail-filename {
  margin-bottom: 12px;
}

.detail-tag-container {
  align-items: center;
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding-bottom: 10px;
}

.detail-tag-container > .tag {
  cursor: pointer;
  margin: 0 6px 6px 0;
  transition: ease 0.3s;
}

.detail-tag-container > .tag:hover {
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.28);
  transition: ease 0.3s;
}

.detail-attribute {
  display: flex;
  flex-direction: row;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.detail-attr-label {
  color: #343a40;
  flex: 0 0 130px;
}

.detail-attr-data {
  flex: 1 1 auto;
}

.detail-subheading {
  color: #343a40;
  margin: 18px 0;
}

.detail-block > .progress-container {
  padding: 0 0 8px 0;
}

.detail-task {
  align-items: center;
  border-radius: 4px;
  display: flex;
  flex-direction: row;
  font-size: 0.85rem;
  margin-bottom: 4px;
  padding: 2px 0;
}

.detail-task > input {
  margin: 0 12px 0 8px;
}

.detail-task-edit {
  cursor: pointer;
  transition: ease 0.3s;
}

.detail-task-edit:hover {
  background-color: #dfe1e6;
  transition: ease 0.3s;
}

.detail-task-edit > i {
  margin: 0 8px 0 5px;
}

.detail-history {
  align-items: center;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  font-size: 0.85rem;
  margin-bottom: 4px;
  padding: 12px 0;
  transition: ease 0.3s;
}

.detail-history:hover {
  background-color: #dfe1e6;
  transition: ease 0.3s;
}

.detail-history-icon {
  flex-basis: 42px;
  padding: 0 16px 0 5px;
  text-align: center;
}

.detail-history-time {
  flex: 1 0 170px;
}

.detail-history-diff {
  flex: 1 0 75px;
  padding-right: 12px;
  text-align: right;
}

.detail-history-add {
  color: #388e3c;
}

.detail-history-del {
  color: #d32f2f;
}

/*------------------------------------*\
    #ANIMATION-KEYFRAMES
\*------------------------------------*/

/* Fade-in and fade-out animations were added to all dynamically appearing elements
 * to increase the fluidity of the UI.
 * All animations are applied at 200-400ms duration to maintain efficiency.
 */

@keyframes dialog--fadein {
    
    from {
        opacity: 0;
        margin-top: -316px;
    }
    
    to {
        opacity: 1;
        margin-top: -346px;
    }
    
}

@keyframes dialog--fadeout {
    
    from {
        opacity: 1;
        margin-top: -346px;
    }
    
    to {
        opacity: 0;
        margin-top: -316px;
    }
    
}

@keyframes dialog-background--fadein {
    
    from {
        opacity: 0;
    }
    
    to {
        opacity: 1;
    }
    
}

@keyframes dialog-background--fadeout {
    
    from {
        opacity: 1;
    }
    
    to {
        opacity: 0;
    }
    
}

@keyframes dialog-success--fadein {
    
    from {
        opacity: 0;
        margin-top: 100px;
    }
    
    to {
        opacity: 1;
        margin-top: 0;
    }
    
}

@keyframes dialog-success--fadeout {
    
    from {
        opacity: 1;
        margin-top: 0;
    }
    
    to {
        opacity: 0;
        margin-top: 100px;
    }
    
}

@keyframes file--fadein {
    
    from {
        opacity: 0;
        margin-top: 20px;
    }
    
    to {
        opacity: 1;
        margin-top: 0;
    }
    
}