/* =========================================================
   display.css — unified styles for item display page
   ========================================================= */

/* =========================================================
   BREADCRUMBS
   ========================================================= */

nav.breadcrumbs {
    margin: 15px 0;
    font-family: "PT Sans", Helvetica Neue, Arial, sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    color: #a3a3a3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

nav.breadcrumbs a,
nav.breadcrumbs span {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: inherit;
    color: inherit;
    text-transform: inherit;
}

nav.breadcrumbs a:hover { text-decoration: underline; color: #000; }

nav.breadcrumbs .crumb-sep {
    position: relative;
    width: 14px;
    height: 10px;
    margin: 0 8px;
    flex-shrink: 0;
}

nav.breadcrumbs .crumb-sep::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 9px;
    height: 2px;
    background-color: #b5b5b5;
    transform: translateY(-50%);
}

nav.breadcrumbs .crumb-sep::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 9px;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid #b5b5b5;
    transform: translateY(-50%);
}

/* =========================================================
   LAYOUT
   ========================================================= */

.catalog-columns { display: flex; align-items: flex-start; gap: 30px; }
.catalog-main { flex: 1 1 auto; min-width: 0; }

/* =========================================================
   ACTION BAR (logged-in only)
   ========================================================= */

.display-action-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    width: 100%;
}

.display-action-buttons {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.display-action-buttons button {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #888;
    white-space: nowrap;
    flex: 0 0 auto !important;
    width: auto !important;
}

.display-action-buttons .active-coll { background: #e8f5e9 !important; color: #2e7d32 !important; border: none !important; }
.display-action-buttons .active-wish { background: #d1ecf1 !important; color: #0c5460 !important; border: none !important; }
.display-action-buttons .active-swap { background: #fef5e7 !important; color: #e67e22 !important; border: none !important; }
.display-action-buttons .active-fav  { background: #fff0f5 !important; color: #e91e63 !important; border: none !important; }

.display-collection-strip {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    color: #888;
    flex: 1;
    justify-content: center;
    align-items: flex-end;
}

.display-collection-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: flex-end;
}

.display-collection-strip span { display: flex; gap: 4px; align-items: center; }
.display-collection-strip span strong { font-weight: bold; color: #444; font-size: 11px; }

.collection-meta { font-size: 12px; color: #888; margin-top: 4px; }
.collection-meta strong { color: #444; }

/* =========================================================
   PRODUCT DISPLAY LAYOUT
   ========================================================= */

.product-display {
    display: flex;
    align-items: flex-start;
    gap: 60px;
    margin-top: 30px;
}

.thumbs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90px;
    flex-shrink: 0;
}

.thumbs img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border: 1px solid #ddd;
    cursor: pointer;
}

.thumbs img.active { border-color: #000; }
.thumbs.thumbs-empty { visibility: hidden; }

.main-image {
    flex: 0 0 420px;
    display: flex;
    justify-content: center;
}

.main-image img {
    max-width: 500px;
    max-height: 500px;
    object-fit: contain;
}

/* Main image opens the overlay — only when there are real images to show */
.product-display[data-has-images="1"] .main-image img {
    cursor: pointer;
}

.main-image img[src$="/media/no_image.png"] {
    transform: translate(-50px, 130px);
    opacity: 0.85;
}

/* =========================================================
   ATTRIBUTES
   ========================================================= */

.attributes {
    flex: 1;
    font-family: "PT Sans", Arial, sans-serif;
    padding-left: 10px;
    margin-top: -12px;
}

.attributes h1.item-title {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 18px;
}

.attributes table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 2;
}

.attributes th {
    text-align: left;
    width: 28%;
    font-weight: normal;
    color: #777;
    font-size: 13px;
    padding: 6px 12px 6px 0;
    vertical-align: top;
    white-space: nowrap;
}

.attributes td {
    font-size: 13px;
    color: #444;
    padding: 6px 0;
    vertical-align: top;
}

.attributes td:empty::after { content: '\00a0'; }

.attributes-bottom {
    margin-top: 30px;
}

.attributes-bottom table {
    max-width: 900px;
    font-size: 13px;
    line-height: 2;
    margin-left: 10px;
    border-collapse: collapse;
    width: 100%;
}

.attributes-bottom th {
    font-size: 13px;
    font-weight: normal;
    color: #777;
    padding-right: 12px;
    vertical-align: top;
    width: 18%;
    white-space: nowrap;
    padding: 6px 12px 6px 0;
}

.attributes-bottom td {
    font-size: 13px;
    color: #444;
    padding-bottom: 6px;
    vertical-align: top;
}

.comments-cell { padding-top: 6px; }
.comments-content { display: block; }
.comments-content h3 { font-size: 13px; font-weight: 600; margin: 0; line-height: 1.4; }
.comments-content p { margin: 6px 0 12px 0; line-height: 1.6; }
.comments-row th, .comments-row td { vertical-align: top; padding-top: 0; }
.comments-row th { padding-top: 2px; }

/* =========================================================
   OVERLAY
   ========================================================= */

.overlay {
    position: fixed;
    inset: 0;
    background: #fff;
    display: none;
    z-index: 9999;
    overflow: auto;
}

.overlay .close { position: absolute; top: 20px; right: 30px; font-size: 30px; cursor: pointer; }

.overlay .nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    cursor: pointer;
    user-select: none;
}

.overlay .prev { left: 30px; }
.overlay .next { right: 30px; }

.overlay-center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-top: 60px;
    padding-bottom: 120px;
    box-sizing: border-box;
}

.overlay-center img#overlayImage {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
}

.overlay-thumbs {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    align-items: center;
    padding: 4px 0;
}

.overlay-thumbs img {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    object-fit: contain;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.2s, border-color 0.2s;
}

.overlay-thumbs img:hover { opacity: 1; }
.overlay-thumbs img.active { border-color: #000; opacity: 1; }

/* =========================================================
   COLLECTION MODAL
   ========================================================= */

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

.modal-content {
    background: #fff;
    padding: 25px 35px;
    width: 420px;
    max-width: 95%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    font-family: "PT Sans", Helvetica Neue, Arial, sans-serif;
    border-top: none !important;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    color: #000;
}

.close-x { position: absolute; top: 24px; right: 12px; color: #777; font-size: 24px; cursor: pointer !important; }
.close-x:hover { color: #000; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.field { margin-bottom: 12px; }

.field label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #777 !important;
    margin-bottom: 4px;
    font-weight: normal !important;
}

.field input, .field select, .field textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
    height: 35px;
}

.field textarea { height: auto; }
.field input:focus, .field select:focus { border-color: #d4af37; outline: none; }

.grading-box { border: none !important; padding: 0 !important; background: transparent !important; margin-bottom: 12px; }

.image-ribbon-thumbs { display: flex; gap: 12px; margin-top: 5px; }

.image-thumb-slot {
    width: 80px;
    height: 80px;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    background: #f9f9f9;
    color: #aaa;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.image-thumb-slot:hover { border-color: #d4af37; background: #fff; color: #d4af37; }
.image-thumb-slot img { width: 100%; height: 100%; object-fit: cover; }

.modal-actions { margin-top: 25px; display: flex; gap: 10px; }
.modal-actions button { height: 40px; flex: 1; font-size: 11px; text-transform: uppercase; font-weight: bold; cursor: pointer !important; border: none; transition: opacity 0.2s; }

#btn-fetch-grading { cursor: pointer !important; font-weight: bold; }

.modal-actions-container {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    gap: 5px !important;
}

.modal-actions-container button {
    width: 100% !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10px !important;
    font-weight: bold !important;
    text-transform: uppercase;
    cursor: pointer !important;
    border: none !important;
}

#btn-remove-item { background: #fff0f0 !important; color: #d9534f !important; border: 1px solid #f5c6cb !important; }
#btn-cancel-modal { background: #eee !important; color: #000 !important; }
.btn-save { background: #000 !important; color: #fff !important; }

.image-and-actions-row { display: flex !important; gap: 15px !important; margin-top: 15px !important; align-items: stretch !important; }
.image-field { flex: 1 !important; }

.delete-thumb {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff0000;
    color: #ffffff;
    border: 1px solid #cc0000;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.delete-thumb:hover { background: #cc0000; }
.delete-thumb i { font-size: 14px; pointer-events: none; }

/* =========================================================
   MODAL FORM INPUTS
   ========================================================= */

#add-collection-form select,
#wishlist-form select,
#swap-form select {
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 12px !important;
    padding-right: 25px !important;
    border: 1px solid #ddd;
    color: #333 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    cursor: pointer;
    box-shadow: none !important;
}

#add-collection-form input[type="text"],
#add-collection-form input[type="number"],
#add-collection-form textarea,
#wishlist-form input, #wishlist-form textarea,
#swap-form input, #swap-form textarea {
    background-color: #ffffff !important;
    border: 1px solid #ddd;
    color: #333 !important;
    box-shadow: none !important;
    padding: 8px;
}

#add-collection-form input:focus,
#add-collection-form select:focus,
#add-collection-form textarea:focus { border-color: #d4af37 !important; outline: none; }

#add-collection-form .field div[style*="display: flex"] > * { box-sizing: border-box !important; margin: 0 !important; }
input[name="grading_grade"], #btn-fetch-grading { flex: 1 !important; min-width: 0; }
#modal-grading-house, input[name="grading_serial"] { flex: 2 !important; min-width: 0; }

/* =========================================================
   COLLECTOR BUTTONS (action bar + modal states)
   ========================================================= */

button.btn-coll,
button.btn-coll.active-coll { cursor: pointer !important; }

.btn-coll.active-coll {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.btn-coll.active-coll::before {
    content: '⚙';
    font-size: 18px;
    color: #2e7d32;
    line-height: 1;
    flex-shrink: 0;
}

.btn-wish.active-wish {
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
    border: none !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.btn-wish.active-wish::before {
    content: '⚙';
    font-size: 18px;
    color: #0c5460;
    line-height: 1;
    flex-shrink: 0;
}

.btn-swap.active-swap {
    background-color: #fef5e7 !important;
    color: #e67e22 !important;
    border: none !important;
    font-weight: bold !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.btn-swap.active-swap::before {
    content: '⚙';
    font-size: 18px;
    color: #e67e22;
    line-height: 1;
    flex-shrink: 0;
}

.btn-fav { background-color: #f8f9fa; color: #666; cursor: pointer; }
.btn-fav.active-fav { background-color: #fff0f5 !important; color: #e91e63 !important; border: none !important; }
.btn-fav:hover { background-color: #e9ecef; }
.btn-fav.active-fav:hover { background-color: #fce4ec !important; }

.btn-wish-save { background-color: #3498db !important; color: #fff !important; border: none !important; padding: 10px; cursor: pointer; text-transform: uppercase; font-size: 11px; font-weight: bold; }
.btn-wish-remove, .btn-swap-remove { background-color: #fff0f0 !important; color: #d9534f !important; border: 1px solid #f5c6cb !important; padding: 10px; cursor: pointer; text-transform: uppercase; font-size: 11px; font-weight: bold; width: 100%; display: none; }
.btn-swap-save { background: #e67e22 !important; color: #fff !important; }

/* =========================================================
   SIMILAR ITEMS RIBBON
   ========================================================= */
.similar-items { margin-top: 55px; }

.similar-items-title {
    font-size: 18px;
    font-weight: 200;
    text-transform: uppercase;
    color: #000;
    margin: 0 0 18px;
    text-align: left;
}

.similar-items-ribbon {
    display: flex;
    gap: 16px;
    align-items: stretch;
    min-height: 250px;
}

.similar-card {
    flex: 0 0 calc((100% - 5 * 16px) / 6);
    min-width: 0;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    font-family: "PT Sans", Arial, Helvetica, sans-serif;
}
.similar-card:hover { text-decoration: none; color: inherit; }

.similar-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
    overflow: hidden;
}
.similar-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.similar-card-image img[src$="/media/no_image.png"] { transform: scale(.6); opacity: .75; }

.similar-card-info {
    text-align: center;
    font-size: 14px;
    color: #555;
    padding: 8px 4px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.similar-card-name { font-weight: bold; color: #333; }

@keyframes similarPulse { 0%{opacity:1} 50%{opacity:.5} 100%{opacity:1} }
.similar-card-skeleton .similar-card-image {
    background: #f0f0f0;
    animation: similarPulse 1.2s ease-in-out infinite;
}
.similar-card-skeleton .similar-card-info { min-height: 70px; }