/**
 * Product Selector Modal - Product Styles
 * Product grid, cards, actions, dropdowns
 */

/* ==========================================================================
   Product Grid
   ========================================================================== */

.product-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: clamp(12px, 2.5vw, 20px);
    background-color: var(--bg-primary);
}

.product-grid-container::-webkit-scrollbar {
    width: 12px;
}

.product-grid-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.product-grid-container::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 6px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ==========================================================================
   Product Card
   ========================================================================== */

.product-card {
    background-color: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease-out;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--border-light);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.product-card__image-container {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--bg-tertiary);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-card__info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card__brand {
    font-size: clamp(0.6rem, 1vw, 0.625rem);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.product-card__name {
    font-size: clamp(0.8rem, 1.5vw, 0.875rem);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__specs {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    flex: 1;
}

.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.product-card__price {
    font-size: clamp(0.95rem, 2.5vw, 1.125rem);
    font-weight: 700;
    color: var(--accent);
}

.product-card__stock {
    font-size: 0.6875rem;
    color: var(--success);
    font-weight: 500;
}

.product-card__stock--out {
    color: var(--text-muted);
}

.product-card__actions {
    padding: 12px;
    padding-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Favorite Button
   Hidden by default, visible on hover or when favorited
   ========================================================================== */

.product-card__favorite {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    opacity: 0;
}

/* Show favorite button on card hover */
.product-card:hover .product-card__favorite {
    opacity: 1;
}

.product-card__favorite:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Always show when favorited */
.product-card__favorite.is-favorite {
    opacity: 1;
    color: var(--error);
}

.product-card__favorite.is-favorite:hover {
    background-color: var(--error-bg, rgba(248, 113, 113, 0.15));
}

/* ==========================================================================
   Add Button
   ========================================================================== */

.btn-add-to-build {
    flex: 1;
    background-color: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-to-build:hover {
    background-color: var(--accent-hover);
}

/* ==========================================================================
   More Actions Dropdown
   ========================================================================== */

.product-card__more {
    position: relative;
    flex-shrink: 0;
}

.product-card__more-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.product-card__more-trigger:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.product-card__dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    z-index: 60;
    min-width: 180px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
}

.product-card__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.product-card__dropdown-item:hover {
    background-color: var(--bg-hover);
}

.product-card__dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.product-card__dropdown-item:hover svg {
    color: var(--text-primary);
}

/* ==========================================================================
   Light Theme
   ========================================================================== */

.light .product-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.light .product-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}
