/**
 * pattern-card.css — PatternCard Panel Styling
 *
 * Matches OGZPrime v2 design: glass-box treatment, thermal gradient confidence bar,
 * SVG pattern art display, scanning/detected state transitions.
 *
 * All classes prefixed with `pc-` to avoid conflicts.
 * Uses theme variables from dashboard CSS root.
 */

/* ─── Main Container ─────────────────────────────────────────────────── */
#patternCard {
    background: rgba(15, 15, 18, 0.55);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(255, 215, 0, 0.18);
    border-radius: 8px;
    padding: 12px;
    min-height: 180px;
    max-width: 280px;
    box-shadow: 0 6px 24px -8px rgba(255, 215, 0, 0.25), 0 1px 0 0 rgba(255, 215, 0, 0.08) inset;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-primary, #ffffff);
    transition: all 0.3s ease;
    user-select: none;
}

/* ─── State Visibility ───────────────────────────────────────────────── */
.pc-state-scanning { display: none; }
.pc-state-detected { display: none; }

#patternCard.pc-scanning .pc-state-scanning { display: block; }
#patternCard.pc-detected .pc-state-detected { display: block; }

/* ─── Scanning State ─────────────────────────────────────────────────── */
.pc-scanning {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
}

.pc-scan-icon {
    font-size: 24px;
    animation: pc-scan-pulse 2s ease-in-out infinite;
}

@keyframes pc-scan-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.pc-scan-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary, #a0a0a0);
}

.pc-last-detected {
    font-size: 8px;
    color: var(--ml-color, #ffd700);
    margin-top: 4px;
    text-align: center;
    line-height: 1.2;
}

/* ─── Detected State ─────────────────────────────────────────────────── */
.pc-detected-wrap {
    animation: pc-detected-flip 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes pc-detected-flip {
    0% {
        opacity: 0;
        transform: rotateY(90deg);
    }
    100% {
        opacity: 1;
        transform: rotateY(0deg);
    }
}

.pc-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ml-color, #ffd700);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

/* ─── SVG Art Container ──────────────────────────────────────────────── */
.pc-art-container {
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 204, 255, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
}

.pc-pattern-svg {
    width: 100%;
    height: 100%;
}

/* SVG element defaults (inherited from theme) */
.pc-pattern-svg text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    pointer-events: none;
}

/* ─── Description ────────────────────────────────────────────────────── */
.pc-description {
    font-size: 9px;
    line-height: 1.4;
    color: var(--text-secondary, #a0a0a0);
    margin-bottom: 8px;
}

/* ─── Confidence Bar ─────────────────────────────────────────────────── */
.pc-confidence-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.pc-conf-label {
    font-size: 9px;
    color: var(--text-secondary, #a0a0a0);
    min-width: 50px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pc-conf-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.pc-conf-fill {
    height: 100%;
    background: linear-gradient(90deg,
        #2563eb 0%,      /* blue (low) */
        #06b6d4 25%,     /* cyan */
        #00ff88 50%,     /* green (medium) */
        #ffd700 75%,     /* gold (high) */
        #ff3366 100%     /* red (very high) */
    );
    transition: width 0.3s ease;
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.4);
}

.pc-conf-val {
    font-size: 9px;
    font-family: 'Orbitron', 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--ml-color, #ffd700);
    min-width: 30px;
    text-align: right;
}

/* ─── History Section ────────────────────────────────────────────────── */
.pc-history-header {
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary, #a0a0a0);
    margin-bottom: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 6px;
}

.pc-history-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pc-hist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8px;
    padding: 3px 0;
}

.pc-hist-left {
    display: flex;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.pc-hist-time {
    color: var(--text-secondary, #a0a0a0);
    min-width: 45px;
    flex-shrink: 0;
}

.pc-hist-pattern {
    color: var(--core-color, #00ccff);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-hist-right {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: 4px;
    flex-shrink: 0;
}

.pc-hist-outcome {
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    text-transform: uppercase;
}

.pc-hist-outcome.win {
    color: var(--profit-color, #00ff88);
}

.pc-hist-outcome.loss {
    color: var(--loss-color, #ff3366);
}

.pc-hist-outcome.open {
    color: var(--text-secondary, #a0a0a0);
}

.pc-hist-pnl {
    font-size: 8px;
    min-width: 40px;
    text-align: right;
}

.pc-hist-pnl.profit {
    color: var(--profit-color, #00ff88);
}

.pc-hist-pnl.loss {
    color: var(--loss-color, #ff3366);
}

/* ─── High-Confidence Emphasis ───────────────────────────────────────── */
#patternCard.pc-high-confidence {
    box-shadow: 0 8px 40px -6px rgba(255, 215, 0, 0.45),
                0 1px 0 0 rgba(255, 215, 0, 0.18) inset,
                0 0 12px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.35);
}

#patternCard.pc-high-confidence .pc-title {
    animation: pc-confidence-flash 0.6s ease-out;
}

@keyframes pc-confidence-flash {
    0% {
        color: #ffff00;
        text-shadow: 0 0 8px rgba(255, 255, 0, 0.8);
    }
    100% {
        color: var(--ml-color, #ffd700);
        text-shadow: none;
    }
}

/* ─── Responsive Adjustments ─────────────────────────────────────────── */
@media (max-width: 640px) {
    #patternCard {
        max-width: 100%;
        min-height: auto;
    }

    .pc-art-container {
        height: 60px;
    }

    .pc-title {
        font-size: 12px;
    }

    .pc-description {
        font-size: 8px;
    }
}

/* ─── Hover Effects (Optional for future interactive features) ────────── */
#patternCard:hover {
    box-shadow: 0 8px 30px -6px rgba(255, 215, 0, 0.35),
                0 1px 0 0 rgba(255, 215, 0, 0.12) inset;
}
