/*
 * BASIC STYLES
 */

*,
*:after,
*:before {
  box-sizing: border-box;
}

html,
body {
  background: rgb(40, 40, 40);
  cursor: default;
  height: 100%;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
}

body {
  color: #FFF;
  font-family: BlinkMacSystemFont, 'Helvetica Neue', Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5em;
}

table {
  table-layout: fixed;
}

::-webkit-scrollbar {
  width: 10px;
  background-color: rgb(40, 40, 40);
}

::-webkit-scrollbar-corner {
  background-color: rgb(40, 40, 40);
}

::-webkit-scrollbar-thumb {
  border: 1px solid rgb(40, 40, 40);
  border-radius: 10px;
  background: linear-gradient(to right, rgb(90, 90, 90), rgb(80, 80, 80))
}

::-webkit-scrollbar-track {
  background-color: rgb(40, 40, 40);
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}


.app {
  -webkit-user-select: none;
  -webkit-app-region: drag;
  height: 100%;
  display: flex;
  flex-flow: column;
  animation: fadein 0.3s;
  background: rgb(40, 40, 40);
}

.app:not(.is-focused) {
  background: rgb(50, 50, 50);
}

/*
 * MATERIAL ICONS
 */

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: local('Material Icons'),
       local('MaterialIcons-Regular'),
       url(../static/MaterialIcons-Regular.woff2) format('woff2');
}

.icon {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;  /* Preferred icon size */
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/*
 * UTILITY CLASSES
 */

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disabled {
  opacity: 0.3;
}

/*
 * BUTTONS
 */

a,
i {
  cursor: default;
  -webkit-app-region: no-drag;
}

a:not(.disabled):hover,
i:not(.disabled):hover {
  -webkit-filter: brightness(1.3);
}

.btn {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  font-size: 22px;
  transition: all 0.1s ease-out;
  text-align: center;
}

/*
 * HEADER
 */

.header {
  background: rgb(40, 40, 40);
  border-bottom: 1px solid rgb(20, 20, 20);
  height: 37px; /* vertically center OS menu buttons (OS X) */
  padding-top: 6px;
  overflow: hidden;
  flex: 0 1 auto;
  opacity: 1;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  transition: opacity 0.15s ease-out;
  font-size: 14px;
  line-height: 1.5em;
  z-index: 1;
}

.app:not(.is-focused) .header {
  background: rgb(50, 50, 50);
}

.app.view-player .header {
  opacity: 0.8;
}

.app.hide-video-controls.view-player .header {
  opacity: 0;
  cursor: none;
}

.app.hide-header .header {
  display: none;
}

.header .title {
  opacity: 0.6;
  position: absolute;
  margin-top: 1px;
  padding: 0 150px 0 150px;
  width: 100%;
  text-align: center;
  pointer-events: none;
}

.header .nav {
  font-weight: bold;
  margin-right: 9px;
}

.header .nav.left {
  float: left;
}

.app.is-darwin:not(.is-fullscreen) .header .nav.left {
  margin-left: 78px;
}

.header .nav.right {
  float: right;
}

.header .nav * {
  opacity: 0.6;
}

.header .nav .disabled {
  opacity: 0.1;
}

.header .nav *:not(.disabled):hover {
  opacity: 1;
}

.header .nav .back,
.header .nav .forward {
  font-size: 30px;
  margin-top: -3px;
}

/*
 * CONTENT
 */

.content {
  position: relative;
  width: 100%;
  overflow-x: hidden;
  overflow-y: overlay;
  flex: 1 1 auto;
  margin-top: 37px;
}

.app.view-player .content {
  margin-top: 0;
}

/*
 * MODAL POPOVERS
 */

.modal {
  z-index: 2;
}

.modal .modal-background {
  content: ' ';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0.5;
}

.modal .modal-content {
  position: fixed;
  top: 45px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: calc(100% - 20px);
  max-width: 600px;
  box-shadow: 2px 2px 10px 0px rgba(0,0,0,0.4);
  background-color: white;
  color: #222;
  padding: 20px;
}

.create-torrent-modal input,
.open-torrent-address-modal input {
  width: calc(100% - 100px)
}

.create-torrent-modal .torrent-attribute {
  white-space: nowrap;
}

.create-torrent-modal .torrent-attribute>* {
  display: inline-block;
}

.create-torrent-modal .torrent-attribute label {
  width: 60px;
  margin-right: 10px;
  vertical-align: top;
}

.create-torrent-modal .torrent-attribute div {
  font-family: Consolas, monospace;
  white-space: nowrap;
}



/*
 * BUTTONS
 */

button {
  background: transparent;
  margin-left: 10px;
  padding: 0;
  border: none;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  color: #aaa;
}

button.primary {
  color: #0cf;
}

button:hover {
  -webkit-filter: brightness(1.1);
}

button:active {
  -webkit-filter: brightness(1.1);
  text-shadow: none;
}

/*
 * OTHER FORM ELEMENT DEFAULTS
 */

input {
  background: transparent;
  width: 300px;
  padding: 6px;
  border: 1px solid #bbb;
  border-radius: 3px;
  box-shadow: 1px 1px 1px 0px rgba(0,0,0,0.1);
}

/*
 * TORRENT LIST
 */

.torrent {
  background: linear-gradient(to bottom right, #4B79A1, #283E51);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: 0 50%;
  transition: -webkit-filter 0.1s ease-out;
  position: relative;
  animation: fadein .4s;
}

.torrent,
.torrent-placeholder {
  height: 120px;
}

.torrent:not(:last-child) {
  border-bottom: 1px solid rgb(20, 20, 20);
}

.torrent:hover {
  -webkit-filter: brightness(1.1);
}

.torrent .metadata {
  position: absolute;
  top: 20px;
  left: 20px;
  width: calc(100% - 150px);
  text-shadow: rgba(0, 0, 0, 0.5) 0 0 4px;
}

.torrent .metadata span:not(:last-child)::after {
  content: ' — ';
}

.torrent .buttons {
  position: absolute;
  top: 25px;
  right: 10px;
  align-items: center;
  display: none;
}

.torrent:hover .buttons {
  display: flex;
}

.torrent .buttons > * {
  margin-left: 6px; /* space buttons apart */
}

.torrent .buttons .download {
  background-color: #2233BB;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  font-size: 18px;
  padding-top: 6px;
}

.torrent .buttons .download.downloading {
  animation-name: greenpulse;
  animation-duration: 0.8s;
  animation-direction: alternate;
  animation-iteration-count: infinite;
}

@keyframes greenpulse {
  0% {
    color: #ffffff;
    padding-top: 4px;
  }
  100% {
    color: #44dd44;
    padding-top: 6px;
  }
}

.torrent .buttons .download.seeding {
  color: #44dd44;
}

.torrent .buttons .play {
  padding-top: 10px;
  background-color: #F44336;
}

.torrent.timeout .play {
  padding-top: 8px;
}

.torrent.requested .play,
.loading-spinner {
  border-top: 6px solid rgba(255, 255, 255, 0.2);
  border-right: 6px solid rgba(255, 255, 255, 0.2);
  border-bottom: 6px solid rgba(255, 255, 255, 0.2);
  border-left: 6px solid #ffffff;
  border-radius: 50%;
  color: transparent;
  animation: load8 1.1s infinite linear;
}

@keyframes load8 {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.torrent .buttons .delete {
  opacity: 0.5;
}

.torrent .buttons .delete:hover {
  opacity: 0.7;
}

.torrent .name {
  font-size: 1.5em;
  font-weight: bold;
  line-height: 1.5em;
}

.torrent .status,
.torrent .status2 {
  font-size: 1em;
  line-height: 1.5em;
}

/*
 * TORRENT LIST: DRAG-DROP TARGET
 */

.torrent-placeholder {
  padding: 10px;
  font-size: 1.1em;
}

.torrent-placeholder span {
  border: 5px #444 dashed;
  border-radius: 5px;
  color: #666;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.drag .torrent-placeholder span {
  border-color: #def;
  color: #def;
}

body.drag .app::after {
  content: ' ';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 3;
}

/*
 * TORRENT LIST: EXPANDED TORRENT DETAILS
 */
.torrent.selected {
  height: auto;
}

.torrent-details {
  padding: 8em 20px 20px 20px;
}

.torrent-details .open-folder {
  float: right;
}

.torrent-details table {
  width: 100%;
  white-space: nowrap;
  border: none;
  border-spacing: 0;
}

.torrent-details tr {
  height: 28px;
}

.torrent-details tr:hover,
.torrent-details .open-folder:hover {
  background-color: rgba(200, 200, 200, 0.3);
}

.torrent-details td {
  overflow: hidden;
  padding: 0;
  vertical-align: bottom;
}

.torrent-details td.col-icon {
  width: 2em;
}

.torrent-details td.col-icon .icon {
  font-size: 18px;
  position: relative;
  top: 3px;
}

.torrent-details td.col-name {
  width: auto;
  text-overflow: ellipsis;
}

.torrent-details td.col-progress {
  width: 4em;
  text-align: right;
}

.torrent-details td.col-size {
  width: 4em;
  text-align: right;
}

/*
 * PLAYER
 */

.player {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #000;
}

.player .letterbox {
  width: 100%;
  height: 100%;
  display: flex;
}

.player video {
  display: block;
  width: 100%;
}

/*
 * PLAYER CONTROLS
 */

.player-controls {
  position: fixed;
  background: rgba(40, 40, 40, 0.8);
  width: 100%;
  height: 38px;
  bottom: 0;
  transition: opacity 0.15s ease-out;
}

.app.hide-video-controls .player-controls {
  opacity: 0;
}

.app.hide-video-controls .player {
  cursor: none;
}

.app.hide-video-controls .player .player-controls:hover {
  opacity: 1;
  cursor: default;
}

/* invisible click target for scrubbing */
.player-controls .scrub-bar {
  position: absolute;
  width: 100%;
  height: 23px; /* 3px .loading-bar plus 10px above and below */
  top: -10px;
  left: 0;
  -webkit-app-region: no-drag;
}

.player-controls .loading-bar {
  position: relative;
  width: 100%;
  top: -3px;
  height: 3px;
  background-color: rgba(0, 0, 0, 0.3);
  transition: all 0.1s ease-out;
  position: absolute;
}

.player-controls .loading-bar-part {
  position: absolute;
  background-color: #dd0000;
  top: 0;
  height: 100%;
}

.player-controls .playback-cursor {
  position: absolute;
  top: -3px;
  background-color: #FFF;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  margin-top: 0;
  margin-left: 0;
  transition-property: width, height, border-radius, margin-top, margin-left;
  transition-duration: 0.1s;
  transition-timing-function: ease-out;
}

.player-controls .play-pause {
  display: block;
  width: 30px;
  height: 30px;
  padding: 5px;
  margin: 0 auto;
}

.player-controls .chromecast,
.player-controls .airplay,
.player-controls .fullscreen,
.player-controls .back {
  display: block;
  width: 20px;
  height: 20px;
  margin: 5px;
}

.player-controls .back {
  float: left;
}

.player-controls .chromecast,
.player-controls .airplay,
.player-controls .fullscreen {
  float: right;
}

.player-controls .fullscreen {
  margin-right: 15px;
}

.player-controls .chromecast,
.player-controls .airplay {
  font-size: 18px; /* make the cast icons less huge */
  margin-top: 8px !important;
}

.player-controls .chromecast.active,
.player-controls .airplay.active {
  color: #9af;
}

.player .playback-bar:hover .loading-bar {
  height: 5px;
}

.player .playback-bar:hover .playback-cursor {
  top: -8px;
  width: 14px;
  height: 14px;
}

/*
 * CHROMECAST / AIRPLAY CONTROLS
 */

.cast-screen {
  width: 100%;
  height: 200px;
  color: #eee;
  text-align: center;
  line-height: 2;
  align-self: center;
}

.cast-screen .icon {
  font-size: 50px;
}

.cast-screen .cast-type,
.cast-screen .cast-status {
  font-size: 32px;
}

.cast-screen .cast-type {
  font-weight: bold;
}

/*
 * MEDIA OVERLAY / AUDIO DETAILS
 */

.media-overlay-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  background-size: cover;
  background-position: center center;
}

.media-overlay {
  max-width: calc(100% - 80px);
  white-space: nowrap;
  text-overflow: ellipsis;
  align-self: center;
  margin: 0 auto;
  font-weight: bold;
  font-size: 24px;
  line-height: 2;
}

.media-stalled .loading-spinner {
  width: 40px;
  height: 40px;
  margin: 40px auto;
}

.media-stalled .loading-status {
  font-size: 18px;
  font-weight: normal;
  text-align: center;
}

.audio-metadata div {
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-metadata .audio-title {
  font-size: 32px;
}

.audio-metadata label {
  display:inline-block;
  width: 100px;
  text-align: right;
  font-weight: normal;
  margin-right: 25px;
}

/*
 * ERRORS
 */

.error-popover {
  position: fixed;
  top: 36px;
  margin: 0;
  width: 100%;
  overflow: hidden;
  z-index: 1;
}

.app.hide-header .error-popover {
  top: 0px;
}

.error-popover.hidden {
  display: none;
}

.error-popover .error,
.error-popover .title {
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.8);
  border-bottom: 1px solid #444;
}

.error-popover .title {
  font-weight: bold;
  color: #c44;
}

.error-popover .error {
  color: #bbb;
}

.error-popover .error:last-child {
  border-bottom: none;
}

/*
 * MEDIA QUERIES
 */

@media only screen and (min-width: 700px) {
  body {
    font-size: 16px;
    line-height: 1.5em;
  }
  .torrent,
  .torrent-placeholder {
    height: 150px;
  }
}

@media only screen and (min-width: 900px) {
  body {
    font-size: 18px;
    line-height: 1.5em;
  }
  .torrent,
  .torrent-placeholder {
    height: 180px;
  }
}
