/* CSS variables needed by music-log component styles */
:root {
  --clr-black: #171717;
  --clr-white: whitesmoke;
  --clr-yllw: #c0ea57;
  --clr-red: rgb(188, 23, 23);
}

/* ==========================================================================
   Utility
   ========================================================================== */
.hidden {
  display: none;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.music-log-header {
  flex-shrink: 0;
  padding: 8px 0 6px;
  font-family: var(--font-1);
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.content-wrap {
  flex: 1;
  min-height: 0;
}

.diary-entries {
  margin: 0;
  height: 100%;
  border-radius: 5px;
  overflow-y: auto;
  padding: 0 50px;
  box-sizing: border-box;
  backdrop-filter: blur(8px);
  scrollbar-width: none;
}

/* ==========================================================================
   Format Filters
   ========================================================================== */
.format-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.format-filter-btn {
  font-family: var(--font-1);
  font-size: 0.85em;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  background: none;
  border: 1px solid #111;
  color: #111;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.format-filter-btn:hover {
  background: #111;
  color: #f5fff5;
}

.format-filter-btn.active {
  background: #111;
  color: #f5fff5;
  border-color: #111;
}

.format-filter-btn[data-format="vinyl"].active {
  background-color: rgba(255, 200, 150, 1);
  border-color: rgba(255, 200, 150, 1);
  color: #5c3a1a;
}

.format-filter-btn[data-format="cd"].active {
  background-color: rgba(255, 182, 193, 1);
  border-color: rgba(255, 182, 193, 1);
  color: #5c3a4a;
}

.format-filter-btn[data-format="digital"].active {
  background-color: rgba(173, 216, 230, 1);
  border-color: rgba(173, 216, 230, 1);
  color: #2c4a5c;
}

.format-filter-btn[data-format="cassette"].active {
  background-color: rgba(255, 218, 185, 1);
  border-color: rgba(255, 218, 185, 1);
  color: #5c4a3a;
}

/* ==========================================================================
   Tag Dropdown
   ========================================================================== */
.tag-dropdown {
  position: relative;
}

.tag-dropdown-btn {
  font-family: var(--font-1);
  font-size: 0.85em;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  background: none;
  border: 1px solid #111;
  color: #111;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-dropdown-btn:hover {
  background: #111;
  color: #f5fff5;
}

.tag-dropdown-btn.active {
  background: #111;
  color: #f5fff5;
  border-color: #111;
}

.dropdown-arrow {
  font-size: 0.7em;
  transition: transform 0.2s ease;
}

.tag-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.tag-dropdown-content {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background-color: rgba(30, 30, 30, 0.97);
  border: 1px solid rgba(98, 187, 139, 0.4);
  border-radius: 8px;
  padding: 12px;
  min-width: 200px;
  max-width: 300px;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tag-dropdown.open .tag-dropdown-content {
  display: flex;
}

.tag-filter-btn {
  padding: 4px 12px;
  background-color: transparent;
  border: 1px solid rgba(98, 187, 139, 0.4);
  color: var(--clr-green);
  font-size: 0.75em;
  font-family: var(--font-1);
  border-radius: 20px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag-filter-btn:hover {
  background-color: rgba(98, 187, 139, 0.15);
  border-color: var(--clr-green);
}

.tag-filter-btn.active {
  background-color: var(--clr-green);
  color: var(--clr-black);
  border-color: var(--clr-green);
}

.tag-filter-clear {
  padding: 4px 10px;
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--clr-white);
  font-size: 0.7em;
  font-family: var(--font-1);
  border-radius: 20px;
  opacity: 0.7;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag-filter-clear:hover {
  opacity: 1;
  border-color: var(--clr-white);
}

/* ==========================================================================
   Diary Action Buttons
   ========================================================================== */
.diary-action-buttons {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
}

.diary-action-btn {
  font-family: var(--font-1);
  font-size: 0.85em;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  background: none;
  border: 1px solid #111;
  color: #111;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  text-transform: uppercase;
  flex: 1;
}

.diary-action-btn:hover {
  background: #111;
  color: #f5fff5;
}

.diary-action-btn.active {
  background: #000;
  color: #fff;
  border-color: #000;
}


/* ==========================================================================
   No entries / End marker
   ========================================================================== */
.no-entries {
  text-align: center;
  font-size: 1.2em;
  font-family: var(--font-1);
  color: var(--clr-white);
  opacity: 0.6;
  padding: 60px 20px;
}

.diary-end-marker {
  text-align: center;
  font-size: 0.9em;
  font-family: var(--font-1);
  color: var(--clr-green);
  opacity: 0.5;
  padding: 40px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ==========================================================================
   Albums Grid (grid view)
   ========================================================================== */
.albums-grid-flow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 40px 15px;
  padding-top: 15px;
}

@media (max-width: 689px) {
  .albums-grid-flow {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px 12px !important;
  }

  .albums-grid-flow .album-card {
    padding-top: 22px !important;
    width: auto !important;
    min-width: 0 !important;
  }

  .diary-entries {
    padding: 0 16px;
  }

  .diary-action-buttons {
    flex-wrap: wrap;
  }

  .diary-action-btn {
    flex: 1 1 calc(50% - 3px);
  }

  #calendarToggle {
    flex: 1 1 100%;
  }

  .albums-grid.list-view .album-list-text {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
  }

  .albums-grid.list-view .album-list-text .separator {
    display: none;
  }

  .albums-grid.list-view .album-list-text .album-artist {
    font-size: 0.85em;
    opacity: 0.65;
  }
}

/* Date label above album card */
.albums-grid-flow .album-card {
  padding-top: 28px;
}

.album-card-date {
  position: absolute;
  top: 4px;
  right: 0;
  font-size: 0.85em;
  font-family: var(--font-1);
  color: var(--clr-green);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Albums List (list view)
   ========================================================================== */
.albums-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}

.albums-grid.list-view .album-card {
  display: flex;
  align-items: left;
  background: none;
  padding: 6px;
}

.albums-grid.list-view .album-card:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.albums-grid.list-view .album-cover,
.albums-grid.list-view .album-card img,
.albums-grid.list-view .album-card-date {
  display: none;
}

.albums-grid.list-view .album-list-text {
  font-size: 0.875em;
  font-family: var(--font-1);
  color: var(--clr-white);
  letter-spacing: 0.3px;
}

.albums-grid.list-view .album-list-text .album-title {
  color: black;
}

.albums-grid.list-view .album-list-text .album-artist {
  color: rgba(40, 40, 40, 0.6);
}

.albums-grid.list-view .album-list-text .album-year {
  color: rgba(33, 33, 33, 0.4);
}

.albums-grid.list-view .album-list-text .separator {
  color: rgba(245, 245, 245, 0.3);
  margin: 0 8px;
}

/* List view date grouping */
.list-date-group {
  display: flex;
  gap: 16px;
  margin-bottom: 6px;
}

.list-date-label {
  font-size: 1em;
  font-family: var(--font-1);
  color: var(--clr-green);
  min-width: 55px;
  padding-top: 6px;
  flex-shrink: 0;
}

.list-date-entries {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0 8px;
}

.list-date-entries .album-card {
  padding: 4px 0;
}

@media (max-width: 600px) {
  .albums-grid.list-view .album-list-text {
    font-size: 0.9em;
    line-height: 18px;
  }

  .list-date-group {
    gap: 10px;
  }

  .list-date-label {
    font-size: 0.8em;
    min-width: 40px;
  }

  .list-date-entries {
    padding-left: 10px;
  }
}

/* ==========================================================================
   Album Card Base
   ========================================================================== */
.album-card {
  border-radius: 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
}

.fav-star {
  color: black;
  font-size: 0.75em;
  margin-right: 6px;
  position: relative;
  top: -4px;
  vertical-align: middle;
}

/* ==========================================================================
   Album Cover & Info (grid view)
   ========================================================================== */
.album-cover-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  transition: opacity 0.3s ease;
  overflow: hidden;
  border-radius: 7px;
}

.album-cover-wrapper.faded {
  opacity: 0.3;
}

.album-cover {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-color: rgba(98, 187, 139, 0.1);
}

.album-below-cover {
  margin-top: 6px;
  font-family: var(--font-1);
}

.album-below-cover .album-title {
  font-size: 0.8em;
  color: #111;
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}

.album-title-inner {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

.album-below-cover .album-artist {
  font-size: 0.75em;
  color: rgba(17, 17, 17, 0.6);
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Notes Toggle
   ========================================================================== */
.notes-toggle-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  background-color: rgba(23, 23, 23, 0.8);
  border: 1px solid var(--clr-green);
  border-radius: 4px;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: var(--clr-white);
  padding: 0;
}

.notes-toggle-btn:hover {
  background-color: var(--clr-green);
  color: var(--clr-black);
  transform: scale(1.1);
}

.album-notes-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(23, 23, 23, 0.95);
  border-radius: 8px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  z-index: 15;
  overflow-y: auto;
  cursor: pointer;
  box-sizing: border-box;
}

.album-notes-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.album-notes-text {
  font-size: 0.85em;
  font-style: italic;
  color: var(--clr-white);
  margin: 0;
  line-height: 1.4;
  text-align: center;
  font-family: var(--font-1);
}

/* ==========================================================================
   Album Tags (grid view)
   ========================================================================== */
.album-tags {
  display: none;
}

.album-tag {
  padding: 2px 6px;
  background-color: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(98, 187, 139, 0.5);
  color: var(--clr-green);
  font-size: 0.6em;
  font-family: var(--font-1);
  border-radius: 8px;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   Format Badges
   ========================================================================== */
.album-card > .album-format {
  display: none;
}

.album-format.format-vinyl {
  background-color: rgba(255, 200, 150, 1);
  color: #5c3a1a;
}
.album-format.format-cd {
  background-color: rgba(255, 182, 193, 1);
  color: #5c3a4a;
}
.album-format.format-digital {
  background-color: rgba(173, 216, 230, 1);
  color: #2c4a5c;
}
.album-format.format-cassette {
  background-color: rgba(255, 218, 185, 1);
  color: #5c4a3a;
}
.album-format.format-other {
  background-color: rgba(255, 255, 186, 1);
  color: #5c5c3a;
}

/* ==========================================================================
   Calendar
   ========================================================================== */
.month-calendar {
  position: fixed;
  top: 140px;
  right: 40px;
  width: 210px;
  background-color: #f5fff5;
  border: 1px solid #111;
  border-radius: 0;
  padding: 15px;
  z-index: 200;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s ease;
  font-family: var(--font-1);
}

.month-calendar.hidden {
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
  pointer-events: none;
}

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

.calendar-month-year {
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  padding: 0;
  color: #111;
  font-weight: normal;
  font-family: var(--font-1);
}

.calendar-nav-btn {
  background: none;
  border: 1px solid #111;
  color: #111;
  width: 26px;
  height: 26px;
  border-radius: 0;
  cursor: pointer;
  font-size: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    color 0.15s;
  font-family: var(--font-1);
  padding: 0;
  line-height: 1;
}

.calendar-nav-btn:hover {
  background: #111;
  color: #f5fff5;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.weekday {
  text-align: center;
  font-size: 0.75em;
  color: #111;
  opacity: 0.5;
  font-family: var(--font-1);
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  font-family: var(--font-1);
  border-radius: 0;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  background-color: transparent;
  border: 1px solid transparent;
  color: #111;
}

.calendar-day:hover {
  background: #111;
  color: #f5fff5;
}

.calendar-day.other-month {
  opacity: 0.25;
  cursor: default;
}

.calendar-day.other-month:hover {
  background-color: transparent;
  color: #111;
}

.calendar-day.has-entry {
  background-color: #111;
  border: 1px solid #111;
  color: #f5fff5;
  font-weight: 600;
}

.calendar-day.has-entry:hover {
  background-color: #333;
  color: #f5fff5;
}

.calendar-day.today {
  border: 2px solid var(--clr-yllw);
}

body.dark .month-calendar {
  background: #111;
  border-color: #f5fff5;
  color: #f5fff5;
  box-shadow: 3px 3px 0 rgba(255, 255, 255, 0.08);
}

body.dark .calendar-month-year {
  color: #f5fff5;
}

body.dark .calendar-nav-btn {
  border-color: #f5fff5;
  color: #f5fff5;
}

body.dark .calendar-nav-btn:hover {
  background: #f5fff5;
  color: #111;
}

body.dark .weekday {
  color: #f5fff5;
}

body.dark .calendar-day {
  color: #f5fff5;
}

body.dark .calendar-day:hover {
  background: #f5fff5;
  color: #111;
}

body.dark .calendar-day.other-month:hover {
  background: transparent;
  color: #f5fff5;
}

body.dark .calendar-day.has-entry {
  background-color: #f5fff5;
  border-color: #f5fff5;
  color: #111;
}

body.dark .calendar-day.has-entry:hover {
  background-color: #ccc;
  color: #111;
}

@media (max-width: 689px) {
  .month-calendar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 280px;
    top: 120px;
  }
}

/* ==========================================================================
   Favorite Albums Popup
   ========================================================================== */
.fav-albums-popup {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 55%;
  max-width: 700px;
  max-height: 75vh;
  background-color: #f5fff5;
  border: 1px solid #111;
  border-radius: 0;
  padding: 25px 30px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  font-family: var(--font-1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 10001;
}

.fav-albums-popup.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fav-albums-popup-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.fav-albums-popup-title {
  font-size: 1.1em;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #111;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  font-weight: normal;
  font-family: var(--font-1);
}

.close-popup-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: #111;
  font-size: 1.3em;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  z-index: 10;
  padding: 4px 8px;
}

.close-popup-btn:hover {
  opacity: 1;
}

.fav-albums-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}

.no-fav-albums {
  font-size: 0.9em;
  color: rgba(17, 17, 17, 0.5);
  text-align: center;
  padding: 40px 20px;
  margin: 0;
  font-family: var(--font-1);
}

/* Fav list rows */
.fav-list-group {
  display: flex;
  gap: 16px;
  margin-bottom: 6px;
}

.fav-list-letter {
  font-size: 1.1em;
  font-family: var(--font-1);
  color: #111;
  opacity: 0.4;
  min-width: 28px;
  text-align: right;
  padding-top: 6px;
  flex-shrink: 0;
}

.fav-list-entries {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
  padding-left: 16px;
}

.fav-list-item {
  display: flex;
  align-items: center;
  padding: 5px 0;
  transition: background-color 0.15s ease;
}

.fav-list-item:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.fav-list-text {
  font-size: 1.1em;
  font-family: var(--font-1);
  color: #111;
  letter-spacing: 0.3px;
}

.fav-list-title {
  color: #111;
}
.fav-list-artist {
  color: rgba(17, 17, 17, 0.6);
}
.fav-list-year {
  color: rgba(17, 17, 17, 0.4);
}

.fav-list-separator {
  color: rgba(17, 17, 17, 0.3);
  margin: 0 6px;
}

body.dark .fav-albums-popup {
  background: #111;
  border-color: #f5fff5;
  box-shadow: 3px 3px 0 rgba(255, 255, 255, 0.08);
}

body.dark .fav-albums-popup-title {
  color: #f5fff5;
  border-bottom-color: rgba(245, 245, 245, 0.15);
}

body.dark .close-popup-btn {
  color: #f5fff5;
}

body.dark .no-fav-albums {
  color: rgba(245, 245, 245, 0.5);
}

body.dark .fav-list-letter {
  color: #f5fff5;
}

body.dark .fav-list-entries {
  border-left-color: rgba(245, 245, 245, 0.15);
}

body.dark .fav-list-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

body.dark .fav-list-text {
  color: #f5fff5;
}

body.dark .fav-list-title {
  color: #f5fff5;
}

body.dark .fav-list-artist {
  color: rgba(245, 245, 245, 0.6);
}

body.dark .fav-list-year {
  color: rgba(245, 245, 245, 0.4);
}

body.dark .fav-list-separator {
  color: rgba(245, 245, 245, 0.3);
}

@media (max-width: 768px) {
  .fav-albums-popup {
    width: 100%;
    left: 0;
    transform: none;
    top: 80px;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .fav-list-group {
    gap: 10px;
  }
  .fav-list-letter {
    font-size: 0.9em;
    min-width: 20px;
  }
  .fav-list-entries {
    padding-left: 10px;
  }
  .fav-list-text {
    font-size: 0.95em;
  }
  .fav-list-separator {
    margin: 0 4px;
  }
}

/* ==========================================================================
   Light / Dark mode text overrides
   ========================================================================== */

/* Light mode: page header and desc inherit dark body color by default — force white */
.right-side-section .page-header,
.right-side-section .page-desc {
  color: black;
}

/* Dark mode: flip main content text to black (excludes popups/overlays with dark backgrounds) */
body.dark .right-side-section .page-header,
body.dark .right-side-section .page-desc,
body.dark .no-entries,
body.dark .albums-grid.list-view .album-list-text,
body.dark .albums-grid.list-view .album-list-text .album-title {
  color: white;
}

body.dark .album-below-cover .album-title {
  color: var(--clr-white);
}

body.dark .album-below-cover .album-artist {
  color: rgba(245, 245, 245, 0.6);
}

body.dark .format-filter-btn,
body.dark .tag-dropdown-btn,
body.dark .diary-action-btn {
  border-color: #f5fff5;
  color: #f5fff5;
}

body.dark .format-filter-btn:hover,
body.dark .format-filter-btn.active,
body.dark .tag-dropdown-btn:hover,
body.dark .tag-dropdown-btn.active,
body.dark .diary-action-btn:hover,
body.dark .diary-action-btn.active {
  background: #f5fff5;
  color: #111;
  border-color: #f5fff5;
}

body.dark .tag-filter-clear {
  color: white;
}

body.dark .fav-star {
  color: white;
}

body.dark .list-date-entries {
  border-left-color: rgba(255, 255, 255, 0.15);
}

body.dark .albums-grid.list-view .album-list-text .album-artist {
  color: rgba(255, 255, 255, 0.6);
}

body.dark .albums-grid.list-view .album-list-text .album-year {
  color: rgba(255, 255, 255, 0.4);
}

body.dark .albums-grid.list-view .album-list-text .separator {
  color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Popup Backdrop
   ========================================================================== */
.popup-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
}

.popup-backdrop.hidden {
  display: none;
}
