/* Product Size Addon - Frontend Styles */

.psa-size-selector {
    margin: 20px 0;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

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

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

.psa-size-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;
}

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

.psa-size-button.psa-size-active {
    border-color: #007cba;
    background: #007cba;
    color: #fff;
}

.psa-size-button.psa-size-active:hover {
    background: #005a87;
    border-color: #005a87;
    color: #fff;
    transform: none;
}

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

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

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

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

.psa-size-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;
}

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

.psa-size-button-small.psa-size-active {
    border-color: #007cba;
    background: #007cba;
    color: #fff;
}

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

.psa-size-button-small.psa-size-unavailable:hover {
    border-color: #ccc;
    color: #999;
}

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

.psa-size-button.psa-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: psa-button-spin 1s linear infinite;
}

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

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

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

    .psa-size-selector-inline {
        justify-content: center;
    }
}

/* WooCommerce integration */
.woocommerce .psa-size-selector {
    clear: both;
}

.woocommerce-page .psa-size-selector {
    clear: both;
}

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

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

/* Tooltip styles */
.psa-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;
}

.psa-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) {
    .psa-size-button {
        background: #2c2c2c;
        border-color: #555;
        color: #ccc;
    }

    .psa-size-button:hover {
        border-color: #007cba;
        color: #007cba;
    }

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