/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

.container {
  max-width: 1600px; /* Increased from 1200px to allow more content width */
  margin: 0 auto;
  padding: 0 20px;
  font-family: Arial, sans-serif;
}

/* Add padding to the main container */
.container:not(.app-header .container) {
  padding-top: 20px;
  padding-bottom: 20px;
}

/* App header styles */
.app-header {
  background-color: #4285f4;
  color: white;
  padding: 15px 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  margin-bottom: 20px;
  width: 100%;
}

.app-header h1 {
  margin: 0;
  text-align: left;
}

.app-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-btn {
  background-color: white;
  color: #4285f4;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.header-btn:hover {
  background-color: #f0f0f0;
}

.header-buttons {
  display: flex;
  gap: 10px;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;
}

.modal-content {
  background-color: #f9f9f9;
  margin: 10% auto;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  width: 80%;
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ddd;
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.modal .video-nav-actions {
  margin-bottom: 15px;
}

/* Video navigation styles */
.video-nav {
  background-color: #f9f9f9;
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-left: 20px;
  width: 250px;
  flex-shrink: 0; /* Prevent shrinking */
}

.video-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.video-nav-header h2 {
  margin: 0;
}

.video-nav-actions {
  display: flex;
  gap: 10px;
}

#new-video-btn {
  background-color: #34a853;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

#new-video-btn:hover {
  background-color: #2d9249;
}

.video-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.video-item {
  background-color: white;
  border-radius: 4px;
  padding: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.video-item:hover {
  background-color: #f0f0f0;
}

.video-item.active {
  border-left: 4px solid #4285f4;
  background-color: #e8f0fe;
}

.video-title {
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.video-info {
  font-size: 0.8em;
  color: #666;
  margin: 0 10px;
}

.video-delete-btn {
  color: #ea4335;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.video-delete-btn:hover {
  background-color: #fce8e6;
}

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

.video-export-btn {
  color: #34a853;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.video-export-btn:hover {
  background-color: #e6f4ea;
}

.video-import-btn {
  color: #4285f4;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.video-import-btn:hover {
  background-color: #e8f0fe;
}

#no-videos-message {
  color: #666;
  text-align: center;
  font-style: italic;
}

/* Main content styles */
main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  width: 100%; /* Ensure it uses full width */
}

@media (min-width: 768px) {
  main {
    flex-direction: row;
  }

  .main-content {
    flex-direction: row;
  }

  .player-container {
    flex: 3; /* Increased from 2 to give more space to the video */
  }

  .notes-container {
    flex: 1;
    min-width: 300px; /* Ensure notes have a minimum width */
  }
}

/* Add a new media query for larger screens */
@media (min-width: 1400px) {
  .main-content {
    gap: 30px; /* Increased gap between player and notes on large screens */
  }

  .player-container {
    flex: 4; /* Even more space for video on very large screens */
  }

  .notes-container {
    flex: 1;
    min-width: 350px; /* Slightly larger minimum width on big screens */
  }
}

@media (max-width: 767px) {
  .video-nav {
    width: 100%;
    margin-left: 0;
    order: -1; /* Move to top on mobile */
  }
}

.player-container {
  position: relative;
  background-color: #f0f0f0;
  display: flex;
  flex-direction: column;
}

.video-title-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 15px;
  position: relative;
  z-index: 1;
  background-color: #f9f9f9;
  border-radius: 5px;
}

.player-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-title-container h3 {
  margin: 0;
  font-size: 1.2em;
  color: #333;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-title-btn {
  background-color: #4285f4;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9em;
  margin-left: 10px;
}

.edit-title-btn:hover {
  background-color: #3367d6;
}

/* Style for save button in title bar */
.video-title-container button[class="edit-title-btn"]:nth-of-type(1) {
  background-color: #34a853; /* Green for save/create action */
  color: white;
}

.video-title-container button[class="edit-title-btn"]:nth-of-type(1):hover {
  background-color: #2d9249;
}

/* Style for cancel button in title bar */
.video-title-container button[class="edit-title-btn"]:nth-of-type(2) {
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
}

.video-title-container button[class="edit-title-btn"]:nth-of-type(2):hover {
  background-color: #e0e0e0;
}

.video-title-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1.2em;
  font-family: inherit;
  margin-right: 10px;
}

.player-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* No video placeholder styles */
.player-wrapper .no-video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
  border-radius: 5px;
}

.no-video-placeholder p {
  font-size: 1.2em;
  color: #666;
  margin-bottom: 20px;
}

#placeholder-new-video-btn {
  background-color: #34a853;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1em;
}

#placeholder-new-video-btn:hover {
  background-color: #2d9249;
}

#placeholder-videos-with-notes-btn {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1em;
  margin-top: 10px;
}

#placeholder-videos-with-notes-btn:hover {
  background-color: #3367d6;
}

.notes-container {
  background-color: #f9f9f9;
  border-radius: 5px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  width: 100%; /* Ensure it uses full width */
}

/* Disabled state for notes container when no video is loaded */
.notes-container.disabled {
  opacity: 0.7;
  position: relative;
}

.notes-container.disabled::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(240, 240, 240, 0.3);
  z-index: 1;
  border-radius: 5px;
}

.notes-container.disabled .notes-list,
.notes-container.disabled .notes-actions {
  pointer-events: none;
}

/* Style for disabled button */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (min-width: 1200px) {
  .notes-container {
    padding: 20px; /* Slightly larger padding on big screens */
  }

  .note-item {
    padding: 15px; /* Larger padding for note items on big screens */
  }
}

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.notes-header h2 {
  margin: 0;
}

.notes-actions {
  display: flex;
  gap: 8px;
}

#delete-all-notes-btn {
  background-color: #ea4335;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

#delete-all-notes-btn:hover {
  background-color: #d33426;
}

#add-note-btn {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

#add-note-btn:hover {
  background-color: #3367d6;
}

.notes-list {
  max-height: 60vh; /* Changed from fixed 500px to 60% of viewport height */
  overflow-y: auto;
}

.note-item {
  background-color: white;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.note-times {
  display: flex;
  flex-direction: row;
  gap: 5px;
  align-items: center;
}

.time-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-input-group label {
  font-size: 0.9em;
  color: #666;
}

.note-timestamp {
  font-weight: bold;
  color: #4285f4;
  cursor: pointer;
}

.note-timestamp:hover {
  text-decoration: underline;
}

.note-endtime {
  font-weight: bold;
  color: #4285f4;
}

.note-precise-time {
  font-size: 0.8em;
  color: #666;
  margin-left: 5px;
  font-style: italic;
}

.time-control-wrapper {
  display: flex;
  align-items: center;
}

.note-time-input {
  width: 70px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9em;
  text-align: center;
}

.time-adjust-btn {
  width: 24px;
  height: 24px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 2px;
}

.time-adjust-btn:hover {
  background-color: #e0e0e0;
}

.time-decrease-btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  margin-right: 0;
}

.time-increase-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: 0;
}

.note-starttime-input, .note-endtime-input {
  border-radius: 0;
  margin: 0;
}

.set-current-endtime-btn {
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8em;
  cursor: pointer;
  margin-left: 5px;
}

.set-current-endtime-btn:hover {
  background-color: #e0e0e0;
}

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

.note-edit-btn, .note-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.note-edit-btn:hover {
  background-color: #f0f0f0;
}

.note-delete-btn {
  color: #ea4335;
}

.note-delete-btn:hover {
  background-color: #fce8e6;
}

.note-description {
  margin: 0;
  word-break: break-word;
}

.note-edit-form {
  margin-top: 8px;
}

.note-edit-textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 8px;
  font-family: inherit;
}

.note-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.note-save-btn, .note-cancel-btn {
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.note-save-btn {
  background-color: #4285f4;
  color: white;
  border: none;
}

.note-save-btn:hover {
  background-color: #3367d6;
}

.note-cancel-btn {
  background-color: #f0f0f0;
  border: 1px solid #ddd;
}

.note-cancel-btn:hover {
  background-color: #e0e0e0;
}

#no-notes-message {
  color: #666;
  text-align: center;
  font-style: italic;
}

/* Button styles */
.btn-primary {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.btn-primary:hover {
  background-color: #3367d6;
}

.btn-secondary {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.btn-secondary:hover {
  background-color: #3367d6;
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
