/*
 * BASIC STYLES
 */

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

html,
body {
  background: rgb(40, 40, 40);
  color: #FFF;
  cursor: default;
  height: 100%;
  font-family: BlinkMacSystemFont, 'Helvetica Neue', Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5em;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
}

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

/*
 * MATERIAL ICONS
 */

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: local('Material Icons'),
       local('MaterialIcons-Regular'),
       url(../vendor/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;
}

.view-player .header {
  opacity: 0;
}

.view-player:hover .header:not(.hide) {
  opacity: 0.8;
  cursor: default;
}

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

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

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

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

body.drag::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(255, 0, 0, 0.3);
  border: 5px #f00 dashed;
}

/*
 * 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-list {
  padding-top: 37px;
}

.get-started {
  opacity: .5;
  padding: 24px;
  margin: 6px;
  text-align: center;
  border: 5px #444 dashed;
  flex: 1 1 auto;
}

.lead {
  font-size: 150%;
}

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

.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;
  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 > :not(:first-child) {
  margin-left: 10px; /* space buttons by 10px */
}

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

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

.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;
  opacity: 0;
  transition: all 0.15s ease-out;
}

.player:hover .player-controls {
  opacity: 1;
}

.player.hide:hover .player-controls {
  opacity: 0;
}

.player.hide {
  cursor: none;
}

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