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

#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;
  -webkit-app-region: drag;
  height: 100%;
  display: flex;
  flex-flow: column;
  background: rgb(40, 40, 40);
  animation: fadein 0.5s;
}

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

.expand-collapse.expanded::before {
  content: '▲'
}

.expand-collapse.collapsed::before {
  content: '▼'
}

.expand-collapse::before {
  margin-right: 5px;
}

.expand-collapse.collapsed {
  display: block;
}

.collapsed {
  display: none;
}

/*
 * HEADER
 */

.header {
  background: rgb(40, 40, 40);
  border-bottom: 1px solid rgb(20, 20, 20);
  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: 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: 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;
}

.open-torrent-address-modal input {
  width: 100%;
}

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

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

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

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

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

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

.create-torrent .torrent-attribute textarea {
  width: calc(100% - 80px);
  height: 80px;
  color: #eee;
  background-color: transparent;
  line-height: 1.5;
  font-size: 14px;
  font-family: inherit;
  border-radius: 2px;
  padding: 4px 6px;
}

.create-torrent textarea.torrent-trackers {
  height: 200px;
}

.create-torrent input.torrent-is-private {
  margin: 0;
}

/*
 * BUTTONS
 * See https://www.google.com/design/spec/components/buttons.html
 */

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

.button-round { /* Circular icon buttons, used on <i> tags */
  width: 40px;
  height: 40px;
  border-radius: 20px;
  font-size: 22px;
  transition: all 0.1s ease-out;
  text-align: center;
}

button { /* Rectangular text buttons */
  background: transparent;
  margin-left: 10px;
  padding: 0;
  border: none;
  border-radius: 3px;
  font-size: 14px;
  font-weight: bold;
  color: #aaa;
  outline: none;
}

button.button-flat {
  color: #222;
  padding: 7px 18px;
}

button.button-flat.light {
  color: #eee;
}

button.button-flat:hover,
button.button-flat:focus { /* Material design: focused */
  background-color: rgba(153, 153, 153, 0.2);
}

button.button-flat:active { /* Material design: pressed */
  background-color: rgba(153, 153, 153, 0.4);
}

button.button-raised {
  background-color: #2196f3;
  color: #eee;
  padding: 7px 18px;
}

button.button-raised:hover,
button.button-raised:focus {
  background-color: #38a0f5;
}

button.button-raised:active {
  background-color: #51abf6;
}

/*
 * OTHER FORM ELEMENT DEFAULTS
 */

input[type='text'] {
  background: transparent;
  width: 300px;
  padding: 6px;
  border: 1px solid #bbb;
  border-radius: 3px;
  outline: none;
}

/*
 * TORRENT LIST
 */

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

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

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

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

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

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

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

.torrent .buttons {
  position: absolute;
  top: 29px;
  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 {
  color: #44dd44;
}

.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 .play.resume-position {
  position: relative;
  -webkit-clip-path: circle(18px at center);
}

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

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

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

.torrent .name {
  font-size: 18px;
  font-weight: bold;
  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 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 tr:hover {
  background-color: rgba(200, 200, 200, 0.3);
}

.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 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 .play-pause {
  font-size: 28px;
  margin-top: 5px;
  margin-right: 10px;
  margin-left: 15px;
}

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

.player .controls .icon.closed-caption {
  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;
}

/* TODO: find better way to handle this (that also
 * keeps the header visible too).
 */
.app.hide-video-controls .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, 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;
}

/*
 * Preferences page, based on Atom settings style
 */

.preferences {
  font-size: 12px;
  line-height: calc(10/7);
}

.preferences .text {
  color: #a8a8a8;
}

.preferences .icon {
  color: rgba(170, 170, 170, 0.6);
  font-size: 16px;
  margin-right: 0.2em;
}

.preferences .btn {
  display: inline-block;
  -webkit-appearance: button;
  margin: 0;
  font-weight: normal;
  text-align: center;
  vertical-align: middle;
  border-color: #cccccc;
  border-radius: 3px;
  color: #9da5b4;
  text-shadow: none;
  border: 1px solid #181a1f;
  background-color: #3d3d3d;
  white-space: initial;
  font-size: 0.889em;
  line-height: 1;
  padding: 0.5em 0.75em;
}

.preferences .btn .icon {
  margin: 0;
  color: #a8a8a8;
}

.preferences .help .icon {
  vertical-align: sub;
}


.preferences .preferences-panel .control-group + .control-group {
  margin-top: 1.5em;
}

.preferences .section {
  padding: 20px;
  border-top: 1px solid #181a1f;
}

.preferences .section:first {
  border-top: 0px;
}

.preferences .section:first-child,
.preferences .section:last-child {
  padding: 20px;
}

.preferences .section.section:empty {
  padding: 0;
  border-top: none;
}

.preferences .section-container {
  width: 100%;
  max-width: 800px;
}

.preferences section .section-heading,
.preferences .section .section-heading {
  margin-bottom: 10px;
  color: #dcdcdc;
  font-size: 1.75em;
  font-weight: bold;
  line-height: 1;
  -webkit-user-select: none;
  cursor: default;
}

.preferences .sub-section-heading.icon:before,
.preferences .section-heading.icon:before {
  margin-right: 8px;
}

.preferences .section-heading-count {
  margin-left: .5em;
}

.preferences .section-body {
  margin-top: 20px;
}

.preferences .sub-section {
  margin: 20px 0;
}

.preferences .sub-section .sub-section-heading {
  color: #dcdcdc;
  font-size: 1.4em;
  font-weight: bold;
  line-height: 1;
  -webkit-user-select: none;
}

.preferences .preferences-panel label {
  color: #a8a8a8;
}

.preferences .preferences-panel .control-group + .control-group {
  margin-top: 1.5em;
}

.preferences .preferences-panel .control-group .editor-container {
  margin: 0;
}

.preferences .preference-title {
  font-size: 1.2em;
  -webkit-user-select: none;
  display: inline-block;
}

.preferences .preference-description {
    color: rgba(170, 170, 170, 0.6);
    -webkit-user-select: none;
    cursor: default;
}

.preferences input {
  font-size: 1.1em;
  line-height: 1.15em;
  max-height: none;
  width: 100%;
  padding-left: 0.5em;
  border-radius: 3px;
  color: #a8a8a8;
  border: 1px solid #181a1f;
  background-color: #1b1d23;
}

.preferences input::-webkit-input-placeholder {
  color: rgba(170, 170, 170, 0.6);
}

.preferences .control-group input {
  margin-top: 0.2em;
}

.preferences .control-group input.file-picker-text {
  width: calc(100% - 40px);
}

.preferences .control-group .checkbox .icon {
  font-size: 1.5em;
  margin: 0;
  vertical-align: text-bottom;
}


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

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