/**
 * Collection Page Styles
 * Lions Gameday
 */

/* ========================================
   Collection Page Layout
   ======================================== */
.collection-page {
    padding: 1.5rem 0;
}

.collection-header {
    margin-bottom: 1.5rem;
}

.collection-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0076B6;
    margin: 0;
}

/* ========================================
   Filter Bar
   ======================================== */
.filter-bar {
    background-color: #F5F5F5;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* Decade Buttons Row */
.decade-buttons {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E0DCD8;
}

.decade-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0076B6;
    background-color: #FFFFFF;
    border: 2px solid #0076B6;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.decade-btn:hover {
    background-color: #0076B6;
    color: #FFFFFF;
}

.decade-btn.active {
    background-color: #0076B6;
    color: #FFFFFF;
}

/* Filter Controls Row */
.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.filter-group {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid #E0DCD8;
    border-radius: 4px;
    background-color: #FFFFFF;
    color: #1D252C;
    width: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #0076B6;
    box-shadow: 0 0 0 2px rgba(0, 118, 182, 0.2);
}

/* Opponent Autocomplete */
.opponent-autocomplete {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #FFFFFF;
    border: 1px solid #E0DCD8;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background-color: #F5F5F5;
}

/* Search Input with Button */
.search-group {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    gap: 0.5rem;
}

.search-group input {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
}

/* Clear All Button */
.clear-filters-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    background-color: #FFFFFF;
    border: 1px solid #E0DCD8;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.clear-filters-btn:hover {
    color: #1D252C;
    border-color: #1D252C;
}

/* ========================================
   Results Header
   ======================================== */
.results-header {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 1rem;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 0.95rem;
    color: #6c757d;
}

.results-count strong {
    color: #1D252C;
}

/* View Toggle */
.view-toggle {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    gap: 0.25rem;
    background-color: #F5F5F5;
    border-radius: 4px;
    padding: 0.25rem;
}

.view-btn {
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s ease;
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}

.view-btn svg {
    width: 18px;
    height: 18px;
    stroke: #6c757d;
    transition: stroke 0.3s ease;
}

.view-btn:hover svg {
    stroke: #1D252C;
}

.view-btn.active {
    background-color: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-btn.active svg {
    stroke: #0076B6;
}

/* ========================================
   Collection Grid (Card View)
   ======================================== */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* ========================================
   Collection Table View
   ======================================== */
.collection-table-wrapper {
    display: none;
    overflow-x: auto;
}

.collection-table-wrapper.active {
    display: block;
}

.collection-grid.hidden {
    display: none;
}

.collection-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #FFFFFF;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.collection-table th,
.collection-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #E0DCD8;
}

.collection-table th {
    background-color: #F5F5F5;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.collection-table tbody tr {
    transition: background-color 0.2s ease;
}

.collection-table tbody tr:hover {
    background-color: #FAFAFA;
}

.collection-table tbody tr:last-child td {
    border-bottom: none;
}

.collection-table .date-cell {
    white-space: nowrap;
    font-size: 0.9rem;
    color: #6c757d;
}

.collection-table .opponent-cell {
    font-weight: 600;
    color: #1D252C;
}

.collection-table .venue-cell {
    font-size: 0.9rem;
    color: #6c757d;
}

.collection-table .score-cell {
    font-weight: 600;
}

.collection-table .score-cell.win {
    color: #4A7C59;
}

.collection-table .score-cell.loss {
    color: #8B3A3A;
}

.collection-table .score-cell.tie {
    color: #6c757d;
}

.collection-table .coach-cell {
    font-size: 0.9rem;
}

.collection-table .status-cell {
    font-size: 0.8rem;
    font-weight: 600;
}

.collection-table .status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.collection-table .status-badge.collected {
    background-color: #d4edda;
    color: #155724;
}

.collection-table .status-badge.wanted {
    background-color: #fff3cd;
    color: #856404;
}

.collection-table .status-badge.not-available {
    background-color: #f8d7da;
    color: #721c24;
}

/* Table row thumbnail */
.collection-table .thumb-cell {
    width: 50px;
    padding: 0.5rem;
    cursor: pointer;
    position: relative;
    /* Image protection for Safari */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.collection-table .thumb-cell img {
    width: 40px;
    height: 53px;
    object-fit: cover;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.2s ease;
    /* Image protection - prevent saving via long-press */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.collection-table .thumb-cell:hover img {
    transform: scale(1.1);
}

/* Game type badge in table */
.collection-table .type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #FFFFFF;
    background-color: #0076B6;
    padding: 0.15rem 0.4rem;
    border-radius: 2px;
    text-transform: uppercase;
}

.collection-table .type-badge.playoffs {
    background-color: #c9243f;
}

.collection-table .type-badge.preseason {
    background-color: #6c757d;
}

/* ========================================
   Load More Button
   ======================================== */
.load-more-container {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
}

.load-more-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #0076B6;
    background-color: #FFFFFF;
    border: 2px solid #0076B6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-btn:hover:not(:disabled) {
    background-color: #0076B6;
    color: #FFFFFF;
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.load-more-btn .spinner-icon {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: #F5F5F5;
    border-radius: 8px;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: #1D252C;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.empty-state-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0076B6;
    background-color: #FFFFFF;
    border: 2px solid #0076B6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.empty-state-btn:hover {
    background-color: #0076B6;
    color: #FFFFFF;
}

/* ========================================
   Loading State
   ======================================== */
.collection-loading {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    min-height: 300px;
}

.collection-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #F5F5F5;
    border-top-color: #0076B6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .collection-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-controls {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Mobile */
@media (max-width: 768px) {
    .collection-page {
        padding: 1rem 0;
    }

    .collection-header h1 {
        font-size: 1.5rem;
    }

    .decade-buttons {
        gap: 0.375rem;
    }

    .decade-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    .filter-controls {
        grid-template-columns: 1fr 1fr;
    }

    .collection-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    .results-header {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -webkit-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: start;
        -webkit-align-items: flex-start;
        align-items: flex-start;
    }

    /* Table responsive adjustments */
    .collection-table th,
    .collection-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .collection-table .venue-cell,
    .collection-table .coach-cell {
        display: none;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .filter-bar {
        padding: 0.75rem;
    }

    .decade-buttons {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .decade-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .filter-controls {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .filter-group label {
        font-size: 0.7rem;
    }

    .filter-group select,
    .filter-group input[type="text"] {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }
}
