/* Project Upload Styles */

/* ===== Upload page (order items listing) ===== */

.project-upload-page {
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
  padding: 3.43rem;
  text-align: left;
}

.project-upload-page__header {
  margin-bottom: 2rem;
}

.project-upload-page__header h2 {
  margin-bottom: 0.5rem;
}

.project-upload-page__item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

.project-upload-page__item-info {
  flex: 1;
}

.project-upload-page__item-info h3 {
  margin: 0 0 0.25rem 0;
}

.project-upload-page__item-qty {
  font-size: 0.9em;
  color: #666;
}

.project-upload-page__item-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.project-upload-page__item-files {
  font-size: 0.85em;
  color: #666;
}

.project-status--not-started {
  background: #f0f0f0;
  color: #666;
}

@media (max-width: 600px) {
  .project-upload-page__item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .project-upload-page__item-status {
    align-items: flex-start;
  }
}

/* ===== Item upload page ===== */

.project-upload-item {
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
  padding: 3.43rem;
  text-align: left;
}

.project-upload-item__back {
  color: #0071b8;
  text-decoration: none;
  margin-left: auto;
}

.project-upload-item__back:hover {
  text-decoration: underline;
}

.project-upload-item__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #9acd32;
}

.project-upload-item__header-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.project-upload-item__header h2 {
  margin: 0;
}

.project-upload-item__qty {
  font-size: 0.9em;
  color: #666;
}

/* Project name */
.project-upload-item__name {
  margin-bottom: 1.5rem;
}

.project-upload-item__name label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.project-upload-item__name input {
  width: calc(50% - 0.75rem);
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
}

.project-upload-item__name input:disabled {
  background: #f5f5f5;
  color: #666;
}

/* Confirmation checkbox */
.project-upload-item__confirmation {
  margin-top: 0;
  padding: 1rem 1.25rem;
  background: #fdf8e8;
  border: 1px solid #e0d5a0;
  border-radius: 4px;
}

.project-upload-item__confirmation-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: normal;
  line-height: 1.75;
}

.project-upload-item__confirmation-label span {
  line-height: 1.75;
}

.project-upload-item__confirmation-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.25rem;
  width: 1.1rem;
  height: 1.1rem;
}

/* Actions */
.project-upload-item__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.project-upload-item__actions .button {
  margin: 0;
}

/* Status badges */
.project-status {
  display: inline-block;
  padding: 0.25em 0.75em;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-status--draft {
  background: #fff3cd;
  color: #856404;
}

.project-status--submitted {
  background: #cce5ff;
  color: #004085;
}

.project-status--in_production {
  background: #d4edda;
  color: #155724;
}

/* ===== Upload sections ===== */

#upload-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (max-width: 768px) {
  #upload-sections {
    grid-template-columns: 1fr;
  }

  .project-upload-item__name input {
    width: 100%;
  }

  .project-upload-item__actions {
    flex-direction: column;
  }

  .project-upload-item__actions .button {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    margin: 0;
  }

  .project-upload-item__back {
    margin-left: 0;
    text-align: center;
  }

  .section-file-list--music {
    grid-template-columns: 1fr;
  }

  .section-file-list--music > .section-file-item--header {
    display: none;
  }

  .section-file-list--music > .section-file-item--music {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem 0;
  }

  .section-file-list--music > .section-file-item--music > * {
    min-height: auto;
    padding: 0;
  }

  .section-file-item__position {
    flex-shrink: 0;
  }

  .section-file-item--music .section-file-item__name {
    flex: 1;
    white-space: normal;
    overflow: visible;
  }

  .section-file-item__track-cell {
    flex-basis: 100%;
  }
}

.project-upload-section {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 1rem;
  background: #fafafa;
}

.project-upload-section--full-width {
  grid-column: 1 / -1;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.section-title {
  margin: 0;
  font-size: 1.1em;
}

.section-templates-btn {
  background: none;
  border: 1px solid #0071b8;
  color: #0071b8;
  padding: 0.25em 0.6em;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8em;
  white-space: nowrap;
}

.section-templates-btn:hover {
  background: #0071b8;
  color: #fff;
}

/* Music section metadata (album/artist) */
.section-music-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-music-meta__label {
  display: block;
  font-weight: 600;
  font-size: 0.85em;
  margin-bottom: 0.25rem;
}

.section-music-meta__input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}

.section-music-meta__input:focus {
  border-color: #9acd32;
  outline: none;
  box-shadow: 0 0 0 2px rgba(154, 205, 50, 0.25);
}

.section-music-meta__input:disabled {
  background: #f5f5f5;
  color: #666;
}

.section-music-meta__input::placeholder {
  color: #aaa;
  font-style: italic;
}

@media (max-width: 600px) {
  .section-music-meta {
    grid-template-columns: 1fr;
  }
}

/* File list */
.section-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.section-file-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  gap: 0.5rem;
}

.section-file-item:last-child {
  border-bottom: none;
}

.section-file-item__name {
  font-weight: 500;
  word-break: break-all;
  min-width: 0;
  flex: 1;
}

.section-file-item__size {
  color: #666;
  font-size: 0.85em;
  white-space: nowrap;
}

.section-file-item__remove {
  background: none;
  border: 1px solid #dc3545;
  color: #dc3545;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8em;
  white-space: nowrap;
}

.section-file-item__remove:hover {
  background: #dc3545;
  color: #fff;
}

/* ===== Music file list (table-like grid) ===== */

.section-file-list--music {
  display: grid;
  /* Columns: Position (drag+label) | File Name | Track Name | Size | Actions */
  grid-template-columns: 5.5rem minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
}

/* Each music row spans all columns and uses subgrid */
.section-file-list--music > .section-file-item--music,
.section-file-list--music > .section-file-item--header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  padding: 0;
  gap: 0;
  border-bottom: 1px solid #eee;
}

.section-file-list--music > .section-file-item--header {
  border-bottom: 2px solid #ddd;
}

/* Column header cells */
.section-file-list--music > .section-file-item--header {
  background: #474747;
  border-radius: 3px 3px 0 0;
}

.section-file-item--header > span {
  font-weight: 600;
  font-size: 0.8em;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.4rem 0.5rem;
  white-space: nowrap;
}

.section-file-item--header > span:first-child {
  padding-left: 0.5rem;
}

/* Grid cells in music data rows */
.section-file-list--music > .section-file-item--music > * {
  padding: 0.45rem 0.4rem;
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

/* Position column: drag handle + track label side by side */
.section-file-item__position {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: grab;
}

.section-file-item--music .section-file-item__drag-handle {
  flex-shrink: 0;
}

.section-file-item__track-label {
  font-weight: 700;
  font-size: 0.85em;
  white-space: nowrap;
  cursor: grab;
}

/* File Name column */
.section-file-item--music .section-file-item__name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Track Name column */
.section-file-item__track-cell {
  min-width: 0;
}

.section-file-item__track-name {
  width: 100%;
  min-width: 0;
  padding: 0.25rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: inherit;
  box-sizing: border-box;
}

.section-file-item__track-name:focus {
  border-color: #9acd32;
  outline: none;
  box-shadow: 0 0 0 2px rgba(154, 205, 50, 0.25);
}

.section-file-item__track-name:disabled {
  background: #f5f5f5;
  color: #666;
}

.section-file-item__track-name::placeholder {
  color: #aaa;
  font-style: italic;
}

/* Actions column */
.section-file-item__actions {
  white-space: nowrap;
}

/* Uploading/error placeholders inside music grid span all columns */
.section-file-list--music > .section-file-item--uploading,
.section-file-list--music > .section-file-item--error {
  grid-column: 1 / -1;
}

/* Dragging state for music grid rows */
.section-file-list--music > .section-file-item--dragging {
  opacity: 0.4;
}

.section-file-list--music > .section-file-item--drag-over {
  border-top: 2px solid #9acd32;
}

/* Drag handle */
.section-file-item__drag-handle {
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  width: 14px;
  height: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.section-file-item__drag-handle::before,
.section-file-item__drag-handle::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}

.section-file-item__drag-handle::before {
  border-bottom: 6px solid #bbb;
}

.section-file-item__drag-handle::after {
  border-top: 6px solid #bbb;
}

.section-file-item__drag-handle:hover::before {
  border-bottom-color: #555;
}

.section-file-item__drag-handle:hover::after {
  border-top-color: #555;
}

/* Dragging state */
.section-file-item--dragging {
  opacity: 0.4;
}

.section-file-item[draggable="true"] {
  touch-action: none;
}

/* Drop target indicator */
.section-file-item--drag-over {
  border-top: 2px solid #9acd32;
}

/* Uploading state */
.section-file-item--uploading {
  opacity: 0.8;
}

.section-file-item__progress {
  flex: 1;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
}

.section-file-item__progress-bar {
  height: 100%;
  width: 0;
  background: #9acd32;
  border-radius: 2px;
  transition: width 0.15s ease;
}

.section-file-item__pct {
  font-size: 0.8em;
  color: #666;
  min-width: 3em;
  text-align: right;
}

/* Error state */
.section-file-item--error .section-file-item__name {
  color: #dc3545;
}

.section-file-item__error {
  color: #dc3545;
  font-size: 0.85em;
  flex: 1;
}

.section-file-item__retry {
  background: none;
  border: 1px solid #0071b8;
  color: #0071b8;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8em;
}

.section-file-item__retry:hover {
  background: #0071b8;
  color: #fff;
}

/* Removing state */
.section-file-item--removing {
  opacity: 0.4;
  pointer-events: none;
}

/* ===== Dropzone ===== */

.section-dropzone {
  margin-top: 0.75rem;
  padding: 1.25rem;
  border: 2px dashed #ccc;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

/* Music section top area (dropzone + CD-Text info) */
.section-music-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.section-music-top .section-dropzone {
  margin-top: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-music-top__info {
  font-size: 0.75rem;
  color: #555;
  line-height: 1.5;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.75rem 1rem;
}

.section-music-top__text {
  margin: 0 0 0.5rem;
  font-size: inherit;
}

.section-music-top__rules {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.75rem;
  margin: 0;
}

.section-music-top__rules dt {
  font-weight: 600;
  white-space: nowrap;
}

.section-music-top__rules dd {
  margin: 0;
}

.section-music-top__rules dd.section-music-top__rules--mono {
  font-family: monospace;
  letter-spacing: 0.05em;
}

@media (max-width: 768px) {
  .section-music-top {
    grid-template-columns: 1fr;
  }
}

.section-dropzone:hover {
  border-color: #9acd32;
  background: #fafff0;
}

.section-dropzone--active {
  border-color: #9acd32;
  background: #f0fadc;
}

.section-dropzone__label {
  color: #666;
  font-size: 0.9em;
  pointer-events: none;
}

/* ===== Save status toast ===== */

.save-status {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 1000;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.save-status--saving {
  opacity: 1;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

.save-status--saved {
  opacity: 1;
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* ===== Buttons ===== */

.button--accent {
  background: #9acd32;
  color: #1a1a1a;
  border: 1px solid #8ab82d;
  font-weight: 600;
}

.button--accent:hover {
  background: #8ab82d;
}

/* ===== Inline notifications ===== */

#upload-notifications {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#upload-notifications:not(:empty) {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.upload-notification {
  padding: 1rem 1.25rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  animation: notification-fade-in 0.3s ease;
}

.upload-notification--success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.upload-notification--error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.upload-notification--info {
  background: #cce5ff;
  color: #004085;
  border: 1px solid #b8daff;
}

.upload-notification--fade {
  opacity: 0;
  transition: opacity 0.4s ease;
}

@keyframes notification-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Template dialog ===== */

#template-dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  max-width: 50rem;
  width: 90vw;
  max-height: 85vh;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

#template-dialog::backdrop {
  background: rgba(0,0,0,0.5);
}

.template-dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.template-dialog__header h3 {
  margin: 0;
}

.template-dialog__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0.25rem;
  line-height: 1;
}

.template-dialog__close:hover {
  color: #000;
}

.template-dialog__body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(85vh - 4rem);
}

.template-dialog__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 600px) {
  .template-dialog__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.template-dialog__card {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.template-dialog__card:hover {
  border-color: #9acd32;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.template-dialog__image {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4/3;
  object-fit: contain;
  background: #f5f5f5;
}

.template-dialog__info {
  padding: 0.75rem;
  text-align: center;
}

.template-dialog__card-title {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.9em;
}

.template-dialog__download {
  display: inline-block;
  background: #9acd32;
  color: #1a1a1a;
  border: 1px solid #8ab82d;
  text-decoration: none;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0.3em 0.85em;
  border-radius: 3px;
}

.template-dialog__download:hover {
  background: #8ab82d;
  text-decoration: none;
}

/* ===== Token request form ===== */

.bison-project-upload-token-request-form {
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
  padding: 3.43rem;
  text-align: left;
}

/* ===== Help text ===== */

.project-upload-page__help {
  margin-top: 2rem;
  padding: 1rem;
  background: #f5f5f5;
  border-radius: 4px;
}

/* ===== User projects page ===== */

.user-projects__order {
  margin-bottom: 2rem;
}

.user-projects__order h3 {
  border-bottom: 2px solid #9acd32;
  padding-bottom: 0.5rem;
}

.user-projects__date {
  font-weight: normal;
  font-size: 0.85em;
  color: #666;
  margin-left: 1em;
}

.user-projects__table {
  width: 100%;
  border-collapse: collapse;
}

.user-projects__table th,
.user-projects__table td {
  padding: 0.5rem 1rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.user-projects__table th {
  background: #f5f5f5;
  font-weight: 600;
}

/* ===== Admin list ===== */

.admin-project-list__table {
  width: 100%;
  border-collapse: collapse;
}

.admin-project-list__table th,
.admin-project-list__table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.admin-project-list__table th {
  background: #f5f5f5;
  font-weight: 600;
  white-space: nowrap;
}

.admin-project-list__table a {
  color: #0071b8;
}

/* ===== Admin detail ===== */

.admin-project-detail__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-project-detail__header h2 {
  margin: 0;
}

.admin-project-detail__meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
}

.admin-project-detail__meta dt {
  font-weight: 600;
}

.admin-project-detail__meta dd {
  margin: 0;
}

.admin-project-detail__actions {
  margin: 1.5rem 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-project-detail__category {
  margin-bottom: 1.5rem;
}

.admin-project-detail__category h4 {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.25rem;
}

.admin-project-detail__category ul {
  list-style: none;
  padding: 0;
}

.admin-project-detail__category li {
  padding: 0.35rem 0;
}

.admin-project-detail__category .filesize {
  color: #666;
  font-size: 0.85em;
}

/* Upload URL display */
.admin-project-detail__upload-url {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  background: #f0f8ff;
  border: 1px solid #b8daff;
  border-radius: 4px;
}

.admin-project-detail__upload-url label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.admin-project-detail__url-row {
  display: flex;
  gap: 0.5rem;
}

.admin-project-detail__url-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9em;
  background: #fff;
}

/* Status transition button styles */
.button--warning { background: #ffc107; color: #1a1a1a; border: 1px solid #e0a800; }
.button--warning:hover { background: #e0a800; }
.button--success { background: #28a745; color: #fff; border: 1px solid #218838; }
.button--success:hover { background: #218838; }

.admin-project-detail__notes {
  margin-top: 2rem;
  padding: 1rem;
  background: #fff3cd;
  border-radius: 4px;
}
