/* Card Checklist Application Styles */

/* =============================================================================
   ACCORDION COMPONENTS
   ============================================================================= */

.accordion {
    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;
}

.panel {
    display: none;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    border-top: none;
}

/* =============================================================================
   CARD GALLERY
   ============================================================================= */

.card-images {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

.card {
    text-align: center;
    width: 160px;
    margin-bottom: 20px;
    transition: transform 0.2s ease;
}

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

.card-images img {
    width: 200px;
    height: auto;
    margin-bottom: 10px;
    cursor: pointer;
    border-radius: 5px;
    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-container button {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1em;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    min-width: 30px;
}

.name-container button:hover:not(:disabled) {
    background-color: #ddd;
}

.name-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.name-container button:active:not(:disabled) {
    background-color: #ccc;
}

/* =============================================================================
   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(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

#popup img {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

/* =============================================================================
   POPUP CONTENT LAYOUT
   ============================================================================= */

.popup-content {
    display: flex;
    align-items: flex-start;
    max-height: 80vh;
    width: 100%;
    gap: 20px;
    margin-top: 20px;
}

.popup-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: white;
    font-size: 1.1em;
}

.popup-text > div {
    margin: 0;
    padding: 5px 0;
}

/* =============================================================================
   POPUP TEXT ELEMENTS
   ============================================================================= */

#popupName,
#popupSubtitle,
#popupRarity,
#popupTeamName,
#popupPosition,
#popupJerseyNumber,
#popupBirthdate,
#popupControls,
#ownedby {
    color: white;
    font-size: 1.0em;
    margin: 5px 0;
}

#popupName {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 10px;
}

/* =============================================================================
   POPUP CONTROLS
   ============================================================================= */

#popup .controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    z-index: 1001;
    pointer-events: none;
}

#popup .controls button {
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    font-size: 24px;
    margin: 0 20px;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.1s ease;
    pointer-events: auto;
    color: #333;
    font-weight: bold;
}

#popup .controls button:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

#popup .controls button:active {
    transform: scale(0.95);
}

#popup .close {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 10px 15px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    color: #333;
}

#popup .close:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

/* =============================================================================
   EBAY SECTION
   ============================================================================= */

#popupEbayLink {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

#popupEbayLink .controls {
    position: static;
    display: flex;
    gap: 10px;
    transform: none;
    justify-content: center;
}

#popupEbayLink .controls button {
    background-color: #f1f1f1;
    color: #333;
    padding: 8px 15px;
    font-size: 16px;
    border-radius: 5px;
    margin: 0;
}

#popupEbayLink .controls button:hover:not(:disabled) {
    background-color: #ddd;
}

#popupEbayLink .controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#popupEbayLink img {
    width: 150px;
    height: auto;
    transition: transform 0.2s ease;
}

#popupEbayLink a:hover img {
    transform: scale(1.05);
}

#popupControls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

#popupControls > div:first-child {
    font-weight: bold;
    font-size: 1.1em;
}

#popupControls > div:last-child {
    display: flex;
    gap: 10px;
}

/* =============================================================================
   SET DETAILS LAYOUT
   ============================================================================= */

#detailsContainer {
    margin-bottom: 30px;
}

#imageDescriptionContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

#imageDescriptionContainer img {
    width: 200px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#imageDescriptionContainer > div {
    text-align: center;
    max-width: 600px;
    line-height: 1.6;
    color: #333;
}

/* Product cards styling */
.product-card {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    background: #f9f9f9;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    text-align: center;
    min-width: 150px;
}

.product-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.product-card a {
    text-decoration: none;
    color: #0066cc;
    font-weight: bold;
    transition: color 0.2s ease;
}

.product-card a:hover {
    color: #0052a3;
    text-decoration: underline;
}

.product-card s {
    color: #999;
}

.product-price {
    margin-top: 8px;
    font-size: 1.1em;
    font-weight: bold;
    color: #2d7d2d;
}

/* =============================================================================
   FORM CONTROLS
   ============================================================================= */

#setDropdown {
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: white;
    margin: 10px 0;
    min-width: 200px;
    transition: border-color 0.2s ease;
}

#setDropdown:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

label[for="setDropdown"] {
    font-weight: bold;
    margin-right: 10px;
    color: #333;
}

/* =============================================================================
   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;
    }
    
    .popup-content {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .card-images {
        justify-content: flex-start;
    }
}

@media (max-width: 767px) {
    #popup {
        padding: 10px;
        align-items: center;
        justify-content: flex-start;
        padding-top: 60px;
    }
    
    #popup img {
        max-width: 95%;
        max-height: 60vh;
    }
    
    .popup-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    #popup .controls button {
        padding: 12px 16px;
        font-size: 20px;
        margin: 0 10px;
    }
    
    .card-images {
        justify-content: center;
        gap: 15px;
    }
    
    .card {
        width: 140px;
    }
    
    .card-images img {
        width: 140px;
    }
}

@media (max-width: 480px) {
    .name-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .name-container button {
        min-width: 40px;
        padding: 8px 12px;
    }
    
    #setDropdown {
        width: 100%;
        max-width: 300px;
    }
    
    .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;
    }
}

/* Focus indicators for keyboard navigation */
.accordion:focus,
.card-images img:focus,
button:focus,
#setDropdown:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* 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);
    }
}