/**
 * CardListComponent Styles
 *
 * Unified styles for all card grid displays.
 * Used by CardListComponent.js
 *
 * Includes: Filter bar styles (merged from filter.css)
 */

/* ==============================================
   WRAPPER & LAYOUT
   ============================================== */

.card-list-wrapper {
    width: 100%;
}

/* ==============================================
   HEADER
   ============================================== */

.card-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-list-header h1 {
    margin: 0;
    font-size: 1.75em;
    color: var(--text-primary);
}

.card-list-header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==============================================
   LOADING & EMPTY STATES
   ============================================== */

.card-list-loading,
.card-list-empty {
    text-align: center;
    padding: 60px 20px;
}

.card-list-loading-text,
.card-list-empty-text {
    color: var(--text-secondary);
    font-size: 1.1em;
    margin: 0;
}

.card-list-loading-text::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: middle;
    animation: card-list-spinner 0.8s linear infinite;
}

@keyframes card-list-spinner {
    to {
        transform: rotate(360deg);
    }
}

.card-list-error {
    color: var(--error-bg, #dc3545);
    font-size: 1em;
    margin: 0;
}

/* ==============================================
   GRID
   ============================================== */

.card-list-container {
    width: 100%;
}

.card-list-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

/* Grid sizing by card type */
.card-list-grid--default {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card-list-grid--brand {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.card-list-grid--team {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card-list-grid--series {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card-list-grid--logo {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card-list-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

/* ==============================================
   CARD BASE
   ============================================== */

.card-list-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.card-list-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card-list-item--highlight {
    border: 2px solid var(--accent-primary);
}

/* ==============================================
   CARD IMAGE
   ============================================== */

.card-list-image {
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-list-image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.card-list-image img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
}

/* No image placeholder */
.card-list-no-image {
    width: 60px;
    height: 60px;
    color: var(--text-secondary);
    opacity: 0.4;
}

.card-list-no-image svg {
    width: 100%;
    height: 100%;
}

/* ==============================================
   CARD INFO
   ============================================== */

.card-list-info {
    flex: 1;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Title */
.card-list-title {
    margin: 0 0 8px 0;
    font-size: 1.2em;
    color: var(--text-primary);
    font-weight: 600;
}

.card-list-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.card-list-title a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* Subtitle */
.card-list-subtitle {
    margin: 0 0 5px 0;
    font-size: 0.95em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Meta items */
.card-list-meta {
    margin: 0;
}

.card-list-meta-item {
    margin: 3px 0;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.card-list-meta-item strong {
    color: var(--text-primary);
}

/* Title prefix (icon before title) */
.card-list-title-prefix {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
    color: var(--text-tertiary);
}

.card-list-title-prefix svg {
    vertical-align: middle;
}

/* Badge */
.card-list-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    background: var(--accent-primary);
    color: white;
    vertical-align: middle;
}

.card-list-badge--secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* ==============================================
   CARD ACTIONS
   ============================================== */

.card-list-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.card-list-item:hover .card-list-actions {
    opacity: 1;
}

.card-list-actions a,
.card-list-actions button {
    flex: 1;
    min-width: fit-content;
    text-align: center;
}

/* ==============================================
   PAGINATION
   ============================================== */

.card-list-load-more-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 0 40px;
}

.card-list-load-more {
    min-width: 200px;
}

.card-list-sentinel {
    height: 1px;
    width: 100%;
}

/* ==============================================
   TYPE-SPECIFIC OVERRIDES
   ============================================== */

/* Brand cards - smaller images */
.card-list-item--brand .card-list-image {
    min-height: 100px;
    padding: 15px;
}

.card-list-item--brand .card-list-image img {
    max-height: 80px;
}

/* Team cards */
.card-list-item--team .card-list-image {
    min-height: 100px;
    padding: 15px;
}

.card-list-item--team .card-list-image img {
    max-height: 80px;
}

/* Series cards */
.card-list-item--series .card-list-image {
    min-height: 100px;
    padding: 15px;
}

.card-list-item--series .card-list-image img {
    max-height: 80px;
}

/* Logo cards grid - uses decals.css logo-card styles */
.card-list-grid--logo {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Logo cards - larger images (fallback if not using logo-card) */
.card-list-item--logo .card-list-image {
    min-height: 150px;
    padding: 20px;
}

.card-list-item--logo .card-list-image img {
    max-height: 120px;
}

.card-list-item--logo .card-list-info {
    align-items: flex-start;
    text-align: left;
}

/* Compact cards (no image) */
.card-list-item--compact {
    padding: 12px 15px;
}

.card-list-item--compact .card-list-info {
    margin-bottom: 0;
}

.card-list-item--compact .card-list-title {
    font-size: 1.1em;
    margin-bottom: 0;
}

.card-list-item--compact .card-list-actions {
    margin-top: 10px;
}

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

/* Mini cards - inline layout with icon buttons */
.card-list-grid--mini {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.card-list-item--mini {
    padding: 8px 12px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: 8px;
}

.card-list-item--mini .card-list-info {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.card-list-item--mini .card-list-title {
    font-size: 1em;
    margin-bottom: 0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-list-item--mini .card-list-actions {
    margin-top: 0;
    flex-shrink: 0;
    gap: 4px;
    flex-wrap: nowrap;
}

.card-list-item--mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Mini card icon buttons */
.card-list-item--mini .card-list-actions a,
.card-list-item--mini .card-list-actions button {
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: unset;
    border-radius: 6px;
}

.card-list-item--mini .card-list-actions svg {
    width: 14px;
    height: 14px;
}

/* ==============================================
   RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
    .card-list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-list-header-buttons {
        width: 100%;
    }

    .card-list-header-buttons button {
        flex: 1;
    }

    .card-list-grid {
        gap: 15px;
    }

    .card-list-grid--brand,
    .card-list-grid--team,
    .card-list-grid--series {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .card-list-grid--logo,
    .card-list-grid--default {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .card-list-item {
        padding: 12px;
    }

    .card-list-image {
        min-height: 100px;
        padding: 15px;
    }

    .card-list-image img {
        max-height: 80px;
    }
}

@media (max-width: 480px) {
    .card-list-grid--brand,
    .card-list-grid--team,
    .card-list-grid--series,
    .card-list-grid--logo,
    .card-list-grid--default {
        grid-template-columns: 1fr;
    }

    .card-list-actions {
        opacity: 1;
    }
}

/* ==============================================
   FILTER BAR COMPONENT
   ============================================== */

.filter-bar-component {
    margin-bottom: 20px;
}

.filter-bar-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Filter row layouts */
.filter-bar-row {
    display: grid;
    gap: 15px;
}

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

.filter-bar-row--inline {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* Filter group */
.filter-bar-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-bar-group--flex {
    flex: 1;
}

.filter-bar-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9em;
}

.filter-bar-help-text {
    font-weight: normal;
    color: var(--text-tertiary);
    margin-left: 8px;
}

/* Filter inputs */
.filter-bar-input-wrapper {
    position: relative;
}

.filter-bar-input {
    width: 100%;
}

.filter-bar-select {
    width: 100%;
}

/* Actions row */
.filter-bar-actions-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.filter-bar-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Loading state for filter */
.filter-bar-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ==============================================
   FILTER BAR RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
    .filter-bar-row--grid,
    .filter-bar-row--inline {
        grid-template-columns: 1fr;
    }

    .filter-bar-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar-buttons {
        width: 100%;
    }

    .filter-bar-buttons button,
    .filter-bar-buttons a {
        flex: 1;
    }
}

/* ==============================================
   FILTER BAR (merged from filter.css)
   ============================================== */

.filter-bar {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9em;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.filter-actions .btn-primary,
.filter-actions .btn-secondary {
    white-space: nowrap;
}

/* Logo Filter Bar (shared component) */
.logo-filter-bar {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-row .form-group {
    margin-bottom: 0;
}

.filter-row label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 0.9em;
}

.filter-actions-row {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.filter-actions-row .form-input {
    flex: 1;
}

.filter-help-text {
    font-weight: normal;
    color: var(--text-tertiary);
    margin-left: 8px;
}

/* Responsive Filter Adjustments */
@media (max-width: 768px) {
    .filter-form,
    .filter-row {
        grid-template-columns: 1fr;
    }

    .filter-actions,
    .filter-actions-row {
        flex-direction: column;
        align-items: stretch;
    }
}
