/* Estilos personalizados que complementan a Bootstrap */

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 800 800'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.15'%3E%3Ccircle r='1' cx='100' cy='100'/%3E%3Ccircle r='1.5' cx='200' cy='150'/%3E%3Ccircle r='1' cx='300' cy='250'/%3E%3Ccircle r='2' cx='400' cy='300'/%3E%3Ccircle r='1' cx='500' cy='150'/%3E%3Ccircle r='1.5' cx='600' cy='350'/%3E%3Ccircle r='1' cx='700' cy='250'/%3E%3Ccircle r='1' cx='150' cy='350'/%3E%3Ccircle r='2' cx='250' cy='450'/%3E%3Ccircle r='1' cx='350' cy='550'/%3E%3Ccircle r='1.5' cx='450' cy='450'/%3E%3Ccircle r='1' cx='550' cy='350'/%3E%3Ccircle r='2' cx='650' cy='250'/%3E%3Ccircle r='1' cx='750' cy='150'/%3E%3Ccircle r='1.5' cx='50' cy='450'/%3E%3Ccircle r='1' cx='150' cy='550'/%3E%3Ccircle r='2' cx='250' cy='650'/%3E%3Ccircle r='1' cx='350' cy='750'/%3E%3Ccircle r='1.5' cx='450' cy='650'/%3E%3Ccircle r='1' cx='550' cy='550'/%3E%3Ccircle r='2' cx='650' cy='450'/%3E%3Ccircle r='1' cx='750' cy='350'/%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.7;
    z-index: -1;
    animation: twinkle 15s linear infinite;
}

body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
        radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.2) 1px, transparent 1px),
        radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.2) 2px, transparent 2px),
        radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.3) 1px, transparent 1px),
        radial-gradient(circle at 90% 90%, rgba(255, 255, 255, 0.4) 2px, transparent 2px);
    background-size: 500px 500px;
    opacity: 0.3;
    z-index: -1;
    animation: sparkle 20s ease-in-out infinite alternate;
}

@keyframes sparkle {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

@keyframes twinkle {
    0% { background-position: 0 0; }
    100% { background-position: 100% 100%; }
}

/* Animaciones para los mensajes de estado */
#status {
    transition: all 0.3s ease;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, minmax(80px, 100px));
    grid-template-rows: repeat(3, minmax(80px, 100px));
    gap: 10px;
    margin: 0 auto;
    max-width: 320px;
    width: 100%;
}

.cell {
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), inset 0 0 10px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
}

.cell:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.symbol {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

.cell.x {
    background-color: rgba(220, 53, 69, 0.1);
}

.cell.x .symbol {
    color: #dc3545; /* Bootstrap danger color */
    text-shadow: 0 0 5px rgba(220, 53, 69, 0.3);
}

.cell.o {
    background-color: rgba(13, 110, 253, 0.1);
}

.cell.o .symbol {
    color: #0d6efd; /* Bootstrap primary color */
    text-shadow: 0 0 5px rgba(13, 110, 253, 0.3);
}

/* Los estilos del botón ahora son manejados por Bootstrap */

#restart {
    transition: all 0.3s ease;
}

#restart:hover {
    transform: scale(1.05);
}

/* Estilos responsivos */
@media (max-width: 576px) {
    .container {
        padding: 0 10px;
    }
    
    .board {
        grid-template-columns: repeat(3, minmax(65px, 85px));
        grid-template-rows: repeat(3, minmax(65px, 85px));
        max-width: 260px;
        gap: 6px;
    }
    
    .cell {
        font-size: 2.2rem;
        border-radius: 10px;
    }
    
    h1.display-5 {
        font-size: 1.8rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1.2rem;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 0 5px;
    }
    
    .board {
        grid-template-columns: repeat(3, minmax(55px, 75px));
        grid-template-rows: repeat(3, minmax(55px, 75px));
        max-width: 230px;
        gap: 5px;
        margin-bottom: 0.75rem;
    }
    
    .cell {
        font-size: 1.8rem;
        border-radius: 8px;
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .alert {
        margin-bottom: 0.75rem !important;
        padding: 0.5rem;
    }
    
    .card-header {
        padding: 0.75rem !important;
    }
    
    .card-footer {
        padding: 0.75rem !important;
    }
}

/* Animaciones */
@keyframes winner {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.card {
    animation: fadeIn 0.8s ease-out;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.winner-cell {
    animation: winner 0.5s ease-in-out;
    background-color: rgba(40, 167, 69, 0.3) !important; /* Bootstrap success color with opacity */
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.6) !important;
}

.winner-cell .symbol {
    animation: winner 0.5s ease-in-out infinite;
    color: #198754 !important; /* Bootstrap success color */
    text-shadow: 0 0 8px rgba(25, 135, 84, 0.5) !important;
}