/**
 * Woodwalker Quartett - Animationen
 */

/* Screen Transitions */
.screen-enter {
    animation: screenEnter 0.3s ease-out forwards;
}

.screen-exit {
    animation: screenExit 0.3s ease-in forwards;
}

@keyframes screenEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes screenExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Button Press Effect */
.btn {
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn:active {
    transform: scale(0.95);
}

/* Card Hover Effect */
.card.interactive:hover {
    transform: translateY(-5px);
}

/* Win Animation */
.win-animation {
    animation: winPulse 0.5s ease-out;
}

@keyframes winPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Lose Animation */
.lose-animation {
    animation: loseShake 0.5s ease-out;
}

@keyframes loseShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

/* Card Deal Animation */
.card-deal {
    animation: cardDeal 0.5s ease-out forwards;
}

@keyframes cardDeal {
    from {
        opacity: 0;
        transform: translateY(-100px) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

/* Attribute Selection Glow */
.attr-item.selectable {
    position: relative;
    overflow: hidden;
}

.attr-item.selectable::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.3s ease;
}

.attr-item.selectable:hover::before {
    left: 100%;
}

/* Result Flash */
.result-flash {
    animation: resultFlash 0.3s ease-out;
}

@keyframes resultFlash {
    0% { background-color: transparent; }
    50% { background-color: rgba(255, 255, 255, 0.3); }
    100% { background-color: transparent; }
}

/* Score Change Animation */
.score-change {
    animation: scoreChange 0.5s ease-out;
}

@keyframes scoreChange {
    0% {
        transform: scale(1);
        color: inherit;
    }
    50% {
        transform: scale(1.3);
        color: var(--color-success);
    }
    100% {
        transform: scale(1);
        color: inherit;
    }
}

/* Confetti Animation (for wins) */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    animation: confettiFall 3s linear forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Notification Slide */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    background: var(--color-bg-light);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-card);
    animation: notificationSlide 0.3s ease-out;
    z-index: 1000;
}

.notification.fade-out {
    animation: notificationFadeOut 0.3s ease-in forwards;
}

@keyframes notificationSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes notificationFadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Loading Dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: loadingDot 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* Card Stack Effect */
.card-stack {
    position: relative;
}

.card-stack::before,
.card-stack::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--color-bg-light);
    border-radius: 1rem;
    z-index: -1;
}

.card-stack::before {
    top: 4px;
    left: 4px;
    opacity: 0.5;
}

.card-stack::after {
    top: 8px;
    left: 8px;
    opacity: 0.3;
}

/* Ripple Effect for Buttons */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn-ripple:active::after {
    width: 200%;
    height: 200%;
}

/* Bounce on Mount */
.bounce-in {
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   COMPARISON OVERLAY
   ======================================== */

.comparison-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.comparison-overlay.show {
    opacity: 1;
}

.comparison-box {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    min-width: 300px;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 3px solid #4a5568;
}

.comparison-overlay.show .comparison-box {
    transform: scale(1);
}

.comparison-box.winner-player {
    border-color: #48bb78;
    box-shadow: 0 0 30px rgba(72, 187, 120, 0.5);
}

.comparison-box.winner-opponent {
    border-color: #f56565;
    box-shadow: 0 0 30px rgba(245, 101, 101, 0.5);
}

.comparison-box.winner-draw {
    border-color: #ecc94b;
    box-shadow: 0 0 30px rgba(236, 201, 75, 0.5);
}

.comparison-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #a0aec0;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.comparison-values {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.comparison-player,
.comparison-opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    min-width: 80px;
}

.comparison-player.highlight {
    background: rgba(72, 187, 120, 0.3);
    animation: winnerPulse 0.5s ease-out;
}

.comparison-opponent.highlight {
    background: rgba(245, 101, 101, 0.3);
    animation: winnerPulse 0.5s ease-out;
}

@keyframes winnerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.comparison-label {
    font-size: 0.875rem;
    color: #a0aec0;
    margin-bottom: 0.5rem;
}

.comparison-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
}

.comparison-vs {
    font-size: 1.5rem;
    font-weight: bold;
    color: #718096;
}

.comparison-result {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    animation: resultBounce 0.5s ease-out 0.2s both;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.comparison-result:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.comparison-result:active {
    transform: scale(0.98);
}

.winner-player .comparison-result {
    background: #48bb78;
    color: #fff;
}

.winner-opponent .comparison-result {
    background: #f56565;
    color: #fff;
}

.winner-draw .comparison-result {
    background: #ecc94b;
    color: #1a202c;
}

@keyframes resultBounce {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Draw-Klasse für Attribute */
.attr-item.draw {
    background: #ecc94b;
    color: #1a202c;
}

/* ========================================
   MODAL DIALOGE
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 1rem;
    border: 2px solid #4a5568;
    min-width: 300px;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.show .modal-box {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #4a5568;
    background: rgba(0, 0, 0, 0.2);
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    color: #fff;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
    color: #e2e8f0;
}

.modal-body p {
    margin: 0;
    line-height: 1.6;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #4a5568;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
}

.modal-footer .btn {
    min-width: 100px;
}

/* Responsive */
@media (max-width: 576px) {
    .modal-box {
        min-width: 280px;
        margin: 1rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ========================================
   NAME INPUT MODAL
   ======================================== */

.name-input-modal {
    text-align: center;
}

.name-input-modal .modal-header {
    border-bottom: none;
    padding-bottom: 0;
}

.name-input-modal .modal-title {
    font-size: 1.5rem;
}

.name-input-modal .modal-body p {
    color: #a0aec0;
    margin-bottom: 1rem;
}

.name-input-modal .name-input {
    font-size: 1.25rem;
    text-align: center;
    padding: 0.75rem;
    background: #1a202c;
    border: 2px solid #4a5568;
    color: #fff;
}

.name-input-modal .name-input:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3);
}

.name-input-modal .modal-footer {
    border-top: none;
    justify-content: center;
}

.name-input-modal .btn-primary {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
