/* static/css/wordie_style.css */

/* Global Styles */
:root {
    --primary-color: #6aaa64;
    --secondary-color: #c9b458;
    --absent-color: #787c7e;
    --light-gray: #d3d6da;
    --dark-gray: #878a8c;
    --background-color: #ffffff;
    --text-color: #1a1a1b;
    --border-radius: 4px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s;
}

.button:hover {
    background-color: #588e52;
}

.button.outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.button.outline:hover {
    background-color: rgba(106, 170, 100, 0.1);
}

.button.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

.hint {
    font-size: 0.9rem;
    color: var(--dark-gray);
    margin-top: 0.5rem;
}

/* Alerts */
.alert {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

/* Success Card */
.card.success {
    border-left: 5px solid var(--primary-color);
}

.game-info {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
}

.share-section {
    margin: 1.5rem 0;
}

.share-link {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.share-link input {
    flex: 1;
}

/* Join Game Form */
.join-game {
    margin-top: 1rem;
}

.join-game form {
    display: flex;
    gap: 0.5rem;
}

.join-game input {
    flex: 1;
}

.or-divider {
    text-align: center;
    margin: 1rem 0;
    position: relative;
}

.or-divider::before,
.or-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background-color: var(--light-gray);
}

.or-divider::before {
    left: 0;
}

.or-divider::after {
    right: 0;
}

/* Game Board */
.game-container {
    max-width: 500px;
}

#game-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 2rem;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.tile {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    border: 2px solid var(--light-gray);
    background-color: white;
}

.tile.correct {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tile.present {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.tile.absent {
    background-color: var(--absent-color);
    border-color: var(--absent-color);
    color: white;
}

.tile.active {
    border-color: var(--dark-gray);
}

.tile.shake {
    animation: shake 0.5s;
}

.tile.flip {
    animation: flip 0.5s;
}

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

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

/* Keyboard */
#keyboard {
    margin-bottom: 2rem;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.key {
    background-color: var(--light-gray);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    margin: 0 2px;
    min-width: 2rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 3rem;
}

.key[data-key="ENTER"],
.key[data-key="BACKSPACE"] {
    max-width: 4.5rem;
    font-size: 0.8rem;
}

.key.correct {
    background-color: var(--primary-color);
    color: white;
}

.key.present {
    background-color: var(--secondary-color);
    color: white;
}

.key.absent {
    background-color: var(--absent-color);
    color: white;
}

.spacer {
    flex: 0.5;
}

/* Message */
#message {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    font-weight: bold;
}

#message.error {
    background-color: #f8d7da;
    color: #721c24;
}

#message.success {
    background-color: #d4edda;
    color: #155724;
}

.hidden {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
}

/* Media Queries */
@media (max-width: 480px) {
    .key {
        height: 3rem;
        font-size: 0.9rem;
    }
    
    .tile {
        font-size: 1.5rem;
    }
}

/* Links */
.back-link,
.home-link {
    text-align: center;
    margin-top: 1rem;
}

.back-link a,
.home-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.back-link a:hover,
.home-link a:hover {
    text-decoration: underline;
}

/* Additional CSS to fix game board visibility */

#game-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    margin: 20px auto;
    max-width: 330px;
    width: 100%;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.tile {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    border: 2px solid #d3d6da;
    background-color: white;
}

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

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

/* Status styling */
.tile.correct {
    background-color: #6aaa64;
    border-color: #6aaa64;
    color: white;
}

.tile.present {
    background-color: #c9b458;
    border-color: #c9b458;
    color: white;
}

.tile.absent {
    background-color: #787c7e;
    border-color: #787c7e;
    color: white;
}

.tile.active {
    border-color: #878a8c;
}

.tile.shake {
    animation: shake 0.5s;
}

.tile.flip {
    animation: flip 0.5s;
}