/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Global look & feel improvements */
html, body {
  height: 100%;
}

body {
  display: flex;
  background:
          /*
          radial-gradient(1200px 600px at 10% 0%, rgba(13,110,253,.06), transparent 60%),
          radial-gradient(1000px 500px at 90% 20%, rgba(32,201,151,.06), transparent 60%),

           */
              #f8f9fb;
}

main.container {
  flex: 1 0 auto;
}

/* Typography tweaks */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: .2px;
}

/* Helper spacing for lists that render items */
.stack-sm > * + * { margin-top: .5rem; }
.stack-md > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }

/* Custom button colors */
.btn-dark-gray {
  background-color: #2b2b2b;
  border-color: #2b2b2b;
  color: #fff;
}

.btn-dark-gray:hover {
  background-color: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

.btn-dark-gray:active, .btn-dark-gray:focus {
  background-color: #0d0d0d;
  border-color: #0d0d0d;
  color: #fff;
  box-shadow: 0 0 0 0.25rem rgba(43, 43, 43, 0.5);
}

/* Tables and forms look a bit nicer with subtle rounding */
.table,
.form-control,
.btn,
.card,
 .alert {
   border-radius: .5rem;
}

/* Slightly smaller sort carets in table headers */
.fs-table [data-table-sort-target="icon"] {
  font-size: 0.75em; /* make carets a little smaller */
  line-height: 1;
  /* make caret color lighter to reduce visual weight */
  color: var(--bs-secondary-color, #6c757d);
}

/* Footer subtle background fallback if variable not supported */
.bg-light-subtle {
  background-color: rgba(248, 249, 250, 0.7);
}

.mr-md-300 {
  margin-right: 0;
}


/* Compact inline audio player */
.file-item-line {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap; /* allow wrap on narrow screens */
}

.file-item-name {
  flex: 0 1 auto;
}

.audio-player {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.audio-player__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  line-height: 1;
  border: 1px solid rgba(0,0,0,.15);
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-size: .9rem;
  padding: 0;
}

.audio-player__btn:hover {
  background: #f3f4f6;
}

.audio-player__progress {
  appearance: none;
  -webkit-appearance: none;
  height: .35rem;
  background: #e5e7eb;
  border-radius: 999px;
  outline: none;
  width: clamp(120px, 24vw, 260px); /* compact on large screens */
  min-width: 0;
}

.audio-player.flex-column .audio-player__progress {
  display: block;
}

@media (max-width: 991.98px) {
  .audio-player:not(.flex-column) .audio-player__progress {
    display: none;
  }
}

/* Simple dropzone styles */
.dz-box {
  border: 2px dashed rgba(0,0,0,.1);
  background: #fff;
  padding: 1rem;
  text-align: center;
  color: #6c757d;
  border-radius: .5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dz-box.dz-over {
  border-color: #0d6efd;
  background: rgba(13,110,253,.05);
  color: #0d6efd;
}

.dz-box.dz-over .dz-overlay {
  opacity: 1;
}

.dz-quadratic-container {
  position: relative;
  width: 220px;
}

.dz-quadratic {
  width: 220px;
  height: 220px;
  position: relative;
}

.dz-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: .4rem;
}

.dz-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13,110,253, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: .4rem;
}

.dz-box:hover .dz-overlay {
  opacity: 1;
}

.dz-preview-container {
  position: relative;
  display: inline-block;
}

.dz-preview-container form,
.dz-preview-container a.btn-delete-image {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(50%, -50%);
  z-index: 10;
  line-height: 1;
}

.dz-preview-container .btn-delete-image {
  background: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #dc3545;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

.dz-preview-container .btn-delete-image:hover {
  background: #fff;
  color: #bb2d3b;
}

/* Chrome/Safari slider styling */
.audio-player__progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: .8rem;
  height: .8rem;
  background: #0d6efd;
  border-radius: 50%;
  cursor: pointer;
  margin-top: -0.225rem; /* centers the thumb on the track */
}

/* Firefox slider styling */
.audio-player__progress::-moz-range-thumb {
  width: .8rem;
  height: .8rem;
  background: #0d6efd;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.audio-player__progress::-moz-range-track {
  height: .35rem;
  background: #e5e7eb;
  border-radius: 999px;
}

.file-item-line {
  gap: .75rem;
}

.file-item-line .text-truncate {
  /* No flex-grow-1 here, let it be naturally sized up to available space */
}
.file-item-form-row {
  display: flex;
  flex-direction: column;
  gap: .75rem 1rem;
}

.file-item-form-row .form-group {
  min-width: 0; /* allow shrinking of text input */
}

/* Responsive filesystem browser */
.fs-browser {
  width: 100%;
  /* Removed overflow-x: auto to prevent dropdown clipping */
}

.fs-table {
  width: 100%;
  margin-bottom: 1rem;
  vertical-align: top;
  border-color: var(--bs-table-border-color);
  /* Minimal look: remove solid white backgrounds and tone down borders */
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(0,0,0,.06);
}

/* Ensure cell backgrounds stay transparent in all states */
.fs-table > :not(caption) > * > * {
  background-color: transparent !important;
}

/* Subtle hover background for readability */
.fs-table.table-hover > tbody > tr:hover > * {
  background-color: rgba(13,110,253,.04) !important; /* very light primary tint */
}

/* Brighter/clearer headings */
.fs-table thead th {
  color: #334155; /* slate-700 like */
  font-weight: 600;
  border-bottom-color: rgba(0,0,0,.08);
}

.fs-table .fs-name {
  /* Keep this as a true table-cell to maintain equal row heights with sibling <td> */
  min-width: 0; /* allow child link to shrink while remaining visible */
}

.fs-table .fs-name a {
  display: inline-block;
  max-width: none; /* Allow it to take available space */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #334155; /* slate-700 like */
}

/* Folder name cell: keep icon aligned to the left of the text label */
.fs-table .fs-name .fs-name__label {
  display: flex; /* Use flex instead of inline-flex */
  align-items: center;
  gap: .35rem;
  font-weight: 500;
  max-width: 100%;
}

.fs-table .fs-name .fs-name__icon {
  color: #6b7280; /* muted icon */
  opacity: .9;
  flex-shrink: 0;
}

/* On mobile, we need to limit the width so it doesn't push the last column (actions) */
@media (max-width: 767.98px) {
  .fs-table .fs-name {
    max-width: 60vw; /* Limit the cell itself on mobile */
  }
}

@media (min-width: 768px) {
  .fs-table .fs-name a { max-width: 50vw; }
}

/* Drag & drop upload area */
.dropzone {
  border: 2px dashed rgba(13,110,253,.35);
  background: rgba(13,110,253,.04);
  border-radius: .75rem;
  padding: 1rem;
}

.dropzone__inner {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #334155;
}

.dropzone i {
  font-size: 1.5rem;
  color: #0d6efd;
}

.dropzone__text {
  display: flex;
  flex-direction: column;
}

.dropzone--over {
  border-color: #0d6efd;
  background: rgba(13,110,253,.08);
}

.dropzone__progress[data-tone="error"] { color: #dc3545; }
.dropzone__progress[data-tone="warning"] { color: #fd7e14; }

/* Upload Overlay Styles */
.upload-list::-webkit-scrollbar {
  width: 6px;
}

.upload-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.upload-list::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.upload-item:last-child {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.transition-all {
  transition: all 0.3s ease-in-out;
}

.file-item-form-row .form-group--submit {
  align-self: flex-start;
}

@media (min-width: 992px) {
  .file-item-form-row {
    flex-direction: row;
    align-items: flex-end;
  }

  .file-item-form-row .form-group {
    flex: 1 1 auto;
  }

  .file-item-form-row .form-group--submit {
    flex: 0 0 auto;
    align-self: auto;
  }
}

/* Folder player UI */
.folder-player-ui {
  background-color: transparent;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  overflow: hidden;
}

.folder-player-ui .card-body {
  padding: 1.25rem;
}

.folder-player-ui__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.folder-player-ui__controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.folder-player-ui__title-area {
  flex-grow: 1;
  min-width: 0;
}

.folder-player-ui__now-playing {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.folder-player-ui__title {
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-player-ui__list {
  max-height: 250px;
  overflow-y: auto;
  margin-top: 1.25rem;
  border-top: 1px solid rgba(0,0,0,.05);
  padding-top: 0.5rem;
  scrollbar-width: thin;
}

.folder-player-ui__list::-webkit-scrollbar {
  width: 6px;
}

.folder-player-ui__list::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,.1);
  border-radius: 3px;
}

.folder-player-ui__item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: #475569;
  cursor: pointer;
  border-radius: 0.375rem;
  margin-bottom: 1px;
  transition: background-color 0.15s ease;
}

.folder-player-ui__item:hover {
  background-color: rgba(13,110,253,.04);
  color: #0d6efd;
}

.folder-player-ui__item.active {
  background-color: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-secondary-color, #6c757d);
  font-weight: 500;
}

.folder-player-ui__item.disabled {
  color: #94a3b8;
  cursor: not-allowed;
  pointer-events: none;
}

.folder-player-ui__item-index {
  width: 1.5rem;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-right: 0.5rem;
}

.folder-player-ui .btn-close {
  padding: 0.5rem;
  margin: -0.5rem -0.5rem -0.5rem auto;
}

.folder-player-indent {
  padding-left: 2rem;
  padding-right: 1rem;
  padding-bottom: 1rem;
}

@media (min-width: 768px) {
  .folder-player-indent {
    padding-left: 3rem;
    padding-right: 15%;
  }
}

/* Hide Trix attachment buttons (no file attachments allowed in editors) */
.trix-button-group--file-tools {
    display: none !important;
}

.callout {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #dee2e6;
  border-left-width: .3rem;
  border-radius: .375rem;
  background-color: #fff;
}

.callout-primary {
  border-left-color: #0d6efd;
}
.callout-secondary {
  border-left-color: #6c757d;
}
.callout-success {
  border-left-color: #198754;
}
.callout-info {
  border-left-color: #0dcaf0;
}
.callout-warning {
  border-left-color: #ffc107;
}
.callout-danger {
  border-left-color: #dc3545;
}

/* Audio Inspector responsive height */
.audio-inspector-viewport {
  height: 128px;
}

@media (min-width: 992px) {
  .audio-inspector-viewport {
    height: 256px;
  }
}
