/*
 * AdC — Application Styles
 * Extracted from index.html during modular refactor.
 */

:root {
      --red: #d71920;
      --red-dark: #aa1117;
      --black: #151515;
      --gray-900: #25272b;
      --gray-700: #666b73;
      --gray-500: #979da6;
      --gray-300: #d8dbe0;
      --gray-200: #e8eaed;
      --gray-100: #f5f6f8;
      --white: #ffffff;
      --green: #178344;
      --yellow: #a66b00;
      --shadow: 0 10px 30px rgba(0, 0, 0, .06);
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      margin: 0;
      min-height: 100%;
      font-family:
        Arial,
        Helvetica,
        sans-serif;
      color: var(--gray-900);
      background: var(--gray-100);
    }

    button,
    select,
    input {
      font: inherit;
    }

    button {
      cursor: pointer;
    }

    .app-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
      min-height: 74px;
      padding: 0 28px;
      color: var(--white);
      background: var(--black);
    }

    .brand h1 {
      margin: 0;
      font-size: 21px;
      letter-spacing: -.2px;
    }

    .brand p {
      margin: 4px 0 0;
      color: #bfc2c7;
      font-size: 12px;
    }

    .server-status {
      display: flex;
      align-items: center;
      gap: 8px;
      color: #d8dadd;
      font-size: 13px;
    }

    .status-dot {
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: #19a356;
      box-shadow: 0 0 0 4px rgba(25, 163, 86, .14);
    }

    .workspace {
      display: grid;
      grid-template-columns: 330px minmax(0, 1fr);
      min-height: calc(100vh - 74px);
    }

    .sidebar {
      display: flex;
      flex-direction: column;
      min-width: 0;
      border-right: 1px solid var(--gray-200);
      background: var(--white);
    }

    .sidebar-header {
      padding: 22px 20px 17px;
      border-bottom: 1px solid var(--gray-200);
    }

    .sidebar-title-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 14px;
    }

    .sidebar-title-row h2 {
      margin: 0;
      font-size: 16px;
    }

    .file-count {
      padding: 4px 8px;
      border-radius: 12px;
      color: var(--gray-700);
      background: var(--gray-100);
      font-size: 12px;
      font-weight: 700;
    }

    .upload-button {
      width: 100%;
      padding: 11px 14px;
      border: 0;
      border-radius: 8px;
      color: var(--white);
      background: var(--red);
      font-weight: 700;
    }

    .upload-button:hover {
      background: var(--red-dark);
    }

    #fileInput {
      display: none;
    }

    .drop-mini {
      margin-top: 10px;
      padding: 11px;
      border: 1px dashed var(--gray-300);
      border-radius: 8px;
      color: var(--gray-700);
      text-align: center;
      font-size: 12px;
    }

    .drop-mini.active {
      border-color: var(--red);
      color: var(--red);
      background: #fff7f7;
    }

    .file-list {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding: 10px;
    }

    .empty-list {
      padding: 35px 18px;
      color: var(--gray-500);
      text-align: center;
      font-size: 13px;
      line-height: 1.5;
    }

    .file-card {
      width: 100%;
      margin: 0 0 7px;
      padding: 13px;
      border: 1px solid transparent;
      border-radius: 9px;
      color: inherit;
      background: transparent;
      text-align: left;
    }

    .file-card:hover {
      background: var(--gray-100);
    }

    .file-card.selected {
      border-color: #f3b8bb;
      background: #fff4f4;
    }

    .file-name {
      overflow: hidden;
      margin-bottom: 7px;
      font-size: 13px;
      font-weight: 700;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .file-meta {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      color: var(--gray-700);
      font-size: 11px;
    }

    .file-status {
      text-transform: capitalize;
    }

    .review-panel {
      min-width: 0;
      padding: 26px;
      overflow-y: auto;
    }

    .empty-review {
      display: grid;
      min-height: calc(100vh - 126px);
      place-items: center;
      color: var(--gray-500);
      text-align: center;
    }

    .empty-review strong {
      display: block;
      margin-bottom: 7px;
      color: var(--gray-700);
      font-size: 18px;
    }

    .review-content {
      display: none;
    }

    .review-content.visible {
      display: block;
    }

    .review-heading {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 20px;
      margin-bottom: 18px;
    }

    .review-heading h2 {
      overflow-wrap: anywhere;
      margin: 0 0 7px;
      font-size: 22px;
    }

    .review-subtitle {
      color: var(--gray-700);
      font-size: 13px;
    }

    .action-buttons {
      display: flex;
      gap: 8px;
      flex-shrink: 0;
    }

    .secondary-button,
    .primary-button {
      padding: 10px 14px;
      border-radius: 7px;
      font-size: 13px;
      font-weight: 700;
    }

    .secondary-button {
      border: 1px solid var(--gray-300);
      color: var(--gray-700);
      background: var(--white);
    }

    .secondary-button:disabled {
      opacity: .5;
      cursor: not-allowed;
    }

    .primary-button {
      border: 0;
      color: var(--white);
      background: var(--red);
    }

    .audio-card,
    .settings-card,
    .findings-card {
      margin-bottom: 18px;
      padding: 20px;
      border: 1px solid var(--gray-200);
      border-radius: 12px;
      background: var(--white);
      box-shadow: var(--shadow);
    }

    .waveform-shell {
      position: relative;
      overflow: hidden;
      height: 190px;
      border: 1px solid var(--gray-200);
      border-radius: 9px;
      background:
        linear-gradient(
          to bottom,
          #fafafa,
          #f3f4f6
        );
    }

    #waveform {
      display: block;
      width: 100%;
      height: 100%;
      cursor: pointer;
    }

    .loading-waveform {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      color: var(--gray-500);
      background: rgba(255, 255, 255, .75);
      font-size: 13px;
    }

    .loading-waveform.hidden {
      display: none;
    }

    .time-row {
      display: flex;
      justify-content: space-between;
      margin-top: 8px;
      color: var(--gray-700);
      font-variant-numeric: tabular-nums;
      font-size: 12px;
    }

    .transport {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 9px;
      margin-top: 17px;
    }

    .transport-button {
      min-width: 46px;
      height: 42px;
      padding: 0 12px;
      border: 1px solid var(--gray-300);
      border-radius: 8px;
      color: var(--gray-900);
      background: var(--white);
      font-weight: 700;
    }

    .transport-button.play {
      min-width: 68px;
      border-color: var(--red);
      color: var(--white);
      background: var(--red);
    }

    .transport-button:hover {
      border-color: var(--gray-500);
    }

    .transport-button.play:hover {
      background: var(--red-dark);
    }

    .settings-title,
    .findings-title {
      margin: 0 0 15px;
      font-size: 15px;
    }

    .settings-grid {
      display: grid;
      grid-template-columns:
        repeat(4, minmax(130px, 1fr));
      gap: 14px;
    }

    .setting label {
      display: block;
      margin-bottom: 6px;
      color: var(--gray-700);
      font-size: 12px;
      font-weight: 700;
    }

    .setting select {
      width: 100%;
      padding: 9px 10px;
      border: 1px solid var(--gray-300);
      border-radius: 7px;
      color: var(--gray-900);
      background: var(--white);
    }

    .findings-placeholder {
      padding: 24px;
      border: 1px dashed var(--gray-300);
      border-radius: 8px;
      color: var(--gray-500);
      text-align: center;
      font-size: 13px;
    }

    .toast-container {
      position: fixed;
      z-index: 20;
      right: 20px;
      bottom: 20px;
      width: min(390px, calc(100% - 40px));
    }

    .toast {
      margin-top: 9px;
      padding: 13px 15px;
      border-radius: 8px;
      color: var(--white);
      background: var(--black);
      box-shadow: var(--shadow);
      font-size: 13px;
      line-height: 1.4;
    }

    .toast.error {
      background: #9e181d;
    }

    .toast.warning {
      color: #392500;
      background: #ffd77a;
    }

    @media (max-width: 900px) {
      .workspace {
        grid-template-columns: 1fr;
      }

      .sidebar {
        max-height: 360px;
        border-right: 0;
        border-bottom: 1px solid var(--gray-200);
      }

      .settings-grid {
        grid-template-columns:
          repeat(2, minmax(130px, 1fr));
      }
    }

    @media (max-width: 600px) {
      .app-header {
        padding: 0 16px;
      }

      .review-panel {
        padding: 17px;
      }

      .review-heading {
        flex-direction: column;
      }

      .settings-grid {
        grid-template-columns: 1fr;
      }

      .waveform-shell {
        height: 150px;
      }
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 22px;
    }

    .user-menu {
      position: relative;
    }

    .user-menu-button {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 7px 10px;
      border: 1px solid #3b3b3b;
      border-radius: 8px;
      color: var(--white);
      background: #202020;
      font-size: 13px;
    }

    .user-menu-button:hover {
      background: #2a2a2a;
    }

    .user-avatar {
      display: grid;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      place-items: center;
      color: var(--white);
      background: var(--red);
      font-size: 12px;
      font-weight: 800;
    }

    .user-chevron {
      color: #bfc2c7;
      font-size: 11px;
    }

    .user-dropdown {
      position: absolute;
      z-index: 30;
      top: calc(100% + 8px);
      right: 0;
      display: none;
      width: 180px;
      padding: 6px;
      border: 1px solid var(--gray-200);
      border-radius: 9px;
      background: var(--white);
      box-shadow: 0 14px 36px rgba(0, 0, 0, .18);
    }

    .user-dropdown.open {
      display: block;
    }

    .user-dropdown-item {
      width: 100%;
      padding: 10px 11px;
      border: 0;
      border-radius: 6px;
      color: var(--gray-900);
      background: transparent;
      text-align: left;
      font-size: 13px;
    }

    .user-dropdown-item:hover:not(:disabled) {
      background: var(--gray-100);
    }

    .user-dropdown-item.disabled {
      color: var(--gray-500);
      cursor: not-allowed;
    }

    .modal-overlay {
      position: fixed;
      z-index: 100;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(0, 0, 0, .55);
    }

    .modal-overlay.open {
      display: flex;
    }

    .settings-modal {
      width: min(720px, 100%);
      max-height: calc(100vh - 40px);
      overflow-y: auto;
      border-radius: 14px;
      background: var(--white);
      box-shadow: 0 25px 70px rgba(0, 0, 0, .3);
    }

    .modal-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 20px;
      padding: 22px 24px;
      border-bottom: 1px solid var(--gray-200);
    }

    .modal-header h2 {
      margin: 0;
      font-size: 20px;
    }

    .modal-header p {
      margin: 5px 0 0;
      color: var(--gray-700);
      font-size: 13px;
    }

    .modal-close-button {
      width: 34px;
      height: 34px;
      border: 0;
      border-radius: 7px;
      color: var(--gray-700);
      background: var(--gray-100);
      font-size: 24px;
      line-height: 1;
    }

    .modal-body {
      padding: 24px;
    }

    .modal-settings-grid {
      grid-template-columns:
        repeat(2, minmax(180px, 1fr));
    }

    .setting-help {
      margin-top: 7px;
      color: var(--gray-500);
      font-size: 11px;
      line-height: 1.4;
    }

    .modal-footer {
      display: flex;
      justify-content: flex-end;
      gap: 9px;
      padding: 17px 24px;
      border-top: 1px solid var(--gray-200);
      background: #fafafa;
    }

    body.modal-open {
      overflow: hidden;
    }

    @media (max-width: 600px) {
      .server-status {
        display: none;
      }

      .user-menu-button > span:nth-child(2) {
        display: none;
      }

      .modal-settings-grid {
        grid-template-columns: 1fr;
      }

      .modal-footer {
        flex-direction: column-reverse;
      }

      .modal-footer button {
        width: 100%;
      }
    }


    #waveform:focus {
      outline: 2px solid rgba(215, 25, 32, .35);
      outline-offset: -2px;
    }


/* ==========================================================
   AdC Compliance Markers
   ========================================================== */

.waveform-shell {
  position: relative;
}

.compliance-marker-overlay {
  position: absolute;
  z-index: 6;
  inset: 0;
  pointer-events: none;
}

.waveform-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  margin-left: -9px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}

.waveform-marker-line {
  position: absolute;
  top: 15px;
  bottom: 0;
  left: 8px;
  width: 2px;
  background: currentColor;
  opacity: .75;
}

.waveform-marker-head {
  position: absolute;
  top: 5px;
  left: 3px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}

.waveform-marker:hover,
.waveform-marker.selected {
  z-index: 8;
  transform: scale(1.12);
}

.waveform-marker.critical {
  color: #c5141c;
}

.waveform-marker.high {
  color: #e36b17;
}

.waveform-marker.warning,
.waveform-marker.medium {
  color: #d69a00;
}

.waveform-marker.info {
  color: #2779bd;
}

.compliance-markers-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.compliance-markers-heading .findings-title {
  margin-bottom: 4px;
}

.compliance-marker-count {
  color: var(--gray-500);
  font-size: 12px;
}

.marker-navigation {
  display: flex;
  gap: 7px;
}

.marker-navigation-button {
  padding: 8px 11px;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  color: var(--gray-700);
  background: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.marker-navigation-button:hover {
  border-color: var(--gray-500);
  color: var(--gray-900);
}

.compliance-markers-panel {
  display: grid;
  gap: 9px;
}

.compliance-marker-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-left: 4px solid currentColor;
  border-radius: 9px;
  background: var(--white);
}

.compliance-marker-item.selected {
  box-shadow: 0 0 0 2px rgba(215, 25, 32, .14);
}

.compliance-marker-item.critical {
  color: #c5141c;
}

.compliance-marker-item.high {
  color: #e36b17;
}

.compliance-marker-item.warning,
.compliance-marker-item.medium {
  color: #a87000;
}

.compliance-marker-item.info {
  color: #2779bd;
}

.marker-main-button {
  display: flex;
  min-width: 0;
  gap: 12px;
  padding: 14px;
  border: 0;
  color: var(--gray-900);
  background: transparent;
  text-align: left;
}

.marker-main-button:hover {
  background: var(--gray-100);
}

.marker-severity-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: currentColor;
}

.marker-content {
  display: block;
  min-width: 0;
}

.marker-top-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.marker-time {
  color: var(--gray-900);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.marker-severity-label {
  padding: 3px 7px;
  border-radius: 10px;
  color: currentColor;
  background: currentColor;
  background: color-mix(
    in srgb,
    currentColor 12%,
    white
  );
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.marker-title {
  display: block;
  color: var(--gray-900);
  font-size: 13px;
  font-weight: 700;
}

.marker-description {
  display: block;
  margin-top: 4px;
  color: var(--gray-700);
  font-size: 12px;
  line-height: 1.4;
}

.marker-play-button {
  align-self: center;
  margin-right: 13px;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  color: var(--gray-900);
  background: var(--white);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.marker-play-button:hover {
  border-color: var(--red);
  color: var(--red);
}

@media (max-width: 650px) {
  .compliance-marker-item {
    grid-template-columns: 1fr;
  }

  .marker-play-button {
    width: calc(100% - 28px);
    margin: 0 14px 13px;
  }

  .compliance-markers-heading {
    flex-direction: column;
  }
}


/* AdC transport marker buttons */

.marker-transport-button {
  min-width: 48px;
  font-weight: 800;
}

.marker-transport-button:hover {
  border-color: var(--red);
  color: var(--red);
}


/* ==========================================================
   Manual Compliance Markers
   ========================================================== */

.add-marker-button {
  min-width: 50px;
  border-color: #c8ccd2;
  font-weight: 800;
}

.add-marker-button:hover {
  border-color: var(--red);
  color: var(--red);
}

.manual-marker-overlay {
  z-index: 130;
}

.manual-marker-modal {
  width: min(620px, 100%);
  overflow: hidden;
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 25px 70px rgba(0, 0, 0, .32);
}

.manual-marker-body {
  display: grid;
  grid-template-columns:
    minmax(0, 2fr)
    minmax(150px, 1fr);
  gap: 18px;
  padding: 24px;
}

.manual-marker-field {
  min-width: 0;
}

.manual-marker-field.full-width {
  grid-column: 1 / -1;
}

.manual-marker-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 700;
}

.manual-marker-field input,
.manual-marker-field select,
.manual-marker-field textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--gray-300);
  border-radius: 7px;
  color: var(--gray-900);
  background: var(--white);
}

.manual-marker-field textarea {
  resize: vertical;
}

.manual-marker-field input:focus,
.manual-marker-field select:focus,
.manual-marker-field textarea:focus {
  border-color: var(--red);
  outline: 2px solid rgba(215, 25, 32, .12);
}

@media (max-width: 600px) {
  .manual-marker-body {
    grid-template-columns: 1fr;
  }

  .manual-marker-field.full-width {
    grid-column: auto;
  }

  .transport {
    flex-wrap: wrap;
  }
}


/* ==========================================================
   Compliance Marker Hover Tooltip
   ========================================================== */

.marker-tooltip[hidden] {
  display: none;
}

.marker-tooltip {
  position: fixed;
  z-index: 300;
  width: min(320px, calc(100vw - 20px));
  padding: 14px;
  border: 1px solid #30343a;
  border-radius: 10px;
  color: #f5f6f8;
  background: #181a1e;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .32);
  pointer-events: none;
}

.marker-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.marker-tooltip-header > strong {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.marker-tooltip-severity {
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.marker-tooltip-severity.critical {
  background: #c5141c;
}

.marker-tooltip-severity.high {
  background: #e36b17;
}

.marker-tooltip-severity.warning,
.marker-tooltip-severity.medium {
  color: #302000;
  background: #e6aa18;
}

.marker-tooltip-severity.info {
  background: #2779bd;
}

.marker-tooltip-title {
  margin-bottom: 7px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.marker-tooltip-description {
  color: #c9cdd3;
  font-size: 12px;
  line-height: 1.45;
}

.marker-tooltip-meta {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #34383e;
}

.marker-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #aeb3bb;
  font-size: 11px;
}

.marker-tooltip-row strong {
  color: #e5e7eb;
  text-align: right;
}
