/* Product Group Addon - Frontend Styles */

.pga-group-selector {
    margin: 0px 0;
    padding: 18px 0px 0px 0;
}

.pga-group-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.pga-group-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.pga-group-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 45px;
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: #fff;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.pga-group-button:hover {
    border-color: #007cba;
    color: #007cba;
    text-decoration: none;
    transform: translateY(-0.2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.pga-group-button.pga-group-current {
    border-color: #28a745;
    background: #28a745;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
}

.pga-group-button.pga-group-current:hover {
    background: #1e7e34;
    border-color: #1e7e34;
    color: #fff;
    transform: none;
}

.pga-group-button.pga-group-unavailable {
    border-color: #ccc;
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.pga-group-button.pga-group-unavailable:hover {
    border-color: #ccc;
    color: #999;
    transform: none;
    box-shadow: none;
}

.pga-current-size {
    margin: 10px 0 0 0;
    font-size: 14px;
    color: #666;
}

/* Thumbnail styles */
.pga-group-item {
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
}

.pga-group-thumbnail-link {
    display: inline-block;
    text-decoration: none;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.pga-group-thumbnail {
    display: block;
    max-width: 100px;
    height: auto;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pga-group-thumbnail.pga-group-current {
    border: 2px solid #0b954e !important;
}

.pga-group-thumbnail-link:hover .pga-group-thumbnail {
    transform: scale(1.05);
}

.pga-group-price {
    text-align: center;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.pga-group-label {
    display: block;
    text-align: center;
}

.pga-group-thumbnail-wrapper {
    display: inline-block;
}

/* Inline size selector for product loops */
.pga-group-selector-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
}

.pga-group-button-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    text-decoration: none;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    border-radius: 3px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pga-group-button-small:hover {
    border-color: #007cba;
    color: #007cba;
    text-decoration: none;
}

.pga-group-button-small.pga-group-current {
    border-color: #28a745;
    background: #28a745;
    color: #fff;
}

.pga-group-button-small.pga-group-unavailable {
    border-color: #ccc;
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.pga-group-button-small.pga-group-unavailable:hover {
    border-color: #ccc;
    color: #999;
}

/* Loading states */
.pga-group-button.pga-loading {
    pointer-events: none;
    opacity: 0.7;
}

.pga-group-button.pga-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border: 1px solid transparent;
    border-top: 1px solid currentColor;
    border-radius: 50%;
    animation: pga-button-spin 1s linear infinite;
}

@keyframes pga-button-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .pga-group-buttons {
        justify-content: center;
    }

    .pga-group-button {
        min-width: 45px;
        height: 40px;
        font-size: 13px;
    }

    .pga-group-selector-inline {
        justify-content: center;
    }
}

/* WooCommerce integration */
.woocommerce .pga-group-selector {
    clear: both;
}

.woocommerce-page .pga-group-selector {
    clear: both;
}

/* Shop page integration */
.woocommerce ul.products li.product .pga-group-selector-inline {
    margin-top: 10px;
    text-align: center;
}

/* Touch device support */
.pga-touch-active {
    background: #f0f0f0 !important;
    transform: scale(0.95) !important;
}

/* Tooltip styles */
.pga-unavailable-tooltip {
    position: absolute;
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 9999;
    white-space: nowrap;
    pointer-events: none;
}

.pga-unavailable-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #333;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .pga-group-button {
        background: #2c2c2c;
        border-color: #555;
        color: #ccc;
    }

    .pga-group-button:hover {
        border-color: #007cba;
        color: #007cba;
    }

    .pga-group-button.pga-group-unavailable {
        background: #1a1a1a;
        border-color: #333;
        color: #666;
    }
}
