/* Card Checklist Application Styles */

/* =============================================================================
   ACCORDION COMPONENTS
   ============================================================================= */

.accordion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    width: 100%;
    text-align: left;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    margin: 5px 0;
    transition: background-color 0.2s ease;
}

.accordion:hover {
    background-color: #e0e0e0;
}

.accordion-label {
    flex-grow: 1;
    font-weight: bold;
}

.accordion-icon {
    transition: transform 0.3s ease;
}

.accordion-icon.rotated {
    transform: rotate(90deg);
}

.panel {
    display: none;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-top: none;
}
#accordionContainer {
    margin-bottom: 70px;
}

/* =============================================================================
   CARD GALLERY
   ============================================================================= */

.card-images {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.card {
    text-align: center;
    width: 160px;
    margin-bottom: 20px;
}

.card-images img {
    width: 155px;
    height: auto;
    margin-bottom: 10px;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease, box-shadow 0.2s ease;
}

.card-images img:hover {
    opacity: 0.9;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card .name {
    font-size: 1.2em;
    font-weight: bold;
    margin: 5px 0;
    line-height: 1.3;
}

/* =============================================================================
   CARD CONTROLS
   ============================================================================= */

.name-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}

.name-content{
    min-height: 81px;
}

.name-content a {
    color: #256029;
}

.ownership-controls {
    display: flex;
    align-items: center;
    border: 1px solid #000000;
    border-radius: 25px;
    padding: 5px 10px;
    margin-top: 5px;
    justify-content: space-between;
    width: fit-content;
    background-color: #ededed;
}

.ownership-controls button {
    border: none;
    background: none;
    font-size: 18px;
    padding: 5px;
    cursor: pointer;
    outline: none;
}

.ownership-controls button:disabled {
    color: #000000;
    cursor: not-allowed;
}

.ownership-count {
    text-align: center;
    margin: 0 5px;
}

.ownership-count .label {
    font-size: 12px;
    color: #000000;
    padding-left: 8px;
}

.ownership-count .value {
    font-weight: bold;
    font-size: 14px;
}

.ownership-controls > :not(:first-child) {
    border-left: 1px solid #000000;
}

/* =============================================================================
   LOADING STATES
   ============================================================================= */

#loadingMessage {
    display: none;
    padding: 15px;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    text-align: center;
    margin: 10px 0;
    border-radius: 5px;
    font-weight: bold;
    color: #666;
}

#loadingSpinner {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    text-align: center;
}

#loadingSpinner img {
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================================================
   POPUP MODAL
   ============================================================================= */

#popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.popup-card {
  position: relative;
  background: white;
  padding: 20px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.popup-card .close {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.25);
    padding: 10px 15px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #000000;
    z-index: 1001;
}

.popup-image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

.popup-image-container img {
    max-width: 100%;
    max-height: 89vh; 
    z-index: 1;
    box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.2);
}

.nav-arrow {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: rgb(0, 0, 0);
    background-color: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    padding: 10px;
    z-index: 2;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.nav-arrow.left {
    left: 0;
}

.nav-arrow.right {
    right: 0;
}

#flipIcon {
    margin: 10px 0;
    font-size: 24px;
    color: rgb(0, 0, 0);
    cursor: pointer;
}

.popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgb(0, 0, 0);
    text-align: center;
    margin-top: 10px;
}

.popup-name {
    font-weight: bold;
    font-size: 1.4em;
    margin-bottom: 5px;
}

.popup-meta {
    font-size: 1em;
    margin: 4px 0;
}

.ownership-count .label {
    font-size: 12px;
    color: #000000;
}

.ownership-count .value {
    font-weight: bold;
    font-size: 18px;
    color: #000;
}

#popupEbayLink img {
    height: 90px;
    margin-top: -20px;
    margin-bottom: -20px;
}

/* =============================================================================
   SET DETAILS LAYOUT
   ============================================================================= */

#detailsContainer {
    margin-bottom: 30px;
    margin-left: 15px;
    margin-right: 15px;
}

.set-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.set-image {
  max-width: 200px;
  height: auto;
  flex-shrink: 0;
}

.set-title {
  font-size: 1.4rem;
  font-weight: bold;
}

.product-line {
  font-size: 1rem;
  color: #256029;
  line-height: 1.4;
  flex-wrap: wrap;
}

.product-line a {
  color: #256029;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: underline;
}

.divider {
  color: #888;
  margin: 0 8px;
}

/* =============================================================================
   Dropdown Styles
   ============================================================================= */

#setDropdown {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-color: #f5f5f5;
  border: none;
  border-radius: 9999px;
  padding: 12px 24px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  outline: none;
  position: relative;
  margin: 20px;
}

/* Keep dropdown arrow */
#setDropdown {
  background-image: url('data:image/svg+xml;utf8,<svg fill="black" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 16px;
}

/* Focus state */
#setDropdown:focus {
  outline: none;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (min-width: 768px) {
    #imageDescriptionContainer {
        flex-direction: row !important;
        align-items: flex-start;
        text-align: left;
    }
    
    #imageDescriptionContainer img {
        margin-right: 20px;
        flex-shrink: 0;
    }
    
    #imageDescriptionContainer > div {
        text-align: left;
    }
}

@media (max-width: 767px) {
    .card-images {
        justify-content: center;
        gap: 15px;
    }
    
    .card {
        width: 140px;
    }
    
    .card-images img {
        width: 140px;
    }

    .popup-image-container img {
        max-height: 49vh;
    }
}

@media (max-width: 480px) {
    .name-container .label {
    font-size: 10px;
    }

    .card {
        width: 120px;
    }
    
    .card-images img {
        width: 120px;
    }
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-10 {
    padding: 10px;
}

.p-15 {
    padding: 15px;
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {
    #popup,
    .controls,
    #popupEbayLink,
    button {
        display: none !important;
    }
    
    .accordion {
        background-color: transparent;
        border: none;
        font-weight: bold;
    }
    
    .panel {
        display: block !important;
        border: none;
        background-color: transparent;
    }
    
    .card-images img {
        max-width: 100px;
        max-height: 140px;
    }
}

/* =============================================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    #loadingSpinner img {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .accordion {
        border-width: 2px;
    }
    
    .card-images img {
        border: 1px solid #000;
    }
    
    #popup {
        background-color: rgba(0, 0, 0, 0.95);
    }
}