/* Import theme variables for all games */
@import url('/css/theme.css');

/* Shared Game Components CSS - Consolidated */

/* Global Game Styling */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    padding-top: 80px; /* Space for navbar */
}

/* Main Content Layout */
.main-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    min-height: calc(100vh - 80px);
}

/* Headers */
h1 {
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: clamp(2rem, 5vw, 3rem);
    text-shadow: 0 2px 4px var(--shadow-color);
}

h2, h3 {
    color: var(--primary);
    margin: 1rem 0;
}

/* OR Divider */
.or-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
    color: var(--text-secondary);
}

.or-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
    z-index: 1;
}

.or-divider::after {
    content: 'or';
    background: var(--bg-gradient-start);
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

/* ========== ANIMATIONS ========== */

/* Keyframe Definitions */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes celebration {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.2) rotate(5deg);
    }
    50% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(1.2) rotate(3deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary);
    }
    50% {
        box-shadow: 0 0 20px var(--primary), 0 0 30px var(--primary);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Game Container Entrance Animation */
.main-content {
    animation: fadeIn 0.8s ease-out;
}

.main-content .container {
    animation: slideInUp 0.6s ease-out;
}

/* Guess Row Animations */
.guess-row.new-guess {
    animation: slideInRight 0.5s ease-out forwards;
    transform: translateX(100%);
    opacity: 0;
}

.guess-row.new-guess.animate {
    transform: translateX(0);
    opacity: 1;
}

.guess-row:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

/* Guess Cell Animations */
.guess-cell {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.guess-cell::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.6s ease;
}

.guess-cell:hover::before {
    left: 100%;
}

.guess-cell.correct {
    animation: celebration 0.8s ease-in-out, glow 2s ease-in-out infinite;
}

.guess-cell.partial {
    animation: bounce 0.6s ease-in-out;
}

.guess-cell.incorrect {
    animation: pulse 0.4s ease-in-out;
}

/* Win/Loss Status Animations */
.game-status.win {
    animation: celebration 1.2s ease-in-out, glow 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.game-status.win::after {
    content: '✨';
    position: absolute;
    top: 10px;
    right: 10px;
    animation: sparkle 2s ease-in-out infinite;
    font-size: 1.5rem;
}

.game-status.lose {
    animation: pulse 0.8s ease-in-out;
}

/* Button Animations */
button {
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

button:active::before {
    width: 300px;
    height: 300px;
}

button:hover {
    animation: pulse 0.3s ease-in-out;
}

/* Game Board/Card Animations */
.memory-card,
.cell {
    transition: all 0.3s ease;
}

.memory-card:hover,
.cell:hover {
    animation: bounce 0.5s ease-in-out;
}

/* Loading Animation */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-top: 2px solid transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
}

/* Cleaned up - no longer needed */

/* Form Element Animations */
input:focus,
select:focus {
    animation: glow 0.5s ease-in-out;
}

/* Room Info Entrance */
#roomInfo,
#gameInfo {
    animation: slideInUp 0.7s ease-out 0.3s both;
}

/* Question Box Animation (for Never Have I Ever) */
#question-box {
    animation: slideInUp 0.8s ease-out 0.4s both;
}

/* Game Board Entrance */
#board {
    animation: slideInUp 0.9s ease-out 0.5s both;
}

/* Success/Error Message Animations */
.error-message:not(:empty) {
    animation: slideInUp 0.4s ease-out, fadeIn 0.4s ease-out;
}

/* Special Effects */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--primary);
    pointer-events: none;
    animation: confetti-fall 3s linear forwards;
    z-index: 9999;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti:nth-child(odd) {
    background: var(--primary-light);
    animation-duration: 2.5s;
}

.confetti:nth-child(3n) {
    background: #ffd700;
    animation-duration: 3.5s;
}

/* Game Entrance Sequence */
.game-entrance {
    animation: gameEntrance 1.2s ease-out;
}

@keyframes gameEntrance {
    0% {
        transform: scale(0.8) rotateY(180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotateY(90deg);
        opacity: 0.5;
    }
    100% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
}

/* Typing Animation for Status Messages */
.typing {
    overflow: hidden;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    animation: typing 2s steps(40) forwards, blink 0.8s infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* Shake Animation for Wrong Answers */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Flip Animation for Memory Cards */
.flip {
    animation: flip 0.6s ease-in-out;
}

@keyframes flip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

/* Score Pop Animation */
.score-pop {
    animation: scorePop 0.8s ease-out;
}

@keyframes scorePop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
        color: var(--primary-light);
    }
    100% {
        transform: scale(1);
    }
}

/* Navbar Animation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--navbar-bg);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 15px var(--shadow-color);
    z-index: 1000;
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px var(--primary);
}

.logo:hover {
    color: var(--primary-light);
    text-shadow: 0 0 15px var(--primary-light);
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-links a:hover {
    color: var(--primary-light);
    background: rgba(76, 52, 153, 0.15);
    transform: translateY(-2px);
}

/* Basic Container */
.main-content .container {
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    width: clamp(320px, 95vw, 1800px);
    margin: 2rem auto;
    /* Individual games will override background and colors */
}

/* Room System Styles */
.room-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 15px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.or-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

/* Common Form Elements - With theme colors */
input[type="text"],
input[type="password"],
input[type="email"],
select {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    background: var(--background-light);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 52, 153, 0.2);
}

/* Basic Button Structure with theme colors */
button {
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    background: var(--primary);
    color: var(--button-text);
    border: 2px solid var(--primary);
}

button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Game Info & Room Info */
#roomInfo,
#gameInfo {
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    max-width: 800px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

#roomInfo p,
#gameInfo p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

/* Player Info */
#playerInfo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: 10px;
}

.player-stats {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.player-stats:hover {
    transform: translateY(-2px);
}

.player-stats p {
    margin: 0.5rem 0;
}

.player-stats p:first-child {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

/* Status Message */
#status {
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    font-weight: 500;
    text-align: center;
    background: var(--background-light);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Button Group */
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* Error Messages - Only show when has content */
.error-message {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    text-align: center;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
    display: none; /* Hidden by default */
}

.error-message:not(:empty) {
    display: block; /* Only show when has content */
}

/* Back Button */
.back-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-top: 2rem;
    background: var(--background-light);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.back-button:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: var(--primary);
    color: var(--button-text);
}

/* Utility Classes */
.hidden {
    display: none;
}

.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }

    .navbar {
        padding: 0.8rem 1rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .main-content .container {
        padding: 1.5rem;
        margin: 0.5rem;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    .button-group {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }

    button {
        width: 100%;
        max-width: 300px;
    }

    #playerInfo {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .room-controls {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    #roomInfo,
    #gameInfo {
        padding: 1rem;
    }
} 