/* ═══════════════════════════════════════════════════════════════
   PROFILE STATS FLIP CARDS
   Interactive flip cards for profile statistics
   Front matches original fw-stat-card style
   ═══════════════════════════════════════════════════════════════ */

/* Stats Container - Match original fw-stats-row */
.pf-stats-flip-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

/* Individual Flip Card */
.pf-stat-flip {
    perspective: 1000px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.pf-stat-flip-inner {
    position: relative;
    width: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

.pf-stat-flip.flipped .pf-stat-flip-inner {
    transform: rotateY(180deg);
}

/* Card faces - backface + opacity fallback for mobile browsers */
.pf-stat-front,
.pf-stat-back {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 18px;
}

/* Fallback: hide front when flipped, show back */
.pf-stat-front {
    transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.pf-stat-flip.flipped .pf-stat-front {
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0s, opacity 0.3s ease;
}

.pf-stat-back {
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.pf-stat-flip.flipped .pf-stat-back {
    opacity: 1;
    visibility: visible;
    transition: visibility 0s 0s, opacity 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   FRONT - Premium Golden Ornaments Style
   ═══════════════════════════════════════════════════════════════ */
.pf-stat-front {
    background: linear-gradient(160deg, rgba(60, 25, 55, 0.85) 0%, rgba(48, 18, 45, 0.85) 100%);
    border-radius: 20px;
    padding: 22px 14px 18px;
    text-align: center;
    position: relative;
    overflow: visible;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.pf-stat-flip:active .pf-stat-front {
    transform: scale(0.97);
}

/* Animated golden border */
.pf-stat-premium-border {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 2px;
    background: linear-gradient(135deg, var(--fw-gold, #d4a853), transparent 30%, transparent 70%, var(--fw-gold, #d4a853));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.7;
    pointer-events: none;
}

/* Corner ornaments */
.pf-stat-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--fw-gold, #d4a853);
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pf-stat-corner-tl { top: 8px; left: 8px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.pf-stat-corner-tr { top: 8px; right: 8px; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.pf-stat-corner-bl { bottom: 8px; left: 8px; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.pf-stat-corner-br { bottom: 8px; right: 8px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }

/* Diamond ornament */
.pf-stat-diamond {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 6px;
    height: 6px;
    background: var(--fw-gold, #d4a853);
    opacity: 0.6;
    box-shadow: 0 0 8px rgba(212, 168, 83, 0.5);
    pointer-events: none;
}

/* Sparkle particles */
.pf-stat-sparkle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--fw-gold, #d4a853);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: pfSparkle 3s ease-in-out infinite;
}

.pf-stat-sparkle:nth-child(1) { top: 30%; left: 15%; animation-delay: 0s; }
.pf-stat-sparkle:nth-child(2) { top: 60%; right: 12%; animation-delay: 1s; }
.pf-stat-sparkle:nth-child(3) { bottom: 25%; left: 20%; animation-delay: 2s; }

@keyframes pfSparkle {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 0.8; transform: scale(1); }
}

/* Bottom accent line */
.pf-stat-bottom-accent {
    position: absolute;
    bottom: 6px;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--fw-gold, #d4a853), transparent);
    opacity: 0.4;
    pointer-events: none;
}

/* Front content */
.pf-stat-front-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

/* Glowing icon circle */
.pf-stat-icon-wrap {
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.2) 0%, transparent 70%);
    border: 2px solid rgba(212, 168, 83, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

/* Inner ring */
.pf-stat-icon-wrap::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: 50%;
}

.pf-stat-flip-icon {
    font-size: 1.5rem;
    position: relative;
    z-index: 1;
    color: var(--fw-sunset-peach, #ff9f43);
}

.pf-stat-flip-icon i {
    display: block;
}

/* Different icon colors per card */
.pf-stat-flip:nth-child(1) .pf-stat-flip-icon { color: #ff9f43; }
.pf-stat-flip:nth-child(2) .pf-stat-flip-icon { color: #ff6b35; }
.pf-stat-flip:nth-child(3) .pf-stat-flip-icon { color: var(--fw-gold, #d4a853); }

.pf-stat-flip-number {
    font-family: var(--fw-font-display, 'Cinzel', serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fw-pure-white, #fff);
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.pf-stat-flip-label {
    font-size: 0.55rem;
    color: var(--fw-gold, #d4a853);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* Hide hint on front */
.pf-stat-flip-hint {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   BACK - Detailed info (appears after flip)
   ═══════════════════════════════════════════════════════════════ */
.pf-stat-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotateY(180deg);
    background: linear-gradient(160deg,
        rgba(107, 45, 58, 0.85) 0%,
        rgba(74, 26, 46, 0.88) 50%,
        rgba(45, 18, 25, 0.88) 100%
    );
    border: 1px solid rgba(255, 159, 67, 0.3);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 107, 53, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

/* Decorative corner accents on back */
.pf-stat-back::before,
.pf-stat-back::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--fw-gold, #d4a853);
    opacity: 0.3;
}

.pf-stat-back::before {
    top: 6px;
    left: 6px;
    border-right: none;
    border-bottom: none;
    border-radius: 3px 0 0 0;
}

.pf-stat-back::after {
    bottom: 6px;
    right: 6px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 3px 0;
}

/* Back content */
.pf-stat-back-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    position: relative;
    z-index: 2;
}

.pf-stat-back-title {
    font-family: 'Cinzel', serif;
    font-size: 9px;
    font-weight: 600;
    color: var(--fw-sunset-peach, #ff9f43);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 159, 67, 0.25);
}

.pf-stat-back-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
}

.pf-stat-back-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pf-stat-back-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: var(--fw-sunset-peach, #ff9f43);
}

.pf-stat-back-icon i {
    display: block;
}

.pf-stat-back-info {
    flex: 1;
    min-width: 0;
}

.pf-stat-back-label {
    font-size: 7px;
    color: var(--fw-gold, #d4a853);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.pf-stat-back-value {
    font-family: 'Caveat', cursive;
    font-size: 15px;
    font-weight: 600;
    color: var(--fw-cream, #ffd6bf);
    line-height: 1.15;
}

.pf-stat-back-value.green {
    color: #7dff7d;
}

/* Rank badge */
.pf-stat-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.3), rgba(212, 168, 83, 0.2));
    padding: 5px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 159, 67, 0.3);
    font-family: 'Cinzel', serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--fw-sunset-peach, #ff9f43);
}

.pf-stat-rank-badge i {
    font-size: 12px;
}

/* Empty state for items */
.pf-stat-empty-state {
    text-align: center;
    padding: 4px;
}

.pf-stat-empty-icon {
    font-size: 26px;
    margin-bottom: 4px;
    opacity: 0.7;
    color: var(--fw-sunset-peach, #ff9f43);
}

.pf-stat-empty-icon i {
    display: block;
}

.pf-stat-empty-text {
    font-size: 11px;
    color: var(--fw-cream, #ffd6bf);
    line-height: 1.3;
    margin-bottom: 6px;
}

.pf-stat-shop-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    color: var(--fw-sunset-peach, #ff9f43);
    background: rgba(255, 107, 53, 0.15);
    padding: 4px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 107, 53, 0.2);
}

.pf-stat-shop-hint i {
    font-size: 12px;
}
