/**
 * Product-specific CSS
 * Styles for single product pages and product archives
 */

/* ==========================================================================
   Visual Field Indicators
   ========================================================================== */

/* Progress Bar Style */
.psm-field-visual {
    margin: 10px 0;
}

.psm-progress-container {
    background: #e9ecef;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
    margin: 8px 0;
}

.psm-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease;
    position: relative;
    overflow: hidden;
}

.psm-progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: psm-shimmer 2s infinite;
}

@keyframes psm-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.psm-progress-bar.psm-level-low { 
    background: linear-gradient(45deg, #52c234, #7ed56f); 
    width: 30%; 
}

.psm-progress-bar.psm-level-medium { 
    background: linear-gradient(45deg, #f39c12, #e67e22); 
    width: 65%; 
}

.psm-progress-bar.psm-level-high { 
    background: linear-gradient(45deg, #e74c3c, #c0392b); 
    width: 90%; 
}

/* Gauge Style */
.psm-gauge-container {
    position: relative;
    width: 120px;
    height: 60px;
    margin: 10px auto;
}

.psm-gauge-svg {
    width: 100%;
    height: 100%;
}

.psm-gauge-bg {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 8;
}

.psm-gauge-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.psm-gauge-fill.psm-level-low { 
    stroke: #52c234; 
    stroke-dasharray: 35 90;
}

.psm-gauge-fill.psm-level-medium { 
    stroke: #f39c12; 
    stroke-dasharray: 65 90;
}

.psm-gauge-fill.psm-level-high { 
    stroke: #e74c3c; 
    stroke-dasharray: 85 90;
}

.psm-gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -20%);
    font-weight: bold;
    font-size: 0.9em;
    color: #2c3e50;
    text-align: center;
}

.psm-gauge-label {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: #7f8c8d;
}

/* Field Display Container */
.psm-field-container {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
}

.psm-field-label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 1.1em;
}

.psm-field-value {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.psm-field-number {
    font-size: 1.2em;
    font-weight: bold;
    color: #34495e;
    min-width: 80px;
}

.psm-field-level-text {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    text-transform: uppercase;
}

.psm-field-level-text.psm-level-low {
    background: #d4edda;
    color: #155724;
}

.psm-field-level-text.psm-level-medium {
    background: #fff3cd;
    color: #856404;
}

.psm-field-level-text.psm-level-high {
    background: #f8d7da;
    color: #721c24;
}

/* Product Gallery */
.psm-product-gallery {
    margin-bottom: 30px;
}

.psm-gallery-main {
    margin-bottom: 15px;
}

.psm-gallery-main img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.psm-gallery-main img:hover {
    transform: scale(1.02);
}

.psm-gallery-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.psm-gallery-thumb {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.psm-gallery-thumb.active {
    border-color: #0073aa;
}

.psm-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Meta */
.psm-product-meta {
    background: #f9f9f9;
    padding: 10px 20px 10px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.psm-meta-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.psm-meta-item:last-child {
    border-bottom: none;
}

.psm-meta-label {
    font-weight: 600;
    color: #333;
}

.psm-meta-value {
    color: #666;
}

/* Product Rating */
.psm-product-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 0;
}

.psm-stars {
    display: flex;
    gap: 2px;
}

.psm-star {
    color: #ddd;
    font-size: 18px;
    transition: color 0.3s ease;
}

.psm-star.active {
    color: #ffc107;
}

.psm-rating-text {
    font-size: 14px;
    color: #666;
}

/* Product Tags */
.psm-product-tags {
    margin: 20px 0;
}

.psm-tag {
    display: inline-block;
    background: #f0f0f0;
    color: #333;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    margin: 2px;
    text-decoration: none;
    transition: background 0.3s ease;
}

.psm-tag:hover {
    background: #e0e0e0;
    text-decoration: none;
}

/* Product Archive */
.psm-product-archive {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 20px 0;
}

.psm-product-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.psm-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.psm-product-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.psm-product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.psm-product-card:hover .psm-product-card-image img {
    transform: scale(1.05);
}

.psm-product-card-content {
    padding: 20px;
}

.psm-product-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

/* ==========================================================================
   Responsive Design for Visual Indicators
   ========================================================================== */

@media (max-width: 768px) {
    .psm-field-value {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .psm-gauge-container {
        width: 100px;
        height: 50px;
    }
    
    .psm-progress-container {
        height: 16px;
    }
    
    .psm-field-container {
        padding: 12px;
    }
    
    .psm-field-number {
        font-size: 1.1em;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .psm-gauge-container {
        width: 80px;
        height: 40px;
    }
    
    .psm-gauge-value {
        font-size: 0.8em;
    }
    
    .psm-gauge-label {
        font-size: 0.7em;
    }
    
    .psm-progress-container {
        height: 14px;
    }
}

/* ==========================================================================
   Widget Specific Styles
   ========================================================================== */

.elementor-widget-psm-product-info .psm-field-container,
.elementor-widget-psm-single-field .psm-field-container {
    margin: 10px 0;
    background: transparent;
    border: none;
    padding: 10px 0;
}

.elementor-widget-psm-product-info .psm-field-visual,
.elementor-widget-psm-single-field .psm-field-visual {
    margin: 5px 0;
}

/* ==========================================================================
   Shortcode Specific Styles  
   ========================================================================== */

.psm-shortcode-field .psm-field-container {
    margin: 8px 0;
    padding: 10px;
    border-left-width: 3px;
}

.psm-shortcode-field .psm-gauge-container {
    width: 100px;
    height: 50px;
}

/* ==========================================================================
   Admin Styles for Level Radio Buttons
   ========================================================================== */

.psm-level-radio {
    margin-top: 8px;
}

.psm-level-radio label {
    margin-right: 15px;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.psm-level-radio input[type="radio"] {
    margin: 0;
    margin-left: 4px;
}

.psm-level-radio label:hover {
    color: #0073aa;
}

/* ==========================================================================
   Animation and Interaction Effects
   ========================================================================== */

.psm-field-visual {
    opacity: 0;
    transform: translateY(20px);
    animation: psm-fadeInUp 0.6s ease forwards;
}

@keyframes psm-fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.psm-field-container:hover .psm-progress-bar::before {
    animation-duration: 1s;
}

.psm-gauge-fill {
    animation: psm-gaugeAppear 1.5s ease;
}

@keyframes psm-gaugeAppear {
    from {
        stroke-dasharray: 0 90;
    }
}

.psm-product-card-excerpt {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .psm-product-archive {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .psm-gallery-thumbs {
        justify-content: center;
    }
    
    .psm-gallery-thumb {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .psm-product-archive {
        grid-template-columns: 1fr;
    }
    
    .psm-product-meta {
        padding: 15px;
    }
}