/* ====================================
   MAAŞ EŞLEŞTIRME - ÇALIŞAN FLİP!
   ==================================== */

/* Grid - 2x3 */
.match-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    flex: 1;
    min-height: 0;
    padding-bottom: 0.5rem;
}

/* Card Button */
.match-card {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    height: clamp(180px, 24vh, 220px);
    perspective: 1000px;
}

/* Inner - DÖNECEKdiv */
.match-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
}

/* Flip trigger */
.match-card[data-state="revealed"] .match-card-inner,
.match-card[data-state="matched"] .match-card-inner {
    transform: rotateY(180deg);
}

/* Faces - MUTLAKA absolute + full size */
.match-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* BACK - başta görünür */
.match-card-back {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff;
    font-size: 3rem;
    font-weight: 700;
    border: 2px solid rgba(148,163,184,0.3);
}

/* FRONT - flip sonrası görünür */
.match-card-front {
    background: linear-gradient(135deg, #fff, #f8fafc);
    color: #0f172a;
    border: 2px solid rgba(148,163,184,0.2);
    transform: rotateY(180deg);
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

/* ====================================
   CONTENT STYLES
   ==================================== */

.match-amount {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: #0f172a;
}

.match-title {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.match-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.match-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.6rem;
    background: rgba(15,23,42,0.08);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
}

.match-chip svg {
    width: 0.75rem;
    height: 0.75rem;
}

/* ====================================
   ANIMATIONS
   ==================================== */

/* Doğru eşleşme */
.match-card.match-correct .match-card-front {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: #22c55e;
    animation: matchPulse 0.6s ease;
    box-shadow: 0 0 0 4px rgba(34,197,94,0.2),
                0 8px 24px rgba(34,197,94,0.4);
}

.match-card.match-correct .match-amount,
.match-card.match-correct .match-title {
    color: #15803d;
}

@keyframes matchPulse {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.05); }
}

/* Yanlış eşleşme */
.match-card.match-wrong .match-card-front {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: #ef4444;
    animation: matchShake 0.5s ease;
    box-shadow: 0 0 0 4px rgba(239,68,68,0.2),
                0 8px 24px rgba(239,68,68,0.4);
}

.match-card.match-wrong .match-amount,
.match-card.match-wrong .match-title {
    color: #b91c1c;
}

@keyframes matchShake {
    0%, 100% { transform: rotateY(180deg) translateX(0); }
    25% { transform: rotateY(180deg) translateX(-8px); }
    75% { transform: rotateY(180deg) translateX(8px); }
}

/* Matched state */
.match-card[data-state="matched"] .match-card-front {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: #22c55e;
    box-shadow: 0 4px 16px rgba(34,197,94,0.3);
}

.match-card[data-state="matched"] .match-amount,
.match-card[data-state="matched"] .match-title {
    color: #15803d;
}

.match-card[data-state="matched"] .match-chip {
    background: rgba(34,197,94,0.15);
    color: #15803d;
}

/* Enter animation */
.match-card.card-enter {
    animation: cardEnter 0.4s cubic-bezier(0.34,1.56,0.64,1) backwards;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
}

/* ====================================
   SONUÇ EKRANI
   ==================================== */

.match-history {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.match-history li {
    position: relative;
    border-radius: 1.25rem;
    border: 1px solid rgba(148,163,184,0.25);
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(30,41,59,0.9));
    backdrop-filter: blur(12px);
    color: #e2e8f0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    overflow: hidden;
}

.match-history li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(148,163,184,0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.match-history li:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    border-color: rgba(148,163,184,0.4);
}

.match-history li:hover::before {
    opacity: 1;
}

/* Summary cards */
.match-summary-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-summary-card--success {
    border-color: rgba(34,197,94,0.4);
    background: linear-gradient(135deg, rgba(6,78,59,0.3), rgba(15,23,42,0.95));
    box-shadow: 0 4px 20px rgba(34,197,94,0.25);
}

.match-summary-card--success::before {
    background: linear-gradient(90deg, transparent, rgba(34,197,94,0.5), transparent);
}

.match-summary-card--success:hover {
    border-color: rgba(34,197,94,0.6);
    box-shadow: 0 8px 32px rgba(34,197,94,0.35);
}

.match-summary-card--fail {
    border-color: rgba(248,113,113,0.4);
    background: linear-gradient(135deg, rgba(127,29,29,0.3), rgba(15,23,42,0.95));
    box-shadow: 0 4px 20px rgba(248,113,113,0.25);
}

.match-summary-card--fail::before {
    background: linear-gradient(90deg, transparent, rgba(248,113,113,0.5), transparent);
}

.match-summary-card--fail:hover {
    border-color: rgba(248,113,113,0.6);
    box-shadow: 0 8px 32px rgba(248,113,113,0.35);
}

.match-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.match-summary-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.match-summary-status--success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
}

.match-summary-status--fail {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.match-summary-card .match-title {
    color: #f8fafc;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.match-summary-card .match-meta {
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.match-summary-card .match-chip {
    background: rgba(248,250,252,0.15);
    color: #e2e8f0;
    border: 1px solid rgba(248,250,252,0.2);
    font-weight: 600;
}

.match-summary-card .match-amount {
    color: #f8fafc;
    font-size: 1.75rem;
    font-weight: 800;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 0.75rem;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

@media (max-width: 640px) {
    .match-history {
        grid-template-columns: 1fr;
    }
}
