/**
 * Stone Variants Widget Styles
 * 
 * @package ProStoneManager
 * @since 2.5.1
 */

/* ============================================
   Variants Accordion Container
   ============================================ */

.psm-variants {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    direction: inherit;
}

.psm-variants-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================
   Variant Item (Accordion)
   ============================================ */

.psm-variant-item {
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.psm-variant-item:hover {
    border-color: #d0d0d0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Variant Header (Button) */
.psm-variant-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    background: #f8f9fa;
    color: #2c3e50;
    border: none;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-align: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Stone texture overlay using CSS noise */
.psm-variant-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.15;
    pointer-events: none;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0,0,0,0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255,255,255,0.2) 0%, transparent 40%),
        radial-gradient(circle at 60% 20%, rgba(0,0,0,0.1) 0%, transparent 30%);
    background-size: 200px 200px, 150px 150px, 180px 180px, 120px 120px;
    background-position: 0 0, 40px 60px, 130px 270px, 70px 100px;
    mix-blend-mode: overlay;
    z-index: 1;
}

/* Subtle grain texture */
.psm-variant-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.08;
    pointer-events: none;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
    z-index: 1;
}

.psm-variant-header:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.psm-variant-header[aria-expanded="true"] {
    border-bottom-color: #e8e8e8;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.05);
    /* Background will be set by JavaScript with blended color */
}

/* Text contrast classes for header */
.psm-variant-header.psm-light-header {
    color: #1a202c;
}

.psm-variant-header.psm-light-header .psm-variant-location {
    color: #4a5568;
}

.psm-variant-header.psm-light-header .psm-variant-toggle {
    background: rgba(0, 0, 0, 0.1);
    color: #2d3748;
}

.psm-variant-header.psm-dark-header {
    color: #ffffff;
}

.psm-variant-header.psm-dark-header .psm-variant-location {
    color: #e2e8f0;
}

.psm-variant-header.psm-dark-header .psm-variant-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.psm-variant-title {
    flex: 1;
    font-weight: 600;
    color: #1a202c;
}

.psm-variant-location {
    font-size: 13px;
    font-weight: 400;
    color: #718096;
}

.psm-variant-toggle {
    transition: transform 0.3s ease, background 0.3s ease;
    font-size: 14px;
    color: #718096;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f3f5;
}

.psm-variant-header:hover .psm-variant-toggle {
    background: #e9ecef;
    color: #495057;
}

.psm-variant-header[aria-expanded="true"] .psm-variant-toggle {
    transform: rotate(180deg);
}

/* Variant Content */
.psm-variant-content {
    padding: 24px;
    display: none;
    animation: psm-slideDown 0.3s ease;
    position: relative;
    overflow: visible;
    max-height: none !important;
    height: auto !important;
    background: #ffffff;
}

.psm-variant-content.active {
    display: block;
}

/* ============================================
   Variant Properties List
   ============================================ */

.psm-variant-properties {
    list-style: none;
    margin: 0 0 24px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psm-variant-properties li {
    display: flex;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.psm-variant-properties li:hover {
    background: #f1f3f5;
    border-color: #dee2e6;
}

.psm-variant-properties strong {
    color: #495057;
    min-width: 140px;
    font-weight: 600;
    font-size: 13px;
}

.psm-variant-properties span {
    color: #6c757d;
    flex: 1;
    line-height: 1.5;
}

/* ============================================
   Minerals Section
   ============================================ */

.psm-variant-minerals {
    margin: 0;
    padding: 0;
}

.psm-minerals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

/* ============================================
   Mineral Card with Glassmorphism
   ============================================ */

.psm-mineral-card {
    position: relative;
    padding: 28px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 14px;
    
    /* Base glassmorphism for transparent area */
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.2) 100%
    );
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.03),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* Dark glassmorphism for transparent area on dark backgrounds */
.psm-mineral-card.psm-dark-glass {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 0.15) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* Color gradient layer (applied by JS) */
.psm-mineral-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mineral-percentage, 0%);
    background: var(--mineral-color, transparent);
    z-index: 0;
    transition: height 0.4s ease;
}

/* Glassmorphism overlay on top of everything */
.psm-mineral-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 100%
    );
}

.psm-mineral-card.psm-dark-glass::before {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

.psm-mineral-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.1),
        0 6px 12px rgba(0, 0, 0, 0.06),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.psm-mineral-card.psm-dark-glass:hover {
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.25),
        0 6px 12px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* Mineral Icon */
.psm-mineral-icon {
    position: relative;
    z-index: 2;
    width: 150px;
 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.psm-mineral-card:hover .psm-mineral-icon {
    transform: scale(1.05);
}

.psm-mineral-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: none;
    background: none;
    border: none;
    box-shadow: none;
}

.psm-mineral-icon i {
    display: block;
}

/* Mineral Info */
.psm-mineral-info {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.psm-mineral-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a202c;
    letter-spacing: -0.2px;
}

.psm-mineral-percentage {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #2d3748;
}

.psm-mineral-color-code {
    font-size: 11px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ============================================
   Text Contrast Classes (Auto-applied by JS)
   ============================================ */

.psm-mineral-card {
    color: #1a202c;
}

.psm-mineral-card.psm-dark-glass {
    color: #ffffff;
}

.psm-mineral-card.psm-dark-glass .psm-mineral-name {
    color: #f7fafc;
}

.psm-mineral-card.psm-dark-glass .psm-mineral-percentage {
    color: #e2e8f0;
}

.psm-mineral-card.psm-dark-glass .psm-mineral-color-code {
    background: rgba(0, 0, 0, 0.4);
    color: #cbd5e0;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .psm-minerals-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .psm-mineral-card {
        padding: 20px 14px;
        min-height: 130px;
    }

    .psm-mineral-icon {
        width: 70px;
        height: 70px;
    }

    .psm-mineral-name {
        font-size: 13px;
    }

    .psm-mineral-percentage {
        font-size: 18px;
    }

    .psm-variant-properties {
        gap: 8px;
    }

    .psm-variant-properties li {
        flex-direction: column;
        gap: 4px;
    }

    .psm-variant-properties strong {
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .psm-minerals-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .psm-mineral-card {
        padding: 18px 12px;
        min-height: 120px;
    }

    .psm-mineral-icon {
        width: 60px;
        height: 60px;
    }

    .psm-mineral-name {
        font-size: 12px;
    }

    .psm-mineral-percentage {
        font-size: 16px;
    }

    .psm-variant-header {
        padding: 14px 16px;
        font-size: 14px;
    }

    .psm-variant-content {
        padding: 16px;
    }
}

/* ============================================
   Animations
   ============================================ */

@keyframes psm-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RTL Support
   ============================================ */

[dir="rtl"] .psm-variant-toggle {
    transform: scaleX(-1);
}

[dir="rtl"] .psm-variant-header[aria-expanded="true"] .psm-variant-toggle {
    transform: scaleX(-1) rotate(180deg);
}
