body {
    background-color: #1e1e1e;
    color: white;
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
}

.top-bar {
    top: 0;
    z-index: 1000;
    position: sticky;
    padding: 1rem 0;
    background: rgba(30, 30, 30, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin: -20px -20px 0;
    padding-left: 20px;
    padding-right: 20px;
}

.search-bar {
    z-index: 1050;
    background: transparent;
    padding-bottom: 0.25rem;
}

.control-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.badge .btn-close {
    float: none;
    font-size: 0.6rem;
    line-height: 1;
  }

/* ---------- Kit "moderno" condiviso (introdotto con /manga, riusato ovunque) ---------- */

/* Bootstrap eredita il colore testo scuro di default (pensato per sfondi chiari):
   su questo sfondo scuro serve forzarlo, altrimenti label/testo di aiuto sono
   praticamente invisibili. */
.form-check-label {
    color: #e8e8e8;
}

.form-text {
    color: #9a9a9a;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.pill-btn:hover {
    transform: translateY(-1px);
    color: #fff;
}

.pill-btn-accent {
    background: linear-gradient(135deg, #ffcf5c 0%, #d4980f 100%);
    color: #2b1c00;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(212, 152, 15, 0.35);
}

.pill-btn-accent:hover {
    box-shadow: 0 4px 16px rgba(212, 152, 15, 0.5);
    color: #2b1c00;
}

.pill-btn-warning {
    background: linear-gradient(135deg, #ffb35c 0%, #d4720f 100%);
    color: #2b1400;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(212, 114, 15, 0.35);
}

.pill-btn-warning:hover {
    box-shadow: 0 4px 16px rgba(212, 114, 15, 0.5);
    color: #2b1400;
}

.pill-btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.pill-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.16);
}

.pill-btn-xs {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

/* Toggle di filtro (btn-check + label): stesso family visivo dei pill-btn, ma
   distinguibile allo stato attivo (checked) grazie a btn-outline-* di Bootstrap. */
.pill-toggle {
    border-radius: 999px !important;
}

/* Card con angoli arrotondati + sollevamento/ombra all'hover — usata sia dalle
   card manga (serie/volume) sia dalle card item. */
.modern-card {
    cursor: pointer;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #262626;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 207, 92, 0.35);
}

@keyframes manga-spin {
    to { transform: rotate(360deg); }
}

.cover-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.cover-loading-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #ffd868;
    border-radius: 50%;
    animation: manga-spin 0.7s linear infinite;
}

.cover-loading-inline {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #ffd868;
    border-radius: 50%;
    animation: manga-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 5px;
}

/* Sfondo scuro per i menu a tendina Bootstrap (chiaro di default). */
.modern-dropdown {
    background-color: #2b2b2b;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.modern-dropdown .dropdown-item {
    color: #e8e8e8;
}

.modern-dropdown .dropdown-item:hover,
.modern-dropdown .dropdown-item:focus {
    background-color: #444;
    color: #fff;
}

.modern-dropdown .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.12);
}

.modern-dropdown .dropdown-header {
    color: #9a9a9a;
}

/* .form-check di Bootstrap posiziona la checkbox con un margine negativo pensato
   per il suo layout a blocco (padding-left sul contenitore che le fa da spazio):
   dentro un flex container quel trucco spinge la checkbox fuori dai bordi. Si
   azzera margine/float e si usa gap per la spaziatura, più robusto. */
.modern-dropdown .dropdown-item-check {
    padding: 0.35rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modern-dropdown .dropdown-item-check .form-check-input {
    float: none;
    margin-left: 0;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    align-items: start;
}

.card-container {
    position: relative;
}

.draft-tag {
    position: absolute;
    background: rgba(0, 0, 0, 0.82);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    top: 8px;
    left: 8px;
    z-index: 2;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-tag {
    position: absolute;
    background: rgba(0, 0, 0, 0.82);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.status-tag-wish {
    background-color: #0d6efd88;
}
.status-tag-ordered {
    background-color: #ffc10788;
}
.status-tag-owned {
    background-color: #19875488;
}

/* Riquadro immagine dentro a .card-container/.modern-card: quest'ultima fornisce già
   bordo/angoli arrotondati/hover, qui restano solo sfondo interno e centratura —
   niente object-fit/aspect-ratio fissi, le foto degli item hanno proporzioni
   variabili (a differenza delle copertine libro dei manga) e non vanno ritagliate. */
.card {
    background-color: #2b2b2b;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

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

.modal-content{
    background-color: #555;
}

/* Il modal item può restare aperto sopra a quello del calendario (vedi
   [data-open-item] in home.js): Bootstrap non impila automaticamente lo
   z-index di modal multipli, quindi lo forziamo qui perché l'item resti
   sempre sopra invece di finire dietro solo perché dichiarato prima nell'HTML. */
#staticBackdrop {
    z-index: 1075;
}

.modal-backdrop:nth-of-type(2) {
    z-index: 1065;
}

.itemCard{
    cursor: pointer;
}

.form-label{
    color: white;
}

#statusHistory {
    color: #ccc;
}

#btnToggleDebugInfo {
    color: white;
}

.debug-info {
    background-color: #1e1e1e;
    color: #9cdcfe;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #555;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.debug-info-line {
    word-break: break-all;
    margin-bottom: 2px;
}

.debug-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.debug-date-row label {
    min-width: 90px;
    color: #9cdcfe;
}

.debug-date-row input[type="date"] {
    max-width: 160px;
    background-color: #2b2b2b;
    color: white;
    border-color: #555;
}

#searchBox {
    background-color: #333;
    color: white;
    border-color: #555;
}

#searchSuggestions {
    max-height: 300px;
    overflow-y: auto;
    background-color: #2b2b2b;
    border-radius: 6px;
}

#searchSuggestions .list-group-item {
    display: block;              /* lista verticale */
    width: 100%;                 /* stessa larghezza input */
    padding: 6px 10px;           /* compatto */
    font-size: 1.2rem;
    line-height: 1.2;
    background-color: #2b2b2b;
    color: white;
    border: none;                /* via bordi bootstrap */
    border-bottom: 1px solid #444;
}

#searchSuggestions .list-group-item:last-child {
    border-bottom: none;
}

#searchSuggestions .list-group-item:hover {
    background-color: #444;
}

.markdown-preview {
    min-height: 120px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    background-color: white;
    border: 1px solid #555;
    border-radius: 6px;
    color: #212529;
}

.markdown-preview a {
    color: #0d6efd;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 10px 10px;
}

.item-tag {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    cursor: pointer;
}

.item-tag:hover {
    background: rgba(255, 255, 255, 0.25);
}

.item-tag-icon {
    font-size: 10px;
}

.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 320px;
    max-width: 85vw;
    background-color: #2b2b2b;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.side-nav.open {
    transform: translateX(0);
}

.side-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #444;
    color: white;
    font-weight: bold;
}

.side-nav-body {
    overflow-y: auto;
    flex: 1;
}

.side-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1999;
}

.side-nav-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.tag-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 6px 18px 6px 10px;
    background-color: #2b2b2b;
    color: white;
    font-size: 1rem;
    border: none;
    border-bottom: 1px solid #444;
    border-radius: 0;
    cursor: pointer;
}

.tag-menu-item:last-child {
    border-bottom: none;
}

.tag-menu-item:hover {
    background-color: #444;
}

.tag-menu-counts {
    display: flex;
    gap: 8px;
    font-size: 0.85em;
    font-variant-numeric: tabular-nums;
}

.tag-count-wished,
.tag-count-shipped,
.tag-count-owned {
    display: inline-block;
    min-width: 24px;
    text-align: center;
}

.tag-count-wished {
    color: #0d6efd;
}

.tag-count-shipped {
    color: #ffc107;
}

.tag-count-owned {
    color: #198754;
}

.tag-artist {
    background-color: #8e44ad !important;
}

.tag-size {
    background-color: #d35400 !important;
}

.tag-type {
    background-color: #16a085 !important;
}

.tag-tbe {
    background-color: #dc3545 !important;
}

.tag-attach {
    background-color: #34495e !important;
}

.attachment-thumb {
    position: relative;
    width: 110px;
    height: 110px;
}

.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #555;
    cursor: pointer;
}

.attachment-thumb .remove-attachment {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background-color: #333;
    border-radius: 50%;
    padding: 0;
    opacity: 1;
}

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay.show {
    display: flex;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
}

/* Nella lista dei tag più usati: colora il testo invece dello sfondo */
.tag-menu-item.tag-artist,
.tag-menu-item.tag-size,
.tag-menu-item.tag-type,
.tag-menu-item.tag-tbe {
    background-color: transparent !important;
}

.tag-menu-item.tag-artist { color: #c58aff !important; }
.tag-menu-item.tag-size { color: #ffa15c !important; }
.tag-menu-item.tag-type { color: #4fd1c5 !important; }
.tag-menu-item.tag-tbe { color: #ff6b6b !important; }

.tag-menu-item.tag-artist:hover,
.tag-menu-item.tag-size:hover,
.tag-menu-item.tag-type:hover,
.tag-menu-item.tag-tbe:hover {
    background-color: #444 !important;
}

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

.calendar-cell {
    min-height: 90px;
    background-color: #2b2b2b;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px;
}

.calendar-cell.other-month {
    opacity: 0.4;
}

.calendar-cell.today {
    border-color: #0d6efd;
    border-width: 2px;
}

.calendar-day-num {
    font-size: 0.8rem;
    color: #ccc;
    margin-bottom: 4px;
}

.calendar-cell-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.calendar-cell-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #555;
    cursor: pointer;
}

.calendar-cell-more {
    font-size: 0.7rem;
    color: #ccc;
    align-self: center;
}

.release-list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-bottom: 1px solid #444;
    cursor: pointer;
}

.release-list-row:hover {
    background-color: #444;
}

.release-list-row.past {
    opacity: 0.5;
}

.release-list-row .calendar-cell-thumb {
    width: 40px;
    height: 40px;
    cursor: default;
}

.release-list-title {
    color: white;
}

.release-list-date {
    color: #ccc;
    font-size: 0.875em;
}

.release-list-empty {
    color: #ccc;
}

@media (max-width: 576px) {
    .calendar-cell {
        min-height: 56px;
        padding: 2px;
    }

    .calendar-day-num {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }

    .calendar-cell-thumbs {
        gap: 1px;
    }

    .calendar-cell-thumb {
        width: 16px;
        height: 16px;
        border-radius: 2px;
    }

    .calendar-cell-more {
        font-size: 0.6rem;
    }

    .calendar-grid {
        gap: 2px;
    }

    .release-list-row .calendar-cell-thumb {
        width: 32px;
        height: 32px;
    }
}
