/* General Body Styles */
body {
    background-color: black; /* Sets the background color to black */
    color: white; /* Sets the text color to white */
    font-family: Arial, sans-serif; /* Default font */
    text-align: center; /* Centers text horizontally */
    /* background-image: url('https://youtubemixer.com.br/bg.png'); */ /* Removed background image */
    background-image: radial-gradient(circle, #444 0%, #111 100%); /* Added dark radial gradient */
    /* background-size: cover; */ /* Removed */
    /* background-position: center; */ /* Removed */
    /* background-repeat: no-repeat; */ /* Removed */
    margin: 0; /* Removes default margin */
    padding: 0; /* Removes default padding */
    min-height: 100vh; /* Sets the minimum height to 100% of the viewport height */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 60px; /* Add padding to prevent overlap with fixed header */
  }
  
  /* Header Styles */
  header {
    position: fixed; /* Fixes the header to the top */
    top: 0;
    left: 0;
    width: 100%; /* Makes header span full width */
    background-color: #333; /* Solid dark gray background */
    padding: 10px 20px; /* Adds padding inside the header */
    box-sizing: border-box; /* Include padding in width calculation */
    z-index: 1000; /* Ensures header stays on top */
    display: flex; /* Use flexbox for layout */
    /* justify-content: space-between; */ /* Removed, will let flex items space naturally */
    align-items: center; /* Vertically center items */
    gap: 15px; /* Add gap between header items */
  }
  header h1 {
    font-family: 'Montserrat', Arial, sans-serif; /* Uses Montserrat font for the header */
    font-size: 1.2em; /* Reduces the font size */
    margin: 0; /* Removes default margin */
    color: #eee; /* Slightly lighter color for the title */
    flex-shrink: 0; /* Prevent title from shrinking */
  }
  
  /* Info Section Styles */
  .header-info {
    font-size: 0.8em;
    color: #ccc;
    text-align: right;
  }

  /* Info Icon Button Styles */
  .info-icon {
    background-color: #555;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    font-weight: bold;
    line-height: 28px; /* Center the '?' vertically */
    text-align: center;
    cursor: pointer;
    padding: 0; /* Remove default button padding */
    /* margin-left: 15px; */ /* Removed, using header gap */
    transition: background-color 0.3s ease;
    flex-shrink: 0; /* Prevent icon from shrinking */
  }
  .info-icon:hover {
    background-color: #777;
  }
  
  /* Modal Styles */
  .modal {
    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    display: flex; /* Use flexbox for centering */
    align-items: center; /* Vertical center */
    justify-content: center; /* Horizontal center */
  }
  
  .modal.hidden {
    display: none; /* Hide by default */
  }
  
  .modal-content {
    background-color: #282828; /* Dark background for modal */
    color: #eee; /* Light text */
    margin: auto; /* Auto margins for centering */
    padding: 30px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 80%;
    max-width: 600px; /* Max width */
    position: relative; /* For positioning the close button */
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
    text-align: left; /* Align text left inside modal */
  }

  .modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
  }
  
  .modal-close:hover,
  .modal-close:focus {
    color: white;
    text-decoration: none;
    cursor: pointer;
  }

  /* Modal Content Styling */
  .modal-content h2 {
    margin-top: 0;
    color: #ff4500; /* Orange-red title */
    text-align: center;
    margin-bottom: 20px;
  }
  .modal-content ol {
    padding-left: 20px; /* Indent list */
    margin-bottom: 15px;
  }
  .modal-content li {
    margin-bottom: 10px; /* Space between list items */
    line-height: 1.5;
  }
  .modal-content li ul {
    margin-top: 5px;
    padding-left: 15px;
  }
  .modal-content li ul li {
    margin-bottom: 5px;
    font-size: 0.95em;
  }
  .modal-content code {
    background-color: #444;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
  }
  .modal-content p {
    text-align: center;
    margin-top: 20px;
    font-style: italic;
  }
  .enjoy-message { /* Specific style for the final message */
      margin-top: 30px;
      font-weight: bold;
      color: #a1c181; /* A greenish color */
  }

  .instructions-section {
      margin-bottom: 25px;
      padding-bottom: 15px;
      border-bottom: 1px solid #444; /* Separator line */
  }
  .instructions-section:last-of-type {
      border-bottom: none; /* No line after the last section */
      margin-bottom: 0;
      padding-bottom: 0;
  }
  .instructions-section h3 {
      margin-top: 0;
      margin-bottom: 15px;
      color: #61a5c2; /* A bluish color for section titles */
      border-bottom: 1px solid #555;
      padding-bottom: 5px;
  }
  .instructions-section p {
      text-align: left;
      margin-bottom: 10px;
      font-style: normal; /* Override italic default for p in modal */
  }
  .instructions-section ul {
      list-style: disc;
      padding-left: 20px;
  }

  .shortcuts-grid {
      display: grid;
      grid-template-columns: auto 1fr auto 1fr; /* Columns for Video Label, Key, Key, Key */
      gap: 5px 15px; /* Row gap, Column gap */
      align-items: center;
      background-color: rgba(0, 0, 0, 0.2);
      padding: 10px;
      border-radius: 4px;
      margin-top: 10px;
  }
  .shortcuts-grid div {
      text-align: left;
  }
  .shortcuts-grid code {
      display: inline-block; /* Allow padding/margin */
      min-width: 20px; /* Ensure minimum width for single chars */
      text-align: center;
  }

  /* Search Modal Specific Styles */
  .search-modal-content {
    max-width: 90%;
    width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
  }

  .search-modal-content h2 {
    margin-bottom: 25px;
  }

  /* Search Results Grid */
  .search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px 0;
  }

  /* Individual Search Result Card */
  .search-result-card {
    background-color: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
  }

  .search-result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(255, 69, 0, 0.3);
    border-color: #ff4500;
  }

  /* Thumbnail Container */
  .result-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background-color: #000;
  }

  .result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Overlay with Deck Buttons */
  .result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 15px;
  }

  .search-result-card:hover .result-overlay {
    opacity: 1;
  }

  /* Deck Buttons */
  .deck-button {
    background-color: #ff4500;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    width: 80%;
    max-width: 200px;
  }

  .deck-button:hover {
    background-color: #ff6a33;
    transform: scale(1.05);
  }

  .deck-button:active {
    transform: scale(0.98);
  }

  .deck-button.deck-a {
    background-color: #e63946;
  }

  .deck-button.deck-a:hover {
    background-color: #f25c68;
  }

  .deck-button.deck-b {
    background-color: #457b9d;
  }

  .deck-button.deck-b:hover {
    background-color: #5a94ba;
  }

  /* Result Info Section */
  .result-info {
    padding: 15px;
  }

  .result-title {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 40px;
  }

  .result-channel {
    font-size: 12px;
    color: #aaa;
    margin: 0 0 8px 0;
  }

  .result-description {
    font-size: 11px;
    color: #888;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Loading State */
  .search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #aaa;
  }

  .search-loading p {
    margin-top: 20px;
    font-size: 16px;
  }

  /* Spinner Animation */
  .spinner {
    border: 4px solid #333;
    border-top: 4px solid #ff4500;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
  }

  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  /* No Results State */
  .no-results {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
  }

  .no-results p {
    font-size: 16px;
    margin: 0;
  }

  /* Responsive adjustments for search modal */
  @media only screen and (max-width: 768px) {
    .search-modal-content {
      width: 95%;
      max-height: 90vh;
    }

    .search-results-grid {
      grid-template-columns: 1fr;
      gap: 15px;
    }

    .deck-button {
      width: 90%;
      padding: 10px 20px;
      font-size: 13px;
    }
  }

  @media only screen and (max-width: 480px) {
    .result-title {
      font-size: 13px;
      min-height: 36px;
    }

    .result-channel {
      font-size: 11px;
    }

    .result-description {
      font-size: 10px;
    }
  }
  
  /* Search Container Styles (Now specific to header) */
  .header-search {
    display: flex; /* Uses Flexbox for layout */
    justify-content: center; /* Centers items horizontally */
    flex-grow: 1; /* Allow search to take up space */
    /* margin-bottom: 15px; */ /* Removed */
    /* margin-top: 20px; */ /* Removed */
    gap: 10px; /* Add gap between input and button */
    min-width: 200px; /* Prevent it from becoming too small */
  }
  .header-search input {
    padding: 8px 12px; /* Slightly smaller padding for header */
    width: 100%; /* Take available width within flex container */
    max-width: 400px; /* Limit max width */
    box-sizing: border-box; /* Includes padding and border in the width calculation */
    border: 1px solid #555;
    border-radius: 4px;
    background-color: #222;
    color: white;
  }

  .header-search button {
      padding: 8px 15px; /* Slightly smaller padding for header */
      flex-shrink: 0; /* Prevent button shrinking */
  }
  
  /* General Button Styles (excluding header search button) */
  button:not(.info-icon):not(.modal-close):not(.header-search button) {
    background-color: rgb(200, 20, 0); /* Slightly adjusted background color */
    border: none; /* Removes the border */
    color: white; /* Sets the text color */
    padding: 10px 20px; /* Adjusted padding */
    font-size: 16px; /* Sets the font size */
    cursor: pointer; /* Changes the cursor to pointer on hover */
    transition: background-color 0.3s ease, transform 0.1s ease; /* Adds transition for background color and transform */
    border-radius: 4px; /* Add rounded corners */
    /* margin-top: 10px; Removed, handled by flex gap or specific margins */
  }
  
  button:hover {
    background-color: rgb(230, 50, 0); /* Slightly adjusted hover color */
  }

  button:active {
      transform: scale(0.98); /* Add subtle press effect */
  }
  
  /* Video Container Styles */
  .video-container {
    display: flex; /* Uses Flexbox for layout */
    justify-content: center; /* Centers items horizontally */
    align-items: stretch; /* Aligns items to stretch vertically */
    gap: 20px; /* Adds space between items */
    padding: 20px; /* Adds padding inside the container */
    /* flex-wrap: wrap; */ /* Removed to force side-by-side */
    width: 100%; /* Ensures the container takes full width */
    box-sizing: border-box; /* Includes padding and border in the width calculation */
    min-height: 400px; /* Minimum height to accommodate videos */
    overflow-x: auto; /* Add horizontal scroll if content overflows on small screens */
  }
  
  /* Fieldset Styles for Video Controls */
  fieldset {
    border: 1px solid #555; /* Thinner, darker border */
    border-radius: 8px; /* Rounds the corners */
    margin: 0; /* Remove default margins, rely on gap */
    padding: 20px; /* Adds padding inside the fieldset */
    background-color: rgba(40, 40, 40, 0.7); /* Semi-transparent dark background */
    /* width: calc(50% - 10px); */ /* Removed - Using flex property instead */
    flex: 1; /* Allow fieldsets to grow and shrink equally */
    /* min-width: 300px; */ /* Removed to prevent wrapping */
    box-sizing: border-box; /* Includes padding and border in the width calculation */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Add gap between elements inside fieldset */
  }
  legend {
    font-weight: bold; /* Makes the legend text bold */
    font-size: 1.2em; /* Sets the font size */
    padding: 0 10px; /* Adds horizontal padding */
  }
  
  /* Input Fields Styles within Fieldsets */
  fieldset .video-input-group { /* Group input and button */
      display: flex;
      width: 100%;
      max-width: 500px; /* Limit width of input group */
      gap: 10px;
  }

  fieldset input[type="text"] {
    /* margin: 10px 0; Removed, using gap */
    padding: 10px 15px; /* Adjusted padding */
    flex-grow: 1; /* Allow input to take available space */
    min-width: 150px; /* Minimum width */
    box-sizing: border-box; /* Includes padding and border in the width calculation */
    border: 1px solid #555;
    border-radius: 4px;
    background-color: #222;
    color: white;
  }

  fieldset .video-input-group button {
      flex-shrink: 0; /* Prevent button from shrinking */
      margin-top: 0; /* Override general button margin */
  }

  /* Playback Controls within Fieldsets */
  fieldset .playback-controls {
      display: flex;
      gap: 10px; /* Space between buttons */
      flex-wrap: wrap; /* Allow wrapping */
      justify-content: center;
  }

  fieldset .playback-controls button {
      margin-top: 0; /* Override general button margin */
  }
  
  /* YouTube Player Containers */
  #player1, #player2 {
    width: 100%;
    max-width: 640px; /* Optional: Limit max video width */
    aspect-ratio: 16/9; /* Maintains 16:9 aspect ratio */
    /* margin: 15px 0; Removed, using gap */
    background-color: #111; /* Placeholder background */
    border-radius: 4px;
  }

  /* YouTube iframes */
  #player1 iframe, #player2 iframe {
    width: 100%;
    height: 100%;
  }
  
  /* Controls Container Styles */
  .controls {
    margin-top: 40px; /* Increased top margin */
    margin-bottom: 40px; /* Added bottom margin */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px; /* Increased padding */
    width: 90%; /* Limit width slightly */
    max-width: 800px; /* Max width for the controls area */
    box-sizing: border-box; /* Includes padding and border in the width calculation */
    background-color: rgba(30, 30, 30, 0.8); /* Darker semi-transparent background */
    border-radius: 10px; /* Rounded corners */
    border: 1px solid #444; /* Subtle border */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); /* Add shadow */
    margin-left: auto; /* Center the container */
    margin-right: auto; /* Center the container */
  }
  
  /* Fader (Volume Control) Styles */
  #faderLabel {
    display: block; /* Makes the label a block element */
    margin-bottom: 15px; /* Increased bottom margin */
    font-size: 1.3em; /* Slightly larger font size */
    font-weight: bold; /* Makes the text bold */
    color: #eee;
  }
  #faderDescription {
    margin-bottom: 20px; /* Increased bottom margin */
    font-size: 0.9em; /* Slightly smaller font size */
    color: #bbb; /* Lighter gray color */
    max-width: 90%; /* Allow slightly wider description */
    margin: 0 auto 25px auto; /* Centers the text with increased bottom margin */
    line-height: 1.5; /* Slightly increased line height */
  }
  #fader {
    -webkit-appearance: none; /* Removes default style in WebKit browsers */
    appearance: none; /* Removes default style */
    width: 90%; /* Increase width relative to container */
    height: 12px; /* Make the track thinner */
    background: linear-gradient(to right, #e63946, #457b9d); /* New gradient: Red to Blue */
    border-radius: 6px; /* Rounded track */
    outline: none; /* Removes the outline */
    opacity: 0.85; /* Slightly adjust opacity */
    transition: opacity 0.2s; /* Adds transition for opacity */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); /* Inner shadow for depth */
    margin-bottom: 20px; /* Adds bottom margin */
    cursor: pointer;
  }
  #fader:hover {
      opacity: 1;
  }
  /* Thumb (Pointer) Styles for the Fader */
  #fader::-webkit-slider-thumb {
    -webkit-appearance: none; /* Removes the default style */
    appearance: none; /* Removes the default style */
    width: 28px; /* Thumb width */
    height: 28px; /* Thumb height */
    background: #f1faee; /* Light thumb color */
    border-radius: 50%; /* Makes the thumb circular */
    cursor: pointer; /* Changes the cursor to pointer on hover */
    border: 2px solid #1d3557; /* Dark blue border */
    box-shadow: 0px 0px 8px rgba(241, 250, 238, 0.5); /* Subtle glow */
    margin-top: -8px; /* Adjust vertical position to center on track */
  }
  #fader::-moz-range-thumb { /* Firefox */
    width: 28px; /* Thumb width */
    height: 28px; /* Thumb height */
    background: #f1faee; /* Light thumb color */
    border-radius: 50%; /* Makes the thumb circular */
    cursor: pointer; /* Changes the cursor to pointer on hover */
    border: 2px solid #1d3557; /* Dark blue border */
    box-shadow: 0px 0px 8px rgba(241, 250, 238, 0.5); /* Subtle glow */
  }
  
  /* Responsiveness for Mobile Devices */
  @media only screen and (max-width: 1200px) {
    /* Ensures that the video players scale down proportionally */
    fieldset {
      /* width: calc(50% - 60px); */ /* Removed - Rely on base width */
      /* min-width: 300px; */ /* Removed */
    }
  }

  @media only screen and (max-width: 992px) {
    /* Further scaling for medium-sized devices */
    .search-container input {
      width: 100%;
    }
    fieldset {
      /* width: calc(50% - 40px); */ /* Removed - Rely on base width */
      /* min-width: 280px; */ /* Removed */
      padding: 15px;
    }
  }
  
  @media only screen and (max-width: 768px) {
    /* Adjusts the Search Container to stack vertically */
    .search-container {
      flex-direction: column;
      align-items: center;
      width: 100%;
    }
    .search-container input {
      width: 100%;
      margin-right: 0;
      margin-bottom: 10px;
    }
    .search-container button {
      width: 100%;
    }

    /* Adjusts the Video Container for vertical stacking - REMOVED */
    .video-container {
      /* flex-direction: column; */ /* Removed */
      /* align-items: center; */ /* Removed */
      gap: 10px; /* Keep smaller gap for smaller screens */
      padding: 10px; /* Keep smaller padding */
    }

    /* Adjusts Fieldsets for vertical stacking - REMOVED width: 100% to keep side-by-side */
    fieldset {
      /* width: 100%; */ /* Removed to maintain side-by-side */
      max-width: 100%;
      /* min-width: 280px; */ /* Removed */
      margin: 0 0 20px 0; /* Keep bottom margin for spacing when wrapped if needed */
      padding: 15px;
    }

    /* Adjusts the YouTube player containers */
    #player1, #player2 {
      width: 100%;
      aspect-ratio: 16/9;
    }

    /* Adjusts the Fader to take up appropriate space */
    #fader {
      width: 90%;
    }

    /* Adjusts Buttons within Fieldsets for better spacing */
    fieldset div {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 5px;
      width: 100%;
    }
    
    fieldset button {
      flex: 1 1 auto;
      min-width: 80px;
      margin: 5px 2px;
    }

    /* Adjusts the Controls Container */
    .controls {
      padding: 0 10px;
      width: 100%;
      margin-top: 10px;
    }
  }
  
  @media only screen and (max-width: 480px) {
    /* Adjusts the Title for smaller sizes */
    header h1 {
      font-size: 2em;
      width: 100%;
    }
  
    /* Adjusts the Fader Description */
    #faderDescription {
      font-size: 12px;
      width: 100%;
    }
  
    /* Adjusts Buttons to take full width */
    button {
      width: 100%;
    }
  
    /* Further adjust input widths for very small screens */
    .search-container input, fieldset input[type="text"] {
      width: 100%;
    }
  }
