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

.app {
  color: #FAFAFA; /* grey50 */
  font-family: BlinkMacSystemFont, 'Helvetica Neue', Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5em;
}

.app.is-win32 {
  font-family: 'Segoe UI', sans-serif;
}

#body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

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;
  height: 100%;
  display: flex;
  flex-flow: column;
  background: rgb(30, 30, 30);
  animation: fadein 0.5s;
}

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

/*
 * MATERIAL ICONS
 */

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url('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;
  opacity: 0.85;

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

.icon.disabled {
  opacity: 0.3;
}

.icon:not(.disabled):hover {
  opacity: 1;
}

/*
 * UTILITY CLASSES
 */

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

.float-left {
  float: left;
}

.float-right {
  float: right;
}

/*
 * HEADER
 */

.header {
  -webkit-app-region: drag;
  background: rgb(40, 40, 40);
  border-bottom: 1px solid rgb(30, 30, 30);
  height: 38px; /* vertically center OS menu buttons (OS X) */
  padding-top: 7px;
  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 {
  background: rgba(40, 40, 40, 0.8);
  border-bottom: none;
}

.app.view-player.is-win32 .header,
.app.view-player.is-linux .header {
  background: none;
}

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

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

.header .nav {
  font-weight: bold;
}

.header .nav.left {
  margin-left: 10px;
}

.header .nav.right {
  margin-right: 10px;
}

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

.header .back,
.header .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: 38px;
}

.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: 38px;
  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: #eee;
  color: #222;
  padding: 20px;
}

.modal label {
  font-weight: bold;
}

.create-torrent {
  padding: 10px 25px;
  overflow: hidden;
}

.create-torrent .torrent-attribute {
  white-space: nowrap;
  margin: 8px 0;
}

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

.create-torrent .torrent-attribute label {
  width: 100px;
  vertical-align: top;
}

.create-torrent .torrent-attribute>div {
  width: calc(100% - 100px);
}

.create-torrent .torrent-attribute div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*
 * BUTTONS
 */

a,
i { /* Links and icons */
  cursor: default;
  -webkit-app-region: no-drag;
}

a:not(.disabled):hover,
i:not(.disabled):hover { /* Show they're clickable without pointer: cursor */
  -webkit-filter: brightness(1.3);
}

/*
 * INPUTS
 */
input,
textarea,
.control {
  font-size: 14px !important;
}

/*
 * TORRENT LIST
 */

.torrent-list {
  height: 100%;
}

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

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

.torrent:not(:last-child) {
  border-bottom: 1px solid #282828;
}

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

.torrent .metadata span:not(:last-child)::after {
  content: ' • ';
  opacity: 0.7;
  padding-left: 4px;
  padding-right: 4px;
}

.torrent:hover .metadata {
  width: calc(100% - 120px);
}

.torrent .torrent-controls {
  display: none;
}

.torrent:hover .torrent-controls {
  display: block;
}

.torrent .play {
  position: absolute;
  top: 23px;
  right: 45px;
  font-size: 55px;
}

.torrent .delete {
  position: absolute;
  top: 38px;
  right: 12px;
}

.torrent .download {
  vertical-align: -0.4em;
  margin-left: -2px;
}

.torrent .buttons .radial-progress {
  position: absolute;
}

.torrent .name {
  font-size: 20px;
  font-weight: bold;
  line-height: 1.5em;
  margin-bottom: 6px;
}

.torrent hr {
  position: absolute;
  bottom: 5px;
  left: calc(50% - 20px);
  width: 40px;
  height: 1px;
  background: #ccc;
  display: none;
  margin: 0;
  padding: 0;
  border: none;
}

.torrent:hover hr {
  display: block;
}

/*
 * TORRENT LIST: ERRORS
 */

.torrent-list p {
  margin: 10px 20px;
}

.torrent-list a {
  color: #99f;
  text-decoration: none;
}

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

.torrent-details .warning {
  padding-left: 15px;
}

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

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

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

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

.torrent-details td.col-icon {
  width: 45px;
  padding-left: 16px;
}

.torrent-details td.col-icon .radial-progress {
  position: absolute;
  margin-top: 4px;
  margin-left: 0.5px;
}

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

.torrent-details td.col-progress {
  width: 60px;
  text-align: right;
}

.torrent-details td.col-size {
  width: 60px;
  text-align: right;
}

.torrent-details td.col-select {
  width: 45px;
  padding-right: 13px;
  text-align: right;
}

/*
 * PLAYER
 */

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

.player .letterbox {
  width: 100%;
  height: 100%;
  display: flex;
  background-size: cover;
  background-position: center;
}

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

.player .name {
  font-size: 20px;
  font-weight: bold;
  line-height: 1.5em;
  margin-bottom: 6px;
}

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

.player .controls .icon {
  display: block;
  margin: 8px;
  font-size: 22px;
  opacity: 0.85;

  /* Make all icons have uniform spacing */
  max-width: 23px;
  overflow: hidden;
}

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

.player .controls .icon.disabled {
  opacity: 0.3;
}

.player .controls .icon.skip-previous,
.player .controls .icon.play-pause,
.player .controls .icon.skip-next {
  font-size: 28px;
  margin: 5px;
}

.player .controls .volume-slider {
  -webkit-appearance: none;
  -webkit-app-region: no-drag;
  width: 60px;
  height: 3px;
  margin: 18px 8px 8px 0;
  border: none;
  padding: 0;
  opacity: 0.85;
  vertical-align: sub;
}

.player .controls .time,
.player .controls .rate {
  font-weight: 100;
  font-size: 13px;
  margin: 9px 8px 8px 8px;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

.player .controls .icon.closed-caption {
  font-size: 26px;
  margin-top: 6px;
}

.player .controls .icon.multi-audio {
  font-size: 26px;
  margin-top: 6px;
}

.player .controls .icon.fullscreen {
  font-size: 26px;
  margin-right: 15px;
  margin-top: 6px;
}

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

.app.hide-video-controls .player {
  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: -3px;
  background-color: #FFF;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  margin-top: 0;
  margin-left: 0;
  transition-property: width, height, top, margin-left;
  transition-duration: 0.1s;
  transition-timing-function: ease-out;
}

.player .controls .closed-caption.active,
.player .controls .device.active {
  color: #9af;
}

.player .controls .volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  -webkit-app-region: no-drag;
  background-color: #fff;
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.player .controls .volume-slider:focus {
  outline: none;
}

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

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

.player .controls .options-list {
  position: fixed;
  background: rgba(40, 40, 40, 0.8);
  min-width: 100px;
  bottom: 45px;
  right: 3px;
  transition: opacity 0.15s ease-out;
  padding: 5px 10px;
  border-radius: 3px;
  margin: 0;
  list-style-type: none;
  color: rgba(255, 255, 255, 0.8);
}

.player .controls .options-list .icon {
  display: inline;
  font-size: 17px;
  vertical-align: bottom;
  line-height: 21px;
  margin: 4px;
}

/**
 * Set the cue text position so it appears above the player controls.
 */
video::-webkit-media-text-track-container {
  bottom: 60px;
  transition: bottom 0.1s ease-out;
}
.app.hide-video-controls video::-webkit-media-text-track-container {
  bottom: 30px;
}
::cue {
  background: none;
  color: #FFF;
  text-shadow: #000 -1px 0 1px, #000 1px 0 1px, #000 0 -1px 1px, #000 0 1px 1px, rgba(50, 50, 50, 0.5) 2px 2px 0;
}

/*
 * 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;
  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: spinning 1.1s infinite linear;
}

@keyframes spinning {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.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: 120px;
  text-align: right;
  font-weight: normal;
  margin-right: 25px;
}

.audio-metadata .audio-format,
.audio-metadata .audio-comments {
  font-weight: normal;
}

/*
 * ERRORS
 */

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

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

.error-text {
  color: #c44;
}

/*
 * RADIAL PROGRESS BAR
 */

.radial-progress {
  width:  16px;
  height: 16px;
  border-radius: 50%;
  background-color: #888;
}

.radial-progress .circle .mask,
.radial-progress .circle .fill {
  width:    16px;
  height:   16px;
  position: absolute;
  border-radius: 50%;
  -webkit-backface-visibility: hidden;
}

.radial-progress .circle .mask {
  clip: rect(0px, 16px, 16px, 8px);
}

.radial-progress .circle .fill {
  clip: rect(0px, 8px, 16px, 0px);
  background-color: white;
}

.radial-progress .inset {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: 2px 0 0 2px;
  border-radius: 50%;
  background-color: black;
}

.radial-progress-large {
  width:  40px;
  height: 40px;
}

.radial-progress-large .circle .mask,
.radial-progress-large .circle .fill {
  width:  40px;
  height: 40px;
}
.radial-progress-large .circle .mask {
  clip: rect(0px, 40px, 40px, 20px);
}

.radial-progress-large .circle .fill {
  clip: rect(0px, 20px, 40px, 0px);
  background-color: white;
}

.radial-progress-large .inset {
  width: 32px;
  height: 32px;
  margin: 4px 0 0 4px;
}

/**
 * Use this class on Material UI components to get correct native app behavior:
 *
 * - Dragging the button should NOT drag the entire app window
 * - The cursor should be default, not a pointer (hand) like on the web
 */

.control {
  -webkit-app-region: no-drag;
  cursor: default !important;
}

.control * {
  cursor: default !important;
}
