/*
 * 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;
}

::-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);
}

.loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

.loading .icon {
  font-size: 42px;
  display: block;
  text-align: center;
  animation: spin-ccw 2s infinite linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spin-ccw {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0deg); }
}

@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;
  z-index: 1000;
  transition: opacity 0.15s ease-out;
  font-size: 14px;
  line-height: 1.5em;
}

.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;
}

.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: 7px;
}

.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: auto;
  flex: 1 1 auto;
  margin-top: 37px;
}

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

/*
 * MODAL POPOVERS
 */

.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;
}

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

/*
 * 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);
}

/*
 * 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%;
}

/*
 * TORRENT LIST
 */

.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;
}

.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% - 100px);
  text-shadow: rgba(0, 0, 0, 0.5) 0 0 4px;
}

.torrent .buttons {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  align-items: center; /* flexbox: center buttons vertically */
  display: none;
}

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

.torrent .buttons > * {
  margin-right: 6px; /* space buttons apart, align the Xs under the + */
}

.torrent .buttons .download {
  background-color: #2233BB;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  font-size: 18px;
  padding-top: 6px;
  margin-right: 10px; /* download and play btns need more space to look good */
}

.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 {
  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 .name {
  font-size: 1.5em;
  font-weight: bold;
  line-height: 1.5em;
}

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

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

/*
 * 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: -8px;
  background-color: #FFF;
  width: 0;
  height: 0;
  border-radius: 0;
  margin-top: 7px;
  margin-left: 7px;
  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: 20px;
  height: 20px;
  margin: 5px 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 .chromecast,
.player-controls .airplay {
  font-size: 18px; /* make the cast icons less huge */
  margin-top: 8px !important;
}

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

.player .playback-bar:hover .playback-cursor {
  width: 14px;
  height: 14px;
  border-radius: 7px;
  margin-top: 0;
  margin-left: 0;
}

/*
 * 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;
  }
}
