@import url(https://fonts.googleapis.com/css?family=Hind:600,300);

/* Base styles */
html, body {
  font-family: 'Hind', sans-serif;
  font-size: 17px;
  font-weight: 300;
  line-height: 1.5;
  color: #fff;
  background-color: #141414;
  background-image: url("/img/castbg.jpg");
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  margin: 0;
  padding: 0;
}

a {
  color: #fff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: #a0c0ff;
}

/* Layout */
.container {
  width: 90%;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  margin-top: 20px;
  margin-bottom: 20px;
}

header {
  text-align: center;
  padding-bottom: 20px;
  font-size: 40px;
  color: #a0c0ff;
}
header img {
  height: 75px;
  vertical-align: top;
}

section {
  margin: 25px 0;
  padding: 15px 0;
}

section:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

section:first-of-type {
  border-top: none;
}

h1, h2, h3 {
  font-weight: 600;
  color: #a0c0ff;
  margin-top: 0px;
  margin-bottom: 0px;
}

h1 {
  font-size: 2.2rem;
}

h2 {
  font-size: 1.6rem;
  margin-top: 0;
}

h3 {
  font-size: 1.3rem;
}

/* Utility Classes */
.hidden {
  display: none;
}

.warning {
  color: #ff7070;
  font-weight: 600;
}

.success {
  color: #70ff70;
}

.fullwidth {
  width: 100%;
  box-sizing: border-box;
}

/* Form Elements */
input, select, button {
  font-family: 'Hind', sans-serif;
  padding: 10px;
  margin: 8px 0;
  border-radius: 4px;
  border: 1px solid #333;
  background-color: #222;
  color: #fff;
}

input:focus, select:focus {
  outline: none;
  border-color: #a0c0ff;
}

label {
  display: block;
  margin-top: 10px;
  margin-bottom: 5px;
  font-weight: 600;
}

/* Buttons */
.btn {
  padding: 10px 15px;
  background-color: #2b5797;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-right: 5px;
}

.btn:hover {
  background-color: #3a6ab5;
}

.btn.primary {
  background-color: #3a6ab5;
  font-weight: 600;
}

.btn.primary:hover {
  background-color: #4a7ac5;
}

.btn.small {
  padding: 5px 10px;
  font-size: 0.9rem;
}

/* Lists */
ul {
  list-style-type: none;
  padding-left: 0;
}

ul.media-list li {
  margin-bottom: 8px;
}

ul.media-list a {
  display: inline-block;
  padding: 5px 10px;
  background-color: rgba(60, 60, 100, 0.3);
  border-radius: 4px;
  transition: background-color 0.3s;
}

ul.media-list a:hover {
  background-color: rgba(60, 60, 100, 0.6);
  text-decoration: none;
}

/* Media Selection Section */
.media-input {
  background-color: rgba(40, 40, 60, 0.6);
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.media-hints {
  background-color: rgba(40, 40, 60, 0.4);
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 20px;
}

code {
  background-color: rgba(0, 0, 0, 0.3);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: monospace;
}

/* Control Panel */
.control-panel {
  background-color: rgba(30, 40, 70, 0.5);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 40vh;
}

.status-display {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 15px;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 5px;
}

.status-item {
  margin-right: 20px;
}

.label {
  font-weight: 600;
  color: #a0c0ff;
}

.progress-container, .volume-container {
  margin: 15px 0;
}

input[type="range"] {
  width: 100%;
  background: #333;
  height: 8px;
  border-radius: 5px;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #a0c0ff;
  border-radius: 50%;
  cursor: pointer;
}

/* Volume controls */
.volume-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.volume-controls input[type="range"] {
  flex: 1;
}

.volume-display {
  min-width: 40px;
  color: #a0c0ff;
  font-weight: bold;
}

.media-buttons {
  margin-top: 20px;
  display: flex;
  align-items: center;
}

#castStatusIcon {
  margin-left: auto;
  height: 24px;
}

/* Debug section */
.debug-log {
  background-color: rgba(0, 0, 0, 0.5);
  color: #ccc;
  padding: 10px;
  border-radius: 5px;
  font-family: monospace;
  font-size: 0.9rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  display: none;
}

/* Action buttons */
.action-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 10px;
}

.auto-connect {
  display: flex;
  align-items: center;
  gap: 5px;
}

.auto-connect input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.auto-connect label {
  display: inline;
  margin: 0;
  cursor: pointer;
}

/* Device Selection */
.device-selection {
  background-color: rgba(30, 40, 70, 0.4);
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.device-info {
  margin-top: 8px;
  font-size: 0.9em;
  color: #8aa3d8;
}

/* Disabled options */
optgroup.disabled,
option.disabled {
  color: #666;
  font-style: italic;
}

select:disabled,
option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Highlight current device capabilities */
.capability-audio {
  color: #70ff70;
}

.capability-video {
  color: #70c0ff;
}

.capability-audio.unavailable,
.capability-video.unavailable {
  color: #ff7070;
  text-decoration: line-through;
}

/* Modern History Display */
.modern-history {
  max-height: none;
  overflow-y: visible;
  margin-bottom: 10px;
}

.history-item {
  background-color: rgba(30, 40, 60, 0.4);
  margin-bottom: 8px;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s;
}

.history-item:hover {
  background-color: rgba(40, 50, 70, 0.6);
}

.history-url {
  word-break: break-all;
  margin-bottom: 6px;
}

.history-mime {
  color: #8aa3d8;
  font-size: 0.9em;
  margin-bottom: 6px;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.history-actions a {
  font-size: 0.85em;
  padding: 3px 8px;
  background-color: rgba(60, 80, 120, 0.4);
  border-radius: 3px;
}

.history-actions a:hover {
  background-color: rgba(80, 100, 150, 0.6);
  text-decoration: none;
}

.history-item .timestamp {
  font-size: 0.8em;
  color: #666;
  margin-top: 5px;
  align-self: flex-end;
}

/* Quick links inline styling */
.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.quick-link {
  font-size: 0.9em;
  padding: 5px 10px;
  background-color: rgba(60, 60, 100, 0.3);
  border-radius: 4px;
  transition: background-color 0.3s;
}

.quick-link:hover {
  background-color: rgba(60, 60, 100, 0.6);
  text-decoration: none;
}

.autodetected-type {
  font-size: 0.9em;
  font-style: italic;
  color: #70ff70;
  margin-left: 10px;
  font-weight: normal;
}

/* Section headers with inline content */
.section-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 10px;
  margin-top: 0px;
}

.section-header h3, 
.section-header h4 {
  margin: 0;
  flex-shrink: 0;
}

.section-header .inline-links {
  margin-bottom: 0;
  flex: 1;
}

/* History Section */
.media-box {
  background-color: rgba(40, 40, 60, 0.6);
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.history-button {
  font-size: 0.9em;
  padding: 8px 0px 8px 12px;
  background-color: rgba(60, 60, 100, 0.3);
  border-radius: 4px;
  transition: background-color 0.3s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: inline-block;
}

.history-button:hover {
  background-color: rgba(60, 60, 100, 0.6);
  text-decoration: none;
}

/* History items with delete buttons */
.history-item-container {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
  background-color: rgba(60, 60, 100, 0.3);
  border-radius: 4px;
  transition: background-color 0.3s;
  overflow: hidden; /* Ensure nothing spills outside the border radius */
}

.history-item-container:hover {
  background-color: rgba(60, 60, 100, 0.6);
}

.history-button {
  font-size: 0.9em;
  background-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
  border-radius: 0;
}

.history-button:hover {
  background-color: transparent;
  text-decoration: none;
}

.history-delete {
  width: 30px;
  height: auto;
  margin-right: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  font-size: 18px;
  font-weight: bold;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: 0;
  margin-left: 0;
  transition: background-color 0.3s, color 0.3s;
  cursor: pointer;
}

.history-delete:hover {
  background-color: rgba(150, 60, 60, 0.7);
  color: white;
  text-decoration: none;
}

/* Smooth scrolling for the whole page */
html {
  scroll-behavior: smooth;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    width: 95%;
    padding: 10px;
  }
  
  .media-buttons {
    flex-wrap: wrap;
  }
  
  .btn {
    margin-bottom: 8px;
  }
  

  
  .inline-links {
    flex-direction: column;
    gap: 5px;
  }
  
  .quick-link {
    display: block;
  }
  
  .history-actions {
    flex-direction: column;
  }
  
  .history-actions a {
    text-align: center;
  }
}

@media (max-width: 500px) {
  html, body {
    font-size: 16px;
  }
  
  .container {
    width: 100%;
    border-radius: 0;
    margin-top: 0;
  }
  
  .volume-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .volume-display {
    text-align: center;
  }
  
  .media-buttons {
    flex-direction: column;
    position: relative;
    padding-bottom: 40px;  /* Add space for the absolutely positioned icon */
  }
  
  .media-buttons button {
    width: 100%;
  }
  
  #castStatusIcon {
    position: absolute;
    right: 0;
    bottom: 0;
    margin: 0;
  }
}

/* Progress and volume controls */
.progress-container, .volume-container {
  margin: 15px 0;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.slider-container label {
  min-width: 70px;
  margin: 0;
}

slider-container input[type="range"] {
  flex: 1;
}

.progress-display,
.volume-display {
  min-width: 40px;
  color: #a0c0ff;
  font-weight: bold;
  text-align: right;
}
