/* public/css/main.css - responsive + simple styling (mobile-first) */
/* =========================================
   1. Root & Resets
   ========================================= */
.light {
  /* Brand identity */
  --brand: #375a7f;

  /* Light theme defaults */
  --bg: #ffffff;         /* page background */
  --text: #333333;       /* primary text */
  --card-bg: #f9f9f9;    /* cards/forms background */
  --page-bg: #f7f8fa;    /* outer wrapper background */
  --accent: #375a7f;     /* buttons/links 007bff*/
  --muted: #666;         /* secondary text */
}

.dark {
  --brand: #9fc5e8;
  --bg: #292929;
  --text: #e0e0e0;
  --card-bg: #3f4449;
  --page-bg: #181818;
  --accent: #66b3ff;
  --muted: #999;
}

.theme-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
}

.theme-icon {
  width: 24px;
  height: 24px;
  transition: filter 0.3s ease;
}

/* Default = light mode (normal image) */
body.light .theme-icon {
  filter: none;
}

/* Dark mode → invert the PNG */
body.dark .theme-icon {
  filter: invert(1);
}

.dark .lang-switch button {
  color: var(--text); /* stays in sync */
}

/* LANGUAGE SELECTOR */

.lang-switch {
  position: relative;
  transform: translateY(5px);
}

.lang-dropdown {
  position: relative;
  display: inline-block;
}

.lang-switch button {
  background: none;
  border: none;
  font-size: 0.8rem; 
  color: inherit; /* will follow --text (light/dark mode) */
  padding: 0.2rem 0.4rem;
}

.active-flag {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
}

.lang-options {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--background, #fff);
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 10;

  /* hidden by default */
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;

  /* animation */
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lang-options.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-options button {
  background: none;
  border: none;
  font-size: 0.8rem;     /* text-size better than emoji size */
  /*font-weight: bold;*/
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  min-width: 2.2rem;      /* ensures consistent button size */
  text-align: center;}

.lang-options button:hover {
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
}


/* MAIN */

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  height: 100%;
  margin: 20px auto 20px;
  background: var(--page-bg);
  color: #222;
  line-height: 1.4;
  padding: 0 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
}

.album {
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px;
}

/* =========================================
   2. Layout
   ========================================= */

/* header */
.site-header { margin-bottom: 12px; }
.nav { 	display:flex; 
		flex-wrap:wrap; 
		gap: 1rem;
		align-items:center; }
.nav a { font-size:0.8rem; color: var(--brand); text-decoration: none; padding:6px 8px; border-radius:4px; }
.nav a:hover { background: rgba(3,102,214,0.08); }

.nav-welcome {
  margin-left: 0;   /* override auto */
  color: var(--muted);
  font-size: 0.8rem;
  padding-left: 12px;
}

.nav a,
.nav .nav-welcome,
.nav .lang-switch,
.nav .theme-btn {
  display: inline-flex;
  align-items: center;
}

.nav-welcome{
	gap: 0.35rem; /* controls space between welcome text and name */
}


/* footer */
.site-footer { margin-top: 20px; color: var(--muted); text-align:center; font-size:0.6rem; }
.site-footer hr {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1); /* very faint */
  margin: 2rem 0;
}


/* =========================================
   3. Flash Messages
   ========================================= */
/* flash */
.flash {
  padding: 10px;
  border-radius: 6px;
  margin: 10px 0;
  transition: opacity 0.5s ease, max-height 0.5s ease, margin 0.5s ease;
  overflow: hidden;
  max-height: 200px; /* large enough for content */
}

.flash.success { background: #e6ffed; color: #1b6a2f; }
.flash.error { background: #ffe6e6; color: #8c1b1b; }

.flash.fade-out {
  opacity: 0;
  max-height: 0;
  margin: 0;
}

/* =========================================
   4. Forms
   ========================================= */

/* form controls */
form { margin: 10px 0 20px; }
form label {
  display: block;
  margin-top: 10px;
  font-weight: 600;
}

input[type="text"], input[type="number"], input[type="password"], input[type="hidden"], select, textarea {
  width: 30em;
  max-width: 720px;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin: 2px 0;
  background: #fff;
}
input[type="file"] { margin: 6px 0; }

/* Title expands */
.track-row input[type="text"] {
  flex: 1;
}


/* consistent compact widths */

input.track-number[type="number"] {
	display: inline-block;
}

.form-row.year-location {
  display: flex;
  gap: 30px;
}

/* Each group stacks label above input */
.form-row.year-location .form-group {
  flex: 0 0 auto;   /* don’t stretch */
  display: flex;
  flex-direction: column;
}

input.year-field {
  width: 6em;        /* always fixed */  
  text-align: center;
}

input.tag-location[type="text"] {
  width: 6em;        /* also fixed */  
  text-align: center;
}

input.track-duration[type="text"] {
	flex: 0 0 6em;
  width: 6em !important;
  text-align: center;
  display: inline-block;
}

/* Track number: small fixed width */
.track-row .track-number {
  flex: 0 0 4em;
  width: 4em;
  text-align: center;
}

/* ========= SEARCH */
/* search form */
.search-form {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  flex-direction: column;
}

.search-form input[type="text"] {
  flex: 1;
  padding: 12px 14px; /* more space inside (top/bottom, left/right) */  
  line-height: 1.5;      /* improves vertical text alignment */
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px; /* rounder corners */
  width: 100%;
}

.search-form button {
  padding: 8px 12px;
}

/* Search */
.search-results-count {
  margin: 10px 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.search-results-count strong {
  color: var(--brand);
}

.search-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========== SEARCH ADVANCED OPTIONS */

#advanced-options {
  display: flex;
  flex-wrap: wrap;       /* allow wrapping if too many checkboxes */
  gap: 12px;             /* space between checkboxes */
  margin-top: 0;
  }

#advanced-options label {
  display: inline-flex;  /* sit side by side */
  align-items: center;   /* align checkbox with text */
  font-size: 0.95rem;
  cursor: pointer;
}

#advanced-options.hidden {
  display: none;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--brand);
}

/* =========== TRACK CONTROLS */
/* Track rows for edit/add album */
.track-row {
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-top: 6px;
  transition: background 0.2s ease, border-color 0.2s ease;
  cursor: move; /* show grab hand */
}

/* Hover feedback */
.track-row:hover {
  background: rgba(3, 102, 214, 0.04); /* light brand tint */
  border-radius: 4px;
}

/* Optional: nicer cursor style */
.track-row:active {
  cursor: grabbing;
}

/* Highlight when another row is dragged over */
.track-row.drag-over {
  border: 2px dashed var(--brand);
  background: rgba(3,102,214,0.05);
}

/* Placeholder spacing during drag */
.track-row.placeholder {
  height: 48px;            /* reserve space roughly equal to a row */
  border: 2px dashed var(--brand);
  background: rgba(3, 102, 214, 0.05);
  border-radius: 4px;
  margin: 6px 0;
}

/* Two-column layout for manual entry form */
.form-grid {
  display: grid;
  grid-template-columns: 500px auto; /* left fixed at 400px, right fills remaining */
  gap: 20px;
  align-items: start;
}

.form-left {
  display: flex;
  flex-direction: column;
}

.form-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* =========================================
   5. Buttons
   ========================================= */
   
.button {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}

/* Primary (default action) */
.button-primary,
button,
input[type="submit"] {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
}
.button-primary:hover,
button:hover,
input[type="submit"]:hover {
  opacity: 0.95;
}

/* Secondary (outlined) */
.button-secondary,
.expand-btn {
  background: transparent;
  border: 1px solid var(--brand);
  color: var(--brand);
}
.button-secondary:hover,
.expand-btn:hover {
  background: var(--brand);
  color: #fff;
}

/* Destructive (danger) */
.button-danger,
.track-row .remove-btn {
  background: #fdecea;
  border: 1px solid #ef9a9a;
  color: #c62828;
  font-size: 16px;
}
.button-danger:hover,
.track-row .remove-btn:hover {
  color: #fff;
  background: #c62828;
}

/* =========================================
   6. Catalogue Views
   ========================================= */
/* -------------------------
   Universal appearance (applies to all views)
   ------------------------- */
.album {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow: hidden;          /* avoids odd overflow when sizes change */
  /* keep minimal layout-neutral padding/margins so view-specific rules control spacing */
}

.album .album-cover img.cover {
  object-fit: cover;
  display: block;
  border-radius: 6px;
  background: #eee;
}

/* support both .details and .album-details naming */
.album .details,
.album .album-details {
  min-width: 0;              /* keeps text truncation working in flex children */
}

/* Shared styles across all views */
.album-title {
  margin: 0;               /* kill default margins */
  font-size: 1rem;         /* adjust to your liking */
  line-height: 1.2;        /* tighter spacing */
}

.album-meta {
  margin: 2px 0 0 0;       /* small gap below title */
  font-size: 0.9rem;
  color: var(--muted, #666);
  line-height: 1.2;
}

.album-status {
  font-size: 0.9rem;
  color: #c00;
  font-style: italic;
  margin: 2px 0;
}

/* Inactive album cards visual indicator */
.album.inactive {
  opacity: 0.6;
  background: #f5f5f5;
}

.album.inactive .album-title,
.album.inactive .album-artist {
  color: #c62828;         /* washed red */
  text-decoration: line-through;
  opacity: 0.7;           /* slightly faded */
}

/*Location tag inactive style*/
.inactive-test {
  color: red !important;
  font-weight: bold;
  border: 1px solid red;
}

.album-status-edit {
  margin: 10px 0;
  font-size: 1.1rem;
}

/* Base badge style */
.status-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 0.4em;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Active (green) */
.status-badge.active {
  background-color: #e6f4ea; /* light green background */
  color: #2e7d32;           /* dark green text */
  border: 1px solid #a5d6a7;
}

/* Inactive (red) */
.status-badge.inactive {
  background-color: #fdecea; /* light red background */
  color: #c62828;            /* dark red text */
  border: 1px solid #ef9a9a;
}

//* -------------------------
   LIST view (detailed, default when searching)
   ------------------------- */
.view-list .catalogue {
  display: block;          /* stack albums vertically */
  padding: 0;
  margin: 0;
  
}

/* Outer container: album row */
.view-list .album {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
}

/* Cover fixed on the left */
.view-list .album-cover img.cover {
  order:1;
  width: 120px;
  height: 120px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Details stacked vertically */
.view-list .album-details {
  order:2;
  display: flex;
  flex-direction: column;  /* stack title, artist, location */
  flex: 1;
}

/* Title bigger */
.view-list .album-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 0;
}

/* Artist under title */
.view-list .album-meta {
  font-size: 1rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Location under artist */
.view-list .album-location {
order:3;
  font-size: 1.2rem;
  color: #bbb;   /* lighter than artist */
  margin-top: 2px;
}

/* Edit button pinned to the far right */
.view-list .album-edit {
order:4;
  margin-left: auto;   /* pushes it all the way right */
  align-self: flex-start; /* align to top of row */
}
 /* tracklist */
.tracklist {
  margin: 8px 0 0;
  padding-left: 32px;        /* more breathing room */
  list-style-position: outside; /* ensures numbers are outside text */
}
.tracklist li {
  margin-bottom: 2px;        /* small spacing between tracks */
}

.hidden { 
  display: none !important; 
}
/* tracklists and expand buttons visible */
.expand-btn {
  display: inline-block;       /* shrink to fit text */
  margin-top: 8px;
  padding: 4px 8px;
  font-size: 0.9rem;
  background: var(--btn-secondary-bg, #eee);
  color: var(--brand);
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.album-details .expand-btn {
  display: inline-block;
  width: auto;          /* don’t stretch */
  max-width: none;      /* ignore any global max-width */
  align-self: flex-start; /* prevent flexbox stretching */
}

.view-list .button-edit {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.9rem;
  background: var(--btn-secondary-bg, #eee);
  color: var(--btn-secondary-color, #333);
  border-radius: 4px;
  margin-top: 0;
}

/* -------------------------
   GRID view (covers focused, 4-per-row on wide screens)
   ------------------------- */
.view-grid .catalogue {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  
}

.view-grid .album {
  display: flex;
  flex-direction: column;
  width: calc(25% - 12px);
  padding: 10px;
  margin: 0;
  border: 1px solid #ddd;
  text-align: center;
}

.view-grid .album .album-location {
  display: block;         /* put it on its own line under artist */
  font-size: 1rem;
  font-weight: bold;
  color: var(--muted);
  order:3;
  
}

.view-grid .album-cover img.cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 8px;
  object-fit: cover;
  order:1;
}
.view-grid .album-details {
  flex: none;
  text-align: center;
  order:2;
}
.view-grid .album-edit {
  margin-top: 6px;
  order:4;
}
.view-grid .album .button-edit {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
}
.view-grid .album .button-edit:hover {
  color: var(--link-hover, #000);
  text-decoration: underline;
}

/* responsive: fewer columns on small screens */
@media (max-width: 1100px) {
  .view-grid .album { width: calc(33.333% - 16px); }
}
@media (max-width: 700px) {
  .view-grid .album { width: calc(50% - 12px); }
}

/* -------------------------
   SHELF view (3 columns × 15 rows, fill top→down)
   ------------------------- */
.view-shelf .catalogue {
  display: grid;
  grid-auto-flow: column;               
  grid-template-rows: repeat(15, auto); 
  grid-template-columns: repeat(3, 1fr);
  grid-auto-columns: 1fr;
  gap: 6px 12px;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
}

/* Make each album fill cell */
.view-shelf .album {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 0.8rem;
  width: 100%;
  box-sizing: border-box;
}

/* Order: location → cover → details → edit */
.view-shelf .album-location {
  font-size: 1.2rem;
  font-weight: bold;
  min-width: 40px;
  text-align: left;
}
.view-shelf .album-cover {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
}
.view-shelf .album-cover img.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}
.view-shelf .album-details {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-shelf .album-edit {
  margin-left: auto;
}
.view-shelf .album .button-edit {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  padding: 0;
}
.view-shelf .album .button-edit:hover {
  color: #000;
}

/* Placeholder style */
.view-shelf .album.placeholder {
  background: var(--card-bg);
  opacity: 0.6;
  border: 1px dashed #ccc;
  color: #999;
  text-align: center;
}
.view-shelf .album.placeholder .album-cover {
  background: #eee;
  border-radius: 3px;
}
.view-shelf .album.placeholder .empty-label {
  font-weight: bold;
  color: #ddd;
  display: block;
}
.view-shelf .album.placeholder .location-code {
  font-size: 0.75rem;
  color: #eee;
}

/* View Switcher UI */
.view-switcher {
  display: flex;
  gap: 8px;
  margin: 15px 0;
  
}

.view-switcher .button {
  padding: 6px 12px;
  font-size: 0.9rem;
}

/* =========================================
   7. ALBUM PREVIEW
   ========================================= */
  
/* Styling for search preview results */
.album-preview {
  margin: 24px 0;
}

.album-preview .album {
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;  /* stack everything vertically */
  gap: 12px;               /* space between cover/details and form */
  background: #fafafa;       /* light background tint */
  border: 1px solid #ddd;    /* subtle border */
  border-radius: 8px;        /* rounded corners */
  margin-bottom: 24px;       /* space between multiple results */
}

.album-preview .album img.cover {
  max-width: 200px;
  height: auto;
  flex-shrink: 0;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.album-preview .album .details {
  flex: 1;
  padding: 4px 0;
}

.album-preview .album .tracklist {
  margin-top: 8px;
  padding-left: 32px;          /* room for numbers */
  list-style-position: outside;
}

.album-preview .preview-form {
  margin-top: auto;        /* pushes form to bottom */
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.album-preview .preview-form label {
  font-weight: bold;
}

.album-preview .preview-form input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 4px 6px;
}

.album-preview .preview-form .form-actions {
  display: flex;
  gap: 8px;
}

/* =========================================
   7.1. Album Flyout
   ========================================= */
 
  .album[data-album-id] {
  cursor: pointer;
}


/* === Album flyout === */

.album-flyout {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.album-flyout.hidden {
  display: none;
}

.album-flyout-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

/* Panel */
.album-flyout-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 600px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 12px rgba(0,0,0,0.2);
  padding: 1.2rem;
  overflow-y: auto;
}

/* Close button */
.album-flyout-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-size: 1.4rem;
  background: none;
  border: none;
  cursor: pointer;
}


 /*  =========================================
    7.2. FLYOUT CONTENT
    ============================================ 
    
    
    === Flyout content === */
    
    .album-core {
  display: contents;
}

.flyout-album {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.flyout-cover {
  max-width: 100%;
  border-radius: 4px;
  margin-bottom: 0.8rem;
}

.flyout-actions {
  margin-top: 1rem;
}

/* === Flyout tracks === */

/*.flyout-tracks {
  margin-top: 1rem;
}

.flyout-tracks h3 {
  margin-bottom: 0.4rem;
  font-size: 1rem;
}

.flyout-tracklist {
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

.flyout-tracklist li {
  margin-bottom: 0.2rem;
}*/





/* =========================================
   8. Misc
   ========================================= */
  
   
   /* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}
.pagination a, .pagination span {
  padding: 6px 10px;
  border: 1px solid var(--brand);
  
  border-radius: 4px;
  text-decoration: none;
  color: var(--brand);
}
.pagination span.current {
  background: var(--brand);
  color: #fff;
  font-weight: bold;
}

/* =========================================
   9. Responsive
   ========================================= */

/* responsive */
@media (max-width: 700px) {
  .nav-welcome { order: 3; width:100%; text-align: left; }
  .album { flex-direction: column; align-items: center; text-align: center; }
  .album img.cover { width: 60%; max-width: 240px; }
  .album .details { width:100%; }
  .track-row {
    flex-direction: column;
    align-items: stretch;
  }
  .track-row input {
    width: 100% !important;
  }
  /* Exceptions: don’t let number/duration blow up */
  .track-row .track-number,
  .track-row .track-duration {
    flex: 0 0 auto;
    width: auto !important;
    max-width: 120px;
    align-self: flex-start; /* keep them neat on the left */
  }
  
  
}

/* Responsive: stack on small screens */
@media (max-width: 700px) {
  .form-grid {
    grid-template-columns: 1fr; /* stack vertically on small screens */
  }
}



