@import url('tokens.css');

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family: var(--font-main);
  background:var(--bg);
  color:var(--text);
}

/* Header */
header{
  padding:22px 14px;
  text-align:center;
  border-bottom:1px solid var(--border);
  background:linear-gradient(#fff, #fbfbfb);
}

header h1{
  margin:0;
  font-size:1.8rem;
  font-weight:700;
  letter-spacing:.04em;
}

header p{
  margin:.35rem 0 0;
  color:var(--muted);
  font-size:.95rem;
}

table {
  border:1px solid var(--border);
  background:var(--card);
  border-radius:12px;
  border-spacing:1px;
}

table th, table td {
  border:1px solid white;
}

table tbody tr:nth-child(even) {
  background: #e6e6e6;
}

table tbody tr:nth-child(odd) {
  background: #ccc;
}

/* Main */
main{
  max-width:99%;
  margin:0 auto;
  padding:18px 14px 40px;
}

/* Grid */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:14px;
}

/* Card */
.card{
  display:flex;
  flex-direction:column;
  gap:8px;
  border:1px solid var(--border);
  background:var(--card);
  border-radius:12px;
  padding:14px 14px 12px;
  text-decoration:none;
  color:inherit;
  transition:transform .15s ease, box-shadow .15s ease;
}

.card:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow);
}

.card-image{
  aspect-ratio:1 / 1;
  margin:-2px -2px 2px;
  border-radius:8px;
  overflow:hidden;
  background:#000;
}

.card-image img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}

.artist{
  font-size:.88rem;
  font-weight:700;
  color:var(--muted);
}

.title{
  font-size:1.02rem;
  font-weight:600;
  line-height:1.25;
}

.meta{
  font-size:.78rem;
  color:var(--muted);
  line-height:1.25;
}

.meta-line{
  font-size:0.78rem;
  color:var(--muted);
  line-height:1.3;
}

.price{
  margin-top:auto;
  font-weight:700;
  letter-spacing:.02em;
  padding-top:8px;
}

/* Badge */
.badge{
  display:inline-block;
  font-size:.72rem;
  padding:3px 8px;
  border:1px solid var(--border);
  border-radius:999px;
  color:var(--muted);
  background:#fcfcfc;
}

/* Footer */
.footer{
  text-align:center;
  padding:18px 14px;
  border-top:1px solid var(--border);
  color:var(--muted);
  font-size:.8rem;
}

/* Responsive */
@media (max-width:480px){
  header h1{
    font-size:1.55rem;
  }
}

/* Top bar */
.top-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin:10px 2px 18px;
}

/* View switch */
.view-switch,
.view-btn {
  pointer-events: auto;
  touch-action: manipulation;
}

.view-switch{
  display:flex;
  gap:6px;
}

.view-btn{
  display:flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--border);
  background:#fff;
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  font-size:.75rem;
  color:var(--muted);
}

.view-btn img{
  width:16px;
  height:16px;
}

.view-btn.active{
  color:var(--text);
  border-color:#abe6f5;
  background:#abe6f5;
}

.view-btn.active img{
  filter:brightness(0.9);
}

.view-btn .label{
  display:none;
}

@media (min-width:768px){
  .view-btn .label{
    display:inline;
  }
}

/* Views */
.view{
  display:none !important;
}

.view.active{
  display:block !important;
}

/* List table */
.list-table{
  border-collapse:collapse;
  font-size:.8rem;
}

.list-table th,
.list-table td{
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}

/*.list-table td {
  white-space: pre-line;
}*/

.list-table th{
  text-align:left;
  font-weight:600;
  white-space:nowrap;
  background: var(--tableheader);
  color: #fff;
}

.list-table .main-cell a{
  color:inherit;
  text-decoration:none;
  font-weight:500;
}

.list-table .main-cell a:hover{
  text-decoration:underline;
}

.sortable{
  cursor:pointer;
  position:relative;
}

/* El pseudo-elemento existe solo cuando hay orden activo */
.sortable.asc::after,
.sortable.desc::after{
  content:'';
  position:absolute;
  top:58%;
  width:20px;
  height:20px;
  transform:translateY(-50%);
  background-size:20px 20px;
  background-repeat:no-repeat;
  opacity:.8;
}

/* Solo cuando hay icono se reserva espacio */
.sortable.asc,
.sortable.desc{
  padding-right:16px;
}

.sortable.asc::after{
  background-image:url('../img/icons/asc-white.svg');
}

.sortable.desc::after{
  background-image:url('../img/icons/desc-white.svg');
}

.table-wrap{
  position:relative;
}

.table-scroll{
  overflow-x:auto;
}

.list-table thead th{
  position:sticky;
  top:0;
  z-index:20;
  background:var(--tableheader);
  color:#fff;
}

.catalog-pagination{
  display: block;
  width: 100%;
  margin: 24px 0;
}

.pagination{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
}

.pagination a{
  text-decoration: none;
  color: #2a5bd7;
}

.pagination a:hover{
  text-decoration: underline;
}

.page-info{
  color: var(--muted);
}

/* Top bar left group */
.top-left{
  display:flex;
  align-items:center;
  gap:10px;
}

/* Thumbnail sorting */
.thumbnail-sort{
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:0 4px;
  margin:0 0 14px;
  padding:0 6px;
  font-size:.82rem;
  line-height:1.45;
}

.thumbnail-sort-label{
  margin-right:2px;
  font-weight:700;
  color:var(--text);
}

.thumbnail-sort-link{
  color:#2d4b5f;
  text-decoration:underline;
  font-weight:400;
}

.thumbnail-sort-link:not(:last-child)::after{
  content:'|';
  display:inline-block;
  margin-left:4px;
  color:var(--text);
  font-weight:400;
  text-decoration:none;
}

.thumbnail-sort-link.active{
  color:var(--text);
  font-weight:700;
}

@media (max-width:767px){
  .thumbnail-sort{
    margin:0 0 10px;
    padding:0;
    font-size:.78rem;
    line-height:1.35;
  }
}

/* Filter button */
.filter-btn{
  display:flex;
  align-items:center;
  gap:6px;
}

/* Estado activo */
.filter-btn.active{
  color:var(--text);
  border-color:#abe6f5;
  background:#abe6f5;
}

.filter-btn.active img{
  filter:brightness(0.95);
}

/* =========================
   FILTER MODAL
========================= */

.filter-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;            /* oculto por defecto */
}

.filter-modal.open{
  display: block;           /* visible cuando abre */
}

.filter-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.filter-panel{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 24px));
  max-height: min(80vh, 720px);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
}

.filter-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.filter-header h2{
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.filter-close{
  border: 0;
  background: transparent;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
}

.filter-close img{
  width: 18px;
  height: 18px;
  display: block;
}

.filter-body{
  padding: 14px 16px;
  overflow: auto;
}

.filter-group{
  margin-bottom: 14px;
}

.filter-group h3{
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 700;
  opacity: .85;
}

.filter-options{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-options .placeholder{
  opacity: .65;
  font-size: 13px;
}

.filter-price{
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-price input{
  width: 120px;
  max-width: 40vw;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.15);
  font: inherit;
  outline: none;
}

.filter-price input:focus{
  border-color: rgba(0,0,0,.35);
}

.price-sep{
  opacity: .6;
}

.filter-footer{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.02);
}

.filter-footer button{
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
}

.filter-clear{
  background: rgba(0,0,0,.08);
}

.filter-apply{
  background: #abe6f5; /* tu color de activo */
}

/* Mobile: que sea tipo "bottom sheet" */
@media (max-width: 767px){
  .filter-panel{
    left: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100vw;
    max-height: 85vh;
    border-radius: 18px 18px 0 0;
  }
}

/* Filter option pills */
.filter-option{
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.2);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.filter-option:hover{
  background: rgba(0,0,0,.05);
}

.filter-option.active{
  background: #abe6f5;
  border-color: #abe6f5;
  color: #000;
}

.search-bar {
  padding: 10px 0;
}

.search-bar form {
  display: flex;
  gap: 8px;
}

.search-bar input[type="search"] {
  flex: 1;
  padding: 8px 10px;
  font-size: 14px;
}

.search-bar button {
  padding: 8px 14px;
  cursor: pointer;
}

.card{
  position: relative;
}

.new-badge{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  height: auto;
  z-index: 3;
  pointer-events: none;
}

.new-badge-inline{
  display: inline-block;
  width: 38px;
  height: auto;
  vertical-align: middle;
  position: relative;
  left: -10px;
  top: 2px;
}

.list-table .main-cell a.item-is-new{
  color: indianred;
  font-weight: 700;
}

.filter-checkbox-row{
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-checkbox-row input[type="checkbox"]{
  width: auto;
  margin: 0;
  transform: scale(1.1);
}

/* =========================
   ITEM DETAIL
========================= */

.item-main{
  max-width:980px;
  padding-top:24px;
}

.item-back{
  display:inline-flex;
  align-items:center;
  gap:7px;
  margin:0 0 16px;
  padding:7px 12px;
  border:1px solid var(--border);
  border-radius:999px;
  background:#fff;
  color:var(--text);
  font-size:.84rem;
  font-weight:600;
  text-decoration:none;
  box-shadow:0 1px 3px rgba(0,0,0,.04);
}

.item-back img{
  width:16px;
  height:16px;
  display:block;
}

.item-back:hover{
  color:var(--text);
  border-color:var(--accent);
  background:#f8fdff;
}

.item-detail{
  display:grid;
  grid-template-columns:1fr;
  gap:22px;
  align-items:start;
}

.item-detail-with-images{
  grid-template-columns:minmax(280px, 380px) minmax(0, 1fr);
}

.item-media,
.item-info,
.item-not-found{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:var(--shadow);
}

.item-media{
  padding:12px;
}

.item-main-image{
  display:block;
  width:100%;
  aspect-ratio:1 / 1;
  padding:0;
  border:0;
  border-radius:8px;
  overflow:hidden;
  background:#000;
  cursor:zoom-in;
}

.item-main-image img{
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}

.item-main-image-static{
  cursor:default;
}

.item-image-note{
  margin:10px 2px 0;
  color:var(--muted);
  font-size:.76rem;
  line-height:1.35;
  text-align:center;
}

.item-info{
  padding:22px;
}

.item-format{
  margin-bottom:10px;
  color:var(--muted);
  font-size:.86rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.item-info h1{
  margin:0;
  font-size:2rem;
  line-height:1.08;
  font-weight:700;
  letter-spacing:0;
}

.item-info h2{
  margin:8px 0;
  color:var(--muted);
  font-size:1.2rem;
  line-height:1.2;
  font-weight:500;
  letter-spacing:0;
}

.item-format-extended{
  margin-top:0;
}

.item-field,
.item-notes{
  margin-top:16px;
}

.item-field span,
.item-notes span{
  display:block;
  margin-bottom:4px;
  color:var(--muted);
  font-size:.78rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.item-field p,
.item-notes p{
  margin:0;
  font-size:.98rem;
  line-height:1.45;
}

.item-origin-year,
.item-conditions{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}

.item-price{
  margin-top:24px;
  font-size:1.35rem;
  font-weight:700;
  letter-spacing:.02em;
}

.item-notes{
  padding-top:18px;
  border-top:1px solid var(--border);
}

.item-not-found{
  padding:26px;
  text-align:center;
}

.item-not-found h1{
  margin:0 0 8px;
  font-size:1.45rem;
}

.item-not-found p{
  margin:0;
  color:var(--muted);
}

.item-gallery-modal{
  position:fixed;
  inset:0;
  z-index:12000;
  display:none;
  background:rgba(0,0,0,.9);
}

.item-gallery-modal.open{
  display:block;
}

.item-gallery-backdrop{
  position:absolute;
  inset:0;
}

.item-gallery-shell{
  position:relative;
  z-index:2;
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:64px 76px 112px;
}

.item-gallery-title{
  position:absolute;
  top:18px;
  left:56px;
  right:56px;
  color:#fff;
  font-size:1rem;
  font-weight:700;
  line-height:1.3;
  text-align:center;
}

.item-gallery-close{
  position:absolute;
  top:14px;
  right:14px;
  z-index:4;
  width:40px;
  height:40px;
  border:0;
  border-radius:50%;
  background:rgba(255,255,255,.92);
  color:#000;
  font-size:20px;
  font-weight:700;
  cursor:pointer;
}

.item-gallery-shell > img{
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  user-select:none;
  touch-action:pan-y;
}

.item-gallery-nav{
  position:absolute;
  top:50%;
  z-index:3;
  transform:translateY(-50%);
  width:46px;
  height:58px;
  border:0;
  border-radius:10px;
  background:rgba(255,255,255,.82);
  color:#000;
  font-size:42px;
  line-height:1;
  cursor:pointer;
}

.item-gallery-prev{
  left:14px;
}

.item-gallery-next{
  right:14px;
}

.item-gallery-thumbs{
  position:absolute;
  left:16px;
  right:16px;
  bottom:18px;
  display:flex;
  justify-content:center;
  gap:8px;
  overflow-x:auto;
  padding:4px 0;
}

.item-gallery-thumb{
  flex:0 0 auto;
  width:58px;
  height:58px;
  padding:0;
  border:2px solid transparent;
  border-radius:8px;
  overflow:hidden;
  background:#000;
  cursor:pointer;
  opacity:.72;
}

.item-gallery-thumb.active{
  border-color:var(--accent);
  opacity:1;
}

.item-gallery-thumb img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}

@media (max-width: 767px){
  .item-main{
    padding-top:18px;
  }

  .item-detail-with-images{
    grid-template-columns:1fr;
  }

  .item-info{
    padding:18px;
  }

  .item-info h1{
    font-size:1.7rem;
  }

  .item-info h2{
    font-size:1.08rem;
  }

  .item-origin-year,
  .item-conditions{
    grid-template-columns:1fr;
    gap:0;
  }

  .item-gallery-shell{
    padding:58px 14px 104px;
  }

  .item-gallery-title{
    left:52px;
    right:52px;
    font-size:.92rem;
  }

  .item-gallery-nav{
    display:none;
  }

  .item-gallery-thumb{
    width:52px;
    height:52px;
  }
}

/* =========================
   NUEVOS INGRESOS
========================= */

.new-arrivals-main{
  max-width:99%;
}

.new-arrivals-table-wrap{
  width:100%;
  overflow:visible;
}

.new-arrivals-table{
  width:100%;
  min-width:1320px;
  border-collapse:separate;
  border-spacing:0;
  border:1px solid #fff;
  border-radius:0;
  background:#fff;
  color:#000;
  font-size:11px;
  line-height:1.25;
}

.new-arrivals-table th,
.new-arrivals-table td{
  border:1px solid #fff;
  padding:5px 7px;
  vertical-align:top;
}

.new-arrivals-table thead{
  position:sticky;
  top:0;
  z-index:20;
}

.new-arrivals-table thead th{
  position:sticky;
  top:0;
  z-index:20;
  background:#111;
  color:#fff;
  text-align:left;
  font-weight:700;
  white-space:nowrap;
  box-shadow:0 2px 0 rgba(0,0,0,.35);
}

.new-arrivals-table thead th:nth-child(1){
  min-width:420px;
}

.new-arrivals-table thead th:nth-child(2){
  min-width:92px;
}

.new-arrivals-table thead th:nth-child(3){
  min-width:118px;
}

.new-arrivals-table thead th:nth-child(4){
  min-width:58px;
}

.new-arrivals-table thead th:nth-child(5),
.new-arrivals-table thead th:nth-child(6){
  min-width:128px;
}

.new-arrivals-table thead th:nth-child(7){
  min-width:155px;
}

.new-arrivals-table thead th:nth-child(8){
  min-width:300px;
}

.new-arrivals-table thead th:nth-child(9){
  min-width:70px;
  text-align:right;
}

.new-arrivals-table tbody tr:nth-child(even),
.new-arrivals-table tbody tr:nth-child(odd){
  background:transparent;
}

.new-arrivals-group-heading th{
  padding:7px 10px;
  text-align:center;
  color:#fff;
  font-size:12px;
  line-height:1.2;
  font-weight:700;
}

.new-arrivals-row td{
  background:var(--new-arrivals-row-bg);
}

.new-arrivals-title-cell a{
  color:#000;
  font-weight:600;
  text-decoration:none;
}

.new-arrivals-title-cell a:hover{
  text-decoration:underline;
}

.new-arrivals-notes{
  white-space:normal;
}

.new-arrivals-price{
  text-align:right;
  white-space:nowrap;
  font-weight:700;
}

.new-arrivals-group-vinilo{
  --new-arrivals-heading-bg:#274e13;
  --new-arrivals-row-bg:#d1eb60;
}

.new-arrivals-group-cassette{
  --new-arrivals-heading-bg:#073763;
  --new-arrivals-row-bg:#c9daf8;
}

.new-arrivals-group-cd-sacd{
  --new-arrivals-heading-bg:#0c343d;
  --new-arrivals-row-bg:#d9ead3;
}

.new-arrivals-group-blu-ray-dvd{
  --new-arrivals-heading-bg:#ff00ff;
  --new-arrivals-row-bg:#d9d2e9;
}

.new-arrivals-group-otros{
  --new-arrivals-heading-bg:#741b47;
  --new-arrivals-row-bg:#c882a4;
}

.new-arrivals-group-heading.new-arrivals-group-vinilo th,
.new-arrivals-group-heading.new-arrivals-group-cassette th,
.new-arrivals-group-heading.new-arrivals-group-cd-sacd th,
.new-arrivals-group-heading.new-arrivals-group-otros th{
  background:var(--new-arrivals-heading-bg);
  color:#fff;
}

.new-arrivals-group-heading.new-arrivals-group-blu-ray-dvd th{
  background:var(--new-arrivals-heading-bg);
  color:#000;
}

@media (max-width:767px){
  .new-arrivals-main{
    padding-top:18px;
  }

  .new-arrivals-table{
    font-size:10.5px;
  }
}
